<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.5730.11" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=852315523-23012007><FONT face=Arial
color=#0000ff size=2>Where have you allocated space for
arquivo_nome?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852315523-23012007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852315523-23012007><FONT face=Arial
color=#0000ff size=2>Rajeev</FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> owner-mpich-discuss@mcs.anl.gov
[mailto:owner-mpich-discuss@mcs.anl.gov] <B>On Behalf Of </B>Luiz
Mendes<BR><B>Sent:</B> Tuesday, January 23, 2007 5:05 PM<BR><B>To:</B>
mpich-discuss<BR><B>Subject:</B> [MPICH] Re: Problems with
allreduce<BR></FONT><BR></DIV>
<DIV></DIV>Discard variable "tempo", without this continue getting
error.<BR><BR>thanks<BR><BR>
<DIV><SPAN class=gmail_quote>2007/1/23, Luiz Mendes <<A
href="mailto:luizmendesw@gmail.com">luizmendesw@gmail.com</A>>:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hi
all, i am with a problem in operation MPI_Allreduce. <BR><BR>The code is the
following below: <BR><BR><SPAN style="FONT-STYLE: italic">int main(int argc,
char *argv[])</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">{</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> int opcao,
dimensao,nome_tamanho, processo, num_procs;</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
int coluna, contador_bytes, contador_bytes_parcial, interacao,
contador_total_bytes; </SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> char *palavra = NULL,
*arquivo_nome;</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> char
*arquivo_pv;</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> char
procname[MPI_MAX_PROCESSOR_NAME];</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> double inicio, termino,
tempo_parcial, soma_tempo_total, valor;</SPAN> <BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
long long offset;</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> MPI_Datatype
linhaMatriz;</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> MPI_File arquivo;</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_Status status;</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_Init(&argc, &argv);</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_Comm_rank(MPI_COMM_WORLD, &processo); </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_Comm_size(MPI_COMM_WORLD, &num_procs);</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_Get_processor_name(procname,&nome_tamanho); </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> while ((opcao = getopt(argc,
argv, "A:D:P:h")) != EOF)</SPAN> <BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> {</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
switch(opcao) </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
{</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
case 'A': </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
arquivo_pv
=optarg; </SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
sprintf(arquivo_nome,"%s",arquivo_pv);</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
break;
</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
case 'D': </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
sscanf
(optarg, "%d", &dimensao); </SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
break;</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
case 'P':</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
sprintf(arquivo_nome,"pvfs2:/mnt/pvfs2/%s",arquivo_pv);</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
}
</SPAN> <BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> }</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
</SPAN><BR style="FONT-STYLE: italic"><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_Type_contiguous(dimensao,MPI_DOUBLE,&linhaMatriz);</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_Type_commit(&linhaMatriz); </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> MPI_File_open(MPI_COMM_WORLD,
arquivo_nome, MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL,
&arquivo);</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
for(interacao=0;
interacao<(dimensao/num_procs);interacao++)</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
{</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> double
matrizlocal[dimensao];</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
valor=processo*(dimensao/num_procs)*dimensao+interacao*dimensao;
</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
offset=valor*sizeof(double);</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
for(coluna=0; coluna<dimensao; coluna++)
</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> {</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
matrizlocal[coluna]=valor+coluna;</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
}</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic"> </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_File_set_view(arquivo, offset, MPI_DOUBLE,
linhaMatriz, "native", MPI_INFO_NULL); </SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
inicio=MPI_Wtime();</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
MPI_File_write(arquivo, matrizlocal, 1,
linhaMatriz, &status); </SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
termino=MPI_Wtime();</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
tempo_parcial=termino-inicio;</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
contador_bytes_parcial+=sizeof(matrizlocal);</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
soma_tempo_total+=tempo_parcial;</SPAN><BR
style="FONT-STYLE: italic"><SPAN style="FONT-STYLE: italic">
}</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
MPI_File_close(&arquivo);</SPAN><BR
style="FONT-STYLE: italic"><SPAN
style="FONT-WEIGHT: bold; FONT-STYLE: italic">
MPI_Allreduce(&soma_tempo_total, &tempo, dimensao, MPI_DOUBLE,
MPI_MAX,MPI_COMM_WORLD);</SPAN><BR style="FONT-STYLE: italic"><SPAN
style="FONT-STYLE: italic">
MPI_Finalize(); <BR>.......<BR><BR></SPAN><BR>Do you
know what could be happening?<BR><BR>Thanks<BR><SPAN class=sg><BR>Luiz
Mendes<BR></SPAN></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>