Module mpi::request

source ·
Expand description

Request objects for non-blocking operations

Non-blocking operations such as immediate_send() return request objects that borrow any buffers involved in the operation so as to ensure proper access restrictions. In order to release the borrowed buffers from the request objects, a completion operation such as wait() or test() must be used on the request object.

Note: If the Request is dropped (as opposed to calling wait or test explicitly), the program will panic.

To enforce this rule, every request object must be registered to some pre-existing Scope. At the end of a Scope, all its remaining requests will be waited for until completion. Scopes can be created using either scope or StaticScope.

To handle request completion in an RAII style, a request can be wrapped in either WaitGuard or CancelGuard, which will follow the respective policy for completing the operation. When the guard is dropped, the request will be automatically unregistered from its Scope.

Unfinished features

  • 3.7: Nonblocking mode:
    • Completion, MPI_Waitall(), MPI_Waitsome(), MPI_Testany(), MPI_Testall(), MPI_Testsome(), MPI_Request_get_status()
  • 3.8:
    • Cancellation, MPI_Test_cancelled()

Structs

  • Guard object that tries to cancel and waits for the completion of an operation when it is dropped
  • A temporary scope that lasts no more than the lifetime 'a
  • A request object for a non-blocking operation registered with a Scope of lifetime 'a
  • Request collection for managing multiple requests at the same time.
  • The scope that lasts as long as the entire execution of the program
  • Guard object that waits for the completion of an operation when it is dropped

Traits

Functions

  • Create a scope for handling multiple request completion (such as wait_any(), test_any(), test_some(), etc.). This takes a reserve amount indicating the estimated amount of requests and a closure which will be called and passed a (scope, RequestCollection).
  • Used to create a LocalScope
  • Wait for the completion of one of the requests in the vector, returns the index of the request completed and the status of the request.