[mpich-discuss] MPI_Send:invalid rank ,error stack:
sankar s
keanesankar at gmail.com
Thu May 6 00:31:01 CDT 2010
Hi
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.
/* OUTPUT*/
C:\Users\Sankar\My Documents\visual studio 2008\Projects\mpi\Debug>mpiexec
mpi.exe
Fatal error in MPI_Send: Invalid rank, error stack:
MPI_Send(174): MPI_Send(buf=0015FE0B, count=1, MPI_CHAR, dest=1, tag=1,
MPI_COMM
_WORLD) failed
MPI_Send(99).: Invalid rank has value 1 but must be nonnegative and less
than 1
successfully entered
job aborted:
rank: node: exit code[: error message]
0: Sankar-PC: 1: Fatal error in MPI_Send: Invalid rank, error stack:
MPI_Send(174): MPI_Send(buf=0015FE0B, count=1, MPI_CHAR, dest=1, tag=1,
MPI_COMM
_WORLD) failed
MPI_Send(99).: Invalid rank has value 1 but must be nonnegative and less
than 1
/* PROGRAM CODE*/
#include "mpi.h"
#include <stdio.h>
int main(argc,argv)
int argc;
char *argv[]; {
int numtasks, rank, dest, source, rc, count, tag=1;
char inmsg, outmsg='x';
MPI_Status Stat;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
printf("successfully entered");
dest = 1;
source = 1;
rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD);
rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD, &Stat);
}
else if (rank == 1) {
dest = 0;
source = 0;
rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD, &Stat);
rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD);
}
rc = MPI_Get_count(&Stat, MPI_CHAR, &count);
printf("Task %d: Received %d char(s) from task %d with tag %d \n",
rank, count, Stat.MPI_SOURCE, Stat.MPI_TAG);
MPI_Finalize();
}
am doing project on parallel programming. can you help me in this..needed
urgently
Thanks in advance
Regards
sankar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20100506/62ce6c02/attachment.htm>
More information about the mpich-discuss
mailing list