ENH: MPI_Waitany / MPI_Waitsome interface for internal list of requests
- checks requests from completion, returning true when some requests have completed and false when there are no active requests. This allows it to be used in a polling loop to progress MPI and then respond when as requests become satisfied. When using as part of a dispatch loop, waitSomeRequests() is probably more efficient than calling waitAnyRequest() and can help avoid biasing which client requests are serviced. Takes an optional return parameter, to retrieve the indices, but more importantly to avoid inner-loop reallocations. Example, DynamicList<int> indices; while (UPstream::waitSomeRequests(startRequest, &indices)) { // Dispatch something .... } // Reset list of outstanding requests with 'Waitall' for safety UPstream::waitRequests(startRequest); --- If only dealing with single items and an index is required for dispatching, it can be better to use a list of UPstream::Request instead. Example, List<UPstream::Request> requests = ...; label index = -1; while ((index = UPstream::waitAnyRequest(requests)) >= 0) { // Do something at index } ENH: pair-wise wrappers for MPI_Test or MPI_Wait - for send/recv pairs of requests, can bundle both together and use a single MPI_Testsome and MPI_Waitall instead of two individual calls.
Showing
- src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H 50 additions, 2 deletionssrc/OpenFOAM/db/IOstreams/Pstreams/UPstream.H
- src/Pstream/dummy/UPstreamRequest.C 31 additions, 0 deletionssrc/Pstream/dummy/UPstreamRequest.C
- src/Pstream/mpi/UPstreamRequest.C 341 additions, 3 deletionssrc/Pstream/mpi/UPstreamRequest.C
Please register or sign in to comment