Description
Problem
The function MPI_Request_get_status
provides completion information for a single given request handle, without actually freeing the request handle (i.e., setting it to MPI_REQUEST_NULL
).
In wrappers for performance tools often specific information needs to be written when a request completed (e.g., tracing event records) and the request handles are used as a key for the lookup of internal information. As a tool can only decide whether the key would have been needed after it has been reset in a test call, the incoming request array is duplicated for reference after completion has been detected.
It would be beneficial for tool wrappers if functions symmetric to MPI_Test_(any|some|all)
would exist, as that would eliminate the need of request duplication before calling into the PMPI layer.
Also using MPI_Request_get_status
inside the MPI_(Test|Wait)_(any|some|all)
wrappers by the tool is sub-optimal as that might change completion order depending on how requests are tested by the tool.
An example of how MPI_Request_get_status
could be used in MPI_Test
:
int MPI_Test(MPI_Request* req, int* flag, MPI_Status* status){
int ret = PMPI_Request_get_status(*req, flag, status);
if(*flag){
// tool code to handle the successful test
PMPI_Test(req, flag, MPI_STATUS_IGNORE);
}
return ret;
}
Here are example of the new proposed calls could be used:
int MPI_Testsome(int incount, MPI_Request req[], int* outcount, int* indices, MPI_Status* statuses[]){
int ret = PMPI_Request_get_status_some(incount, req, outcount, indices, statuses, flag);
for(int i=0; i < *outcount; i++){
// tool code to handle the successful test on req[indices[i]]
PMPI_Test(req[indices[i]], &flag, MPI_STATUS_IGNORE);
}
return ret;
}
int MPI_Testany(int count, MPI_Request req[], int* index, int* flag, MPI_Status* status){
int ret = PMPI_Request_get_status_any(count, req, index, flag, statuses);
if(flag){
// tool code to handle the successful test on req[index]
PMPI_Test(req[index], &flag, MPI_STATUS_IGNORE);
}
return ret;
}
int MPI_Testall(int incount, MPI_Request req[], int* flag, MPI_Status* statuses[]){
int ret = PMPI_Request_get_status_all(incount, req, flag, statuses);
if(flag){
// tool code to handle the successful test on all req
PMPI_Testall(req, &flag, MPI_STATUSES_IGNORE);
}
return ret;
}
Proposal
Adding the additional three calls (see text changes for actual function names) to the standard.
Changes to the Text
tbd.
Impact on Implementations
Implementation and support for those functions.
Impact on Users
Wrappers would not have to copy a potentially large request array before calling into PMPI.