Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I reuse request objects?

Tags:

c

mpi

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.

like image 227
killgore_bot Avatar asked Oct 28 '25 09:10

killgore_bot


1 Answers

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.

like image 145
Zulan Avatar answered Oct 29 '25 23:10

Zulan