Many ranks MPI_Isend to one rank

Many ranks MPI_Isend to one rank

So.. the code above is something I think it should've worked but it's bugging (by bugging i mean that rank 0 is expecting the messages

and the other ranks are waiting for them to be received but that never happens).

What I tried to do was something like this:

if(rank == 0){
	for (a = 0; a < 100; a++){
		MPI_Recv(&buff, 1, MPI_INT, MPI_ANY_SOURCE, a+100; MPI_COMM_WORLD, &status);
		MPI_Recv(&buff2, 1, MPI_INT, MPI_ANY_SOURCE, a+100; MPI_COMM_WORLD, &status);
		MPI_Recv(&buff3, 1, MPI_INT, MPI_ANY_SOURCE, a+100; MPI_COMM_WORLD, &status);
	}
}else{

	// Receive id that goes from 0 to 99. line 2.
	MPI_Recv(&id, 1, MPI_INT, 1, RECEIVEID, MPI_COMM_WORLD, &status);

	MPI_Request requestNull;

	MPI_Isend(&buff4, 1, MPI_INT, 0, id+100, MPI_COMM_WORLD, &requestNull);
	MPI_Isend(&buff5, 1, MPI_INT, 0, id+100, MPI_COMM_WORLD, &requestNull);
	MPI_Isend(&buff6, 1, MPI_INT, 0, id+100, MPI_COMM_WORLD, &requestNull);
}

 

I already did something like this as well and it didn't work..

MPI_Request request[3];
MPI_Status status[3];

MPI_Isend(&buff4, 1, MPI_INT, 0, id+100, MPI_COMM_WORLD, &request[0]]);
MPI_Isend(&buff5, 1, MPI_INT, 0, id+100, MPI_COMM_WORLD, &request[1]);
MPI_Isend(&buff6, 1, MPI_INT, 0, id+100, MPI_COMM_WORLD, &request[2]);

MPI_Waitall(3, request, status);

 

So.. any help?

Thanks in advance!

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You are doing blocking receives on all nodes. SO unless they receive something the next instruction won't proceed.

Leave a Comment

Please sign in to add a comment. Not a member? Join today