While using multiple MPI_Isend and MPI_Irecv, should I re declare MPI_Request request, or just declare once and reuse the request object. If I have to re-declare can you answer with an example.
Yes, you can reuse MPI_Request variables. Those variables are only handles and they do not need to be initialized for passing them to MPI_Isend or MPI_Irecv (they are only marked as OUT parameters for those functions). Of course they have to be valid when passing to any function that completes them like MPI_Wait. Those functions will also set the variables to MPI_REQUEST_NULL upon completion.
You can even go further, and use persistent communication requests. If you have requests in a loop that retain the same argument list across multiple calls. You can use MPI_Send_init etc. together with MPI_Start. This can have better performance. Note that with persistent requests, the completion functions (e.g. MPI_Wait) will only mark the request as inactive rather than setting the variable to MPI_REQUEST_NULL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With