-
Notifications
You must be signed in to change notification settings - Fork 8
Add functions to check multiple request statuses at once #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
During a discussion with @schulzm, @wrwilliams, and myself we could not quite settle on whether |
I'll assume this is MPI 4.1 for now and we can move it later if necessary. |
Tools WG, Oct 21, 2021: Next to the Tools community these functions are also useful for layered libraries that need to query the status of a request without destroying it. |
As I attempt to write up a PR for this, it occurs to me that the
Obviously such an example can only work if So, two questions:
|
I would say no. We already have MPI_Testall that makes progress and provides information on request state, and that is how examples like this are typically written. If Request_get_status does guarantee progress, what routine should I use for a lighter weight access to the status in a request? |
If request_get_status_all does not make progress, the MPI_Testall function in the issue is not correct, as it does not make progress. |
The problem with MPI_Testall here is that after a successful test, we are guaranteed that each element of
I fear this is the crux of the issue: we seem to want the get_status interface(s) to serve two purposes simultaneously, namely that they are lightweight and nondestructive. From the tools side we focused on the nondestructive aspect of this but both are important. Let's consider not Waitall, but Waitany--for Waitall, we at least have the band-aid available of knowing that all passed-in requests will be freed and have their statuses set, and there's therefore no waste in copying everything. For Waitany (and Waitsome), we still have to look up and copy the tool/layer data associated with all requests before calling PMPI_Waitany (or indeed PMPI_Testany if we want to write our own internal loop). This does however show me that our conception within the Tools WG that these three families of functions (Wait/Test/get_status) are simply three layers of a reasonable implementation is probably flawed. Conceptually is a "non-destructive Test" a better fit for what we want than a "progressing get_status"? I would have nothing against naming these as modified Test functions if so. @jprotze since we cross-posted: aren't we covered by the fact that we call |
The idea of all the examples is to call MPI_Test* only on success with the requests completed according to the get_status function to finally release these requests. So, no this function does not help to make progress on non-completed requests. |
...right. It has been a little while since we wrote those examples. And if the function is going to make progress it has to do so on all possible execution paths, doesn't it? |
The problem here is that MPI does not make progress explicit. If it did, tools would have control over triggering progress and performing a non-destructive non-progressing test. I agree with @wgropp that adding progress to I wonder whether you could simply chop up the input array and test/wait on the chunks. That way you don't need to allocate temporary heap memory to hold copies and don't have to query the tool information before you know whether a request actually completes. Copying requests should be fairly cheap and having 16 of them (or maybe more) on the stack should be no issue. MPI_Test is simple: int MPI_Test(MPI_Request* req, int* flag, MPI_Status* status){
MPI_Request tmp = *req;
PMPI_Test(&req, flag, status);
if (*flag) {
// do your thing with tmp
}
return ret;
} int MPI_Testsome(int incount, MPI_Request req[], int* outcount, int* indices, MPI_Status* statuses[]){
MPI_Request tmp_req[16];
int tmp_idx[16];
*outcount = 0;
for (int i = 0; i < incount; i+=16) {
int tmp_outcount;
int tmp_incount = min(16, incount - i);
memcpy(tmp_req, &req[i], tmp_incount);
ret = PMPI_Testsome(tmp_incount, &req[i], &tmp_outcount, tmp_idx, &statuses[*outcount]);
if (tmp_outcount) {
// do your thing, handle the index array
*outcount += tmp_outcount;
// you may break out of the loop here and still be correct...
}
}
return ret;
}
I'd be curious what the overhead of this scheme is. My guess is that it is negligible compared to the rest of the overhead tools typically bring to the table (no offense :)). |
Summary from forum meeting 2FEB2022:
There were no objections to adding the multiple request_get_status function family, provided that we properly clarify request_get_status first and mirror its language. We also need to take care that the request_get_status_* behavior is properly specified for generalized requests. |
I’m going to propose moving this to MPI 5.0. There’s more discussion to be had here. If someone objects and thinks we’ll be ready to read this soon, leave a comment and we can discuss bringing it back into MPI 4.1. |
PDF: |
Had no-no reading on 2023-05-02. |
This passed a no-no vote.
|
This passed a 1st vote.
|
This passed a 2nd vote.
|
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 toMPI_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 theMPI_(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 inMPI_Test
:Here are example of the new proposed calls could be used:
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.
References and Pull Requests
The text was updated successfully, but these errors were encountered: