In MPI, is it possible to immediately throw out received data without allocating a buffer to hold it? I'm using MPI_Allgather to collect data from several processes, but at some point, one or more processes have no useful data to send.
My original solution was to let the useless process finish. However, if a task terminates without calling MPI_Allgather, the rest end up in deadlock, because MPI_Allgather blocks. In order to overcome this problem I keep all the processes around until the end, but send junk data that is never used.
The useful processes keep some of the received data, but the useless processes don't. I tried passing a null pointer for the recbuf like so:
MPI_Allgather(&sendbuf, 1, MPI_INT, 0, 1, MPI_INT, MPI_COMM_WORLD);
but it didn't work. Is the anything I can do to avoid receiving, or at least storing the useless data?