Hi all, Rajeev<br><br>I correct this, and i made some simplifications, and the problems appears to be caused by the fact of i add double variable declarations.<br><br>It is very strange. Some light to this?<br><br>Thanks<br>
Luiz<br><br><div><span class="gmail_quote">2007/1/23, Rajeev Thakur <<a href="mailto:thakur@mcs.anl.gov">thakur@mcs.anl.gov</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Where have you allocated space for
arquivo_nome?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Rajeev</font></span></div><br>
<blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">owner-mpich-discuss@mcs.anl.gov</a>
[mailto:<a href="mailto:owner-mpich-discuss@mcs.anl.gov" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">owner-mpich-discuss@mcs.anl.gov</a>] <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><span class="e" id="q_1105163aee8175a1_1">
<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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">luizmendesw@gmail.com</a>>:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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><br>Luiz
Mendes<br></span></blockquote></div><br></span></div></blockquote></div>
</blockquote></div><br>