Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can MPI sendbuf and recvbuf be the same thing?

Tags:

c

mpi

I'm adding together a load of array elements from each process:

double rho[1024];
//Some operation to calculate rho for each process;
MPI_Allreduce(rho,rho,1024,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);

Will having rho as both the sendbuf and recvbuf work?

like image 789
b3noxley Avatar asked May 12 '13 13:05

b3noxley


1 Answers

Have you checked MPI_IN_PLACE? According to MPI_AllReduce man page and MPI doc it can be used to specify the same buffer for sendbuf and recvbuf as long as you are working inside the same group.

The call would look like:

MPI_Allreduce(MPI_IN_PLACE,rho,1024,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
like image 165
saguiar Avatar answered Oct 10 '22 15:10

saguiar