[MPICH] Re: Problems with allreduce
Rajeev Thakur
thakur at mcs.anl.gov
Tue Jan 23 17:56:29 CST 2007
Where have you allocated space for arquivo_nome?
Rajeev
_____
From: owner-mpich-discuss at mcs.anl.gov
[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Luiz Mendes
Sent: Tuesday, January 23, 2007 5:05 PM
To: mpich-discuss
Subject: [MPICH] Re: Problems with allreduce
Discard variable "tempo", without this continue getting error.
thanks
2007/1/23, Luiz Mendes <luizmendesw at gmail.com>:
Hi all, i am with a problem in operation MPI_Allreduce.
The code is the following below:
int main(int argc, char *argv[])
{
int opcao, dimensao,nome_tamanho, processo, num_procs;
int coluna, contador_bytes, contador_bytes_parcial, interacao,
contador_total_bytes;
char *palavra = NULL, *arquivo_nome;
char *arquivo_pv;
char procname[MPI_MAX_PROCESSOR_NAME];
double inicio, termino, tempo_parcial, soma_tempo_total, valor;
long long offset;
MPI_Datatype linhaMatriz;
MPI_File arquivo;
MPI_Status status;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &processo);
MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
MPI_Get_processor_name(procname,&nome_tamanho);
while ((opcao = getopt(argc, argv, "A:D:P:h")) != EOF)
{
switch(opcao)
{
case 'A':
arquivo_pv =optarg;
sprintf(arquivo_nome,"%s",arquivo_pv);
break;
case 'D':
sscanf (optarg, "%d", &dimensao);
break;
case 'P':
sprintf(arquivo_nome,"pvfs2:/mnt/pvfs2/%s",arquivo_pv);
}
}
MPI_Type_contiguous(dimensao,MPI_DOUBLE,&linhaMatriz);
MPI_Type_commit(&linhaMatriz);
MPI_File_open(MPI_COMM_WORLD, arquivo_nome, MPI_MODE_CREATE |
MPI_MODE_WRONLY, MPI_INFO_NULL, &arquivo);
for(interacao=0; interacao<(dimensao/num_procs);interacao++)
{
double matrizlocal[dimensao];
valor=processo*(dimensao/num_procs)*dimensao+interacao*dimensao;
offset=valor*sizeof(double);
for(coluna=0; coluna<dimensao; coluna++)
{
matrizlocal[coluna]=valor+coluna;
}
MPI_File_set_view(arquivo, offset, MPI_DOUBLE, linhaMatriz,
"native", MPI_INFO_NULL);
inicio=MPI_Wtime();
MPI_File_write(arquivo, matrizlocal, 1, linhaMatriz, &status);
termino=MPI_Wtime();
tempo_parcial=termino-inicio;
contador_bytes_parcial+=sizeof(matrizlocal);
soma_tempo_total+=tempo_parcial;
}
MPI_File_close(&arquivo);
MPI_Allreduce(&soma_tempo_total, &tempo, dimensao, MPI_DOUBLE,
MPI_MAX,MPI_COMM_WORLD);
MPI_Finalize();
.......
Do you know what could be happening?
Thanks
Luiz Mendes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20070123/9165211d/attachment.htm>
More information about the mpich-discuss
mailing list