MPI_Sendrecv with operation on recvbuf?
MPI_Recvreduce is what you're looking for. Unfortunately, it doesn't exist yet. It's something that the MPI Forum has been looking at adding to a future version of the standard, but hasn't yet been adopted and won't be in the upcoming MPI 3.1.
I use the MPI_Sendrecv MPI function to communicate arrays of data between processes. I do this in Python using mpi4py, but I'm pretty sure my question is independent of the language used.
What I really want is to add an array residing on another process to an existing local array. This should be done for all processes, so I use the MPI_Sendrecv function to send and receive the arrays in one go. I can then add the received array in the recvbuf to the local array and I'm done.
It would be nice however if I could save the step of having a separate recvbuf array, and simply receiving the data directly into the local array without overwriting the existing data, but rather updating it using some operation (addition in my case).
I guess what I'm looking for is a combined MPI_Sendrecv/MPI_Reduce function. Do some function like this exist in MPI?