Error On Communicator Mpi_comm_world
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this mpi_err_rank: invalid rank site About Us Learn more about Stack Overflow the company Business Learn more mpi_err_comm: invalid communicator about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x mpi_send Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MPI_Send/ Recv communicator datatype error up vote 1 down vote favorite I have the following basic MPI program written in Fortran 90: program sendRecv include 'mpif.h' !MPI Variables integer ierr, numProcs, procID !My variables integer dat, datRec !Init MPI call MPI_INIT ( ierr ) !Get number of processes/ cores requested call MPI_COMM_SIZE (MPI_COMM_WORLD, numProcs, ierr) !Get rank of process call MPI_COMM_RANK (MPI_COMM_WORLD, procID, ierr) if (procID .eq. 0) then dat=4 !Send num to process 1 call MPI_SEND (dat, 1, MPI_INT, 1, 0, MPI_COMM_WORLD, ierr) else if (procID .eq. 1) then !Recieve num from process 0 call MPI_RECV (datRec, 1, MPI_INT, 0, MPI_ANY_SOURCE, MPI_COMM_WORLD, MPI_STATUS_SIZE, ierr) !Display info write(*,*) "Process 1 recieved ", datRec, " from proc 0" else write(*,*)"Into else" end if !Finilise MPI call MPI_FINALIZE ( ierr ) end program sendRecv The purpose is just to send an integer from process 0 and receive and display it in process 1, but whatever i seem to try, i cannot get it to work. I am compiling and running this program with: mpif90 sendRecv.f90 -o tst mpirun -n 2 tst and am getting this: [conor-Latitude-XT2:3053] *** An error occurred in MPI_Send [conor-Latitude-XT2:3053] *** on communicator MPI_COMM_WORLD [conor-Latitude-XT2:3053] *** MPI_ERR_TYPE: invalid datatype [conor-Latitude-XT2:3053] *** MPI_ERRORS_ARE_FATAL (your MPI job will now abort) -------------------------------------------------------------------------- mpirun has exited due to process rank 1 with PID 3054 on node conor-Latitude-XT2 exiting without calling "finalize". This may have caused other processes in the application to be terminated by signals sent by mpirun (as reported here). -------------------------------------------------------------------------- [conor-Latitude-XT2:03052] 1 more process has sent help message help-mpi-errors.txt
wrote: I tried to run code : #include
Specific Boards Linux Programming Communication using MPI Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: http://cboard.cprogramming.com/linux-programming/112663-communication-using-mpi.html Communication using MPI Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 02-25-2009 #1 Cell View Profile View Forum Posts PhysicistTurnedProgrammer Join Date Jan 2009 Location New Jersey Posts 72 Communication using MPI Hey guys, I am trying to send a string from one processor to another using MPI. In one file, I have the send function specified by: Code: error on MPI_Send(str, 128, MPI_CHAR, 1, my_rank, MPI_COMM_WORLD); where my_rank is 0. And in another file, I have the receive function: Code: MPI_Recv(str, 128, MPI_CHAR, 0, my_rank, MPI_COMM_WORLD, MPI_STATUS_IGNORE); where my_rank is 1. The files compile. But when I try to run the program I get the following error: Code: An error occurred in MPI_Send on communicator MPI_COMM_WORLD MPI_ERR_TAG: invalid tag MPI_ERRORS_ARE_FATAL (goodbye) From the MPI documentation: MPI_ERR_TAG Invalid tag argument. Tags must be non-negative; tags in error on communicator a receive (MPI_Recv, MPI_Irecv, MPI_Sendrecv, etc.) may also be MPI_ANY_TAG. The largest tag value is available through the the attribute MPI_TAG_UB. I've also tried using MPI_ANY_TAG and I've received the same error. I should also mention that the way I run the program is by using: Code: mpirun -np 1 send : -np 1 receive Does anyone have any ideas? Last edited by Cell; 02-25-2009 at 09:23 AM. Reason: Added more info. 02-25-2009 #2 Codeplug View Profile View Forum Posts Registered User Join Date Mar 2003 Posts 4,941 You have your Send/Recv parameters mixed up a bit. http://www.mpi-forum.org/docs/mpi-11...31.html#Node31 http://www.mpi-forum.org/docs/mpi-11...34.html#Node34 You can use MPI_ANY_TAG if it doesn't matter. gg How to Ask Questions The Smart Way How to Report Bugs Effectively The Only Correct Indent Style 02-25-2009 #3 Cell View Profile View Forum Posts PhysicistTurnedProgrammer Join Date Jan 2009 Location New Jersey Posts 72 Hmm, I don't see where I got the parameters wrong: From the link: Code: MPI_Send(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) From my code: Code: MPI_Send(str, 128, MPI_CHAR, 1, my_rank, MPI_COMM_WORLD); And for receive: Code: MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) From my code: Code: MPI_Recv(str, 128, MPI_CHAR, 0, my_rank, MPI_COMM_WORLD, MPI_STATUS_IGNORE); BTW, I'm using my_rank as the tag value. I tried using the parameters MPI_AN