Hi<div>am trying to run the below program in my Dell core2 duo processor using visual studio 2008 in windows 7. But its giving error in MPI_Send routine: I don't understand why its happening.I installed MPICH2 correctly and examples problems given in MPICH2 also running correctly.But when I try to use MPI_Send, its giving fatal error.</div>
<div><div><br></div><div><font class="Apple-style-span" color="#33CC00">/* OUTPUT*/</font></div><div>C:\Users\Sankar\My Documents\visual studio 2008\Projects\mpi\Debug>mpiexec mpi.exe</div><div><br></div><div>Fatal error in MPI_Send: Invalid rank, error stack:</div>
<div>MPI_Send(174): MPI_Send(buf=0015FE0B, count=1, MPI_CHAR, dest=1, tag=1, MPI_COMM</div><div>_WORLD) failed</div><div>MPI_Send(99).: Invalid rank has value 1 but must be nonnegative and less than 1</div><div>successfully entered</div>
<div>job aborted:</div><div>rank: node: exit code[: error message]</div><div>0: Sankar-PC: 1: Fatal error in MPI_Send: Invalid rank, error stack:</div><div>MPI_Send(174): MPI_Send(buf=0015FE0B, count=1, MPI_CHAR, dest=1, tag=1, MPI_COMM</div>
<div>_WORLD) failed</div><div>MPI_Send(99).: Invalid rank has value 1 but must be nonnegative and less than 1</div><div><br></div><div><font class="Apple-style-span" color="#FF0000">/* PROGRAM CODE*/</font></div></div><div>
<br><div><div>#include "mpi.h"</div><div>#include <stdio.h></div><div><br></div><div>int main(argc,argv) </div><div>int argc;</div><div>char *argv[]; {</div><div>int numtasks, rank, dest, source, rc, count, tag=1; </div>
<div>char inmsg, outmsg='x';</div><div>MPI_Status Stat;</div><div><br></div><div>MPI_Init(&argc,&argv);</div><div>MPI_Comm_size(MPI_COMM_WORLD, &numtasks);</div><div>MPI_Comm_rank(MPI_COMM_WORLD, &rank);</div>
<div><br></div><div>if (rank == 0) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>printf("successfully entered");</div><div> dest = 1;</div><div> source = 1;</div><div> rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD);</div>
<div> rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD, &Stat);</div><div> } </div><div><br></div><div>else if (rank == 1) {</div><div> dest = 0;</div><div> source = 0;</div><div> rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD, &Stat);</div>
<div> rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD);</div><div> }</div><div><br></div><div>rc = MPI_Get_count(&Stat, MPI_CHAR, &count);</div><div>printf("Task %d: Received %d char(s) from task %d with tag %d \n",</div>
<div> rank, count, Stat.MPI_SOURCE, Stat.MPI_TAG);</div><div><br></div><div><br></div><div>MPI_Finalize();</div><div>}</div><div> am doing project on parallel programming. can you help me in this..needed <font class="Apple-style-span" color="#CC0000">urgently</font></div>
<div>Thanks in advance</div><div><br></div><div><br></div><div>Regards</div><div>sankar</div><div><br></div></div></div>