MPI_Isend request parameter
c, mpi
Solution
Short answer is no - the request handle parameter cannot be `NULL`.
`MPI_Isend()` initiates an asynchronous send operation. All asynchronous operations are given a request handle that has to be acted on later in one of the following ways:
- block and wait for the operation to finish with `MPI_Wait()` and friends
- test the operation for completion with `MPI_Test()` and friends until the test turns out positive
- free the handle with `MPI_Request_free()`
Both waiting and testing functions free the request once it has completed. You can also free it immediately after it is returned by `MPI_Isend()`. This will not cancel the operation but rather mark the request for deletion as soon as it is finished. You won't be able to get the status of the send operation though.
If you don't care about the outcome of the asynchronous operation (e.g. completion status, message receive status, error code, etc.), the right thing to do is as follows:
MPI_Request req;
...
MPI_Isend(..., &req);
MPI_Request_free(&req);
...
Caveat: this works for asynchronous sends since one can devise another method to verify that the send operation has completed, e.g. the destination process might respond after receiving the message. But one should never free an asynchronous receive request and should wait or test for completion instead as there will be no way to know when the operation has been completed.
Problem
When using `MPI_Isend`, can the `MPI_Request` parameter be a null pointer (when the sender doesn't care about the message after it is sent)?