Mariem
Mariem

Reputation: 159

MPI_ANY_SOURCE in non blocking receive (MPI_Irecv)

I use LD_PRELOAD to override the MPI_Irecv function with my own function to do some debugging of the MPI_Irecv function.

Here, my wrapper function "myMPI_Irecv.c" code:

int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
                    int tag, MPI_Comm comm, MPI_Request * request)
    {
         int rang_Irecv;
         MPI_Comm_rank(comm, &rang_Irecv);

         printf(" Calling MPI_Irecv, je suis processeur=%d, source=%d, buffer=%p\n", rang_Irecv,source,buf);
    
         return PMPI_Irecv(buf, count, datatype, source, tag, comm, request);
    }

After running my MPI application (I am using MPICH): I found that there are some calls of MPI_ANY_SOURCE, because I found SOURCE=-2 when I print the source.

My question, is how to know which source (sender) for the nonblocking receive MPI_Irecv ?

Thank you in advance.

Best regards,

Upvotes: 0

Views: 127

Answers (1)

Victor Eijkhout
Victor Eijkhout

Reputation: 5794

I suspect (you didn't include enough code) that you are reading the source of the receive call. Instead you have to look at the MPI_Wait call for that receive. It outputs a status object, and you can investigate mystatus.MPI_SOURCE to see where the message actually came from.

Upvotes: 1

Related Questions