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:
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 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?