|
16 | 16 |
|
17 | 17 | #include <mpi.h>
|
18 | 18 |
|
| 19 | +/** |
| 20 | + * Mark the continuation request(s) as volatile. |
| 21 | + * Generally, the request buffer should remain accessible until the continuation is invoked |
| 22 | + * and will be set to MPI_REQUEST_NULL before the continuation is invoked. |
| 23 | + * However, if this flag is specified the requests are not accessed after the call to |
| 24 | + * MPI_Continue[all] returns. |
| 25 | + */ |
19 | 26 | #define MPIX_CONT_REQBUF_VOLATILE 1<<0
|
20 |
| -/* the continuation is persistent (only valid with persistent requests) */ |
21 |
| -#define MPIX_CONT_PERSISTENT 1<<1 |
22 |
| -#define MPIX_CONT_POLL_ONLY 1<<2 |
23 | 27 |
|
24 |
| -typedef int (MPIX_Continue_cb_function)(int rc, void *user_data); |
25 |
| -OMPI_DECLSPEC int MPIX_Continue_init(int max_poll, int flags, MPI_Request *cont_req, MPI_Info info); |
| 28 | +/** |
| 29 | + * the continuation is persistent (only valid with persistent requests) |
| 30 | + * TODO: not implemented yet |
| 31 | + */ |
| 32 | +#define MPIX_CONT_PERSISTENT 1<<1 |
| 33 | + |
| 34 | +/* |
| 35 | + * mark the continuation request as poll-only, i.e., only execute continuations |
| 36 | + * when testing/waiting for the continuation request to complete |
| 37 | + */ |
| 38 | +#define MPIX_CONT_POLL_ONLY 1<<2 |
| 39 | + |
| 40 | +/* Wwhether the execution of continuations is deferred in MPI_Continue or |
| 41 | + * MPI_Continueall if all operations are complete. |
| 42 | + * By default, continuations eligible for execution are invoked immediately. */ |
| 43 | +#define MPIX_CONT_DEFER_COMPLETE 1<<3 |
| 44 | + |
| 45 | +/* whether failed continuations will be invoked and passed the error code |
| 46 | + * TODO: not implemented yet |
| 47 | + */ |
| 48 | +#define MPIX_CONT_INVOKE_FAILED 1<<4 |
| 49 | + |
| 50 | +/** |
| 51 | + * Completion callback signature: |
| 52 | + * \param rc an error code (MPI_SUCCESS, unless MPIX_CONT_INVOKE_FAILED is provided) |
| 53 | + * \param cb_data the pointer passed as cb_data to MPI_Continue[all] |
| 54 | + * \returns MPI_SUCECSS on success, an error code to mark the continuation as failed |
| 55 | + */ |
| 56 | +typedef int (MPIX_Continue_cb_function)(int rc, void *cb_data); |
| 57 | + |
| 58 | +/** |
| 59 | + * Initialize a continuation request. |
| 60 | + * \param flags 0 or \ref MPIX_CONT_POLL_ONLY |
| 61 | + * \param max_poll the maximum number of continuations to execute when testing |
| 62 | + * the continuation request for completion or MPI_UNDEFINED for |
| 63 | + * unlimited execution of eligible continuations |
| 64 | + * \param info info object used to further control the behavior of the continuation request. |
| 65 | + * Currently supported: |
| 66 | + * - mpi_continue_thread: either "all" (any thread in the process may execute callbacks) |
| 67 | + * or "application" (only application threads may execute callbacks; default) |
| 68 | + * - mpi_continue_async_signal_safe: whether the callbacks may be executed from within a signal handler |
| 69 | + * \param[out] cont_req the newly created continuation request |
| 70 | + */ |
| 71 | +OMPI_DECLSPEC int MPIX_Continue_init(int flags, int max_poll, MPI_Info info, MPI_Request *cont_req); |
| 72 | + |
| 73 | +/** |
| 74 | + * Attach a new continuation to the operation represented by \c request and register it with the continuation request \c cont_req. |
| 75 | + * The callback will be executed once the operation has completed and will be passed the \c cb_data pointer. |
| 76 | + * |
| 77 | + * \param request the request representing the the operation to attach a continuation to |
| 78 | + * \param cb the callback to invoke upon completion, with signature \ref MPIX_Continue_cb_function |
| 79 | + * \param cb_data the user-data to pass to the callback |
| 80 | + * \param flags 0 or OR-combination of \ref MPIX_CONT_REQBUF_VOLATILE, \ref MPIX_CONT_PERSISTENT, |
| 81 | + * \ref MPIX_CONT_DEFER_COMPLETE, \ref MPIX_CONT_INVOKE_FAILED |
| 82 | + * \param status MPI_STATUS_IGNORE or a pointer to a status object that will be a filled before the callback is invoked |
| 83 | + * \param cont_req a continuation request created through \ref MPIX_Continue_init |
| 84 | + */ |
26 | 85 | OMPI_DECLSPEC int MPIX_Continue(MPI_Request *request, MPIX_Continue_cb_function *cb, void *cb_data,
|
27 | 86 | int flags, MPI_Status *status, MPI_Request cont_req);
|
28 |
| -OMPI_DECLSPEC int MPIX_Continueall(int count, MPI_Request request[], MPIX_Continue_cb_function *cb, void *cb_data, |
| 87 | + |
| 88 | +/** |
| 89 | + * Attach a new continuation to the operations represented by the \c count \c requests and |
| 90 | + * register it with the continuation request \c cont_req. |
| 91 | + * The callback will be executed once the operations have completed and will be passed the \c cb_data pointer. |
| 92 | + * |
| 93 | + * \param count the number of requests in \c requests |
| 94 | + * \param requests the requests representing the the operations to attach a continuation to |
| 95 | + * \param cb the callback to invoke upon completion of all operations, with signature \ref MPIX_Continue_cb_function |
| 96 | + * \param cb_data the user-data to pass to the callback |
| 97 | + * \param flags 0 or OR-combination of \ref MPIX_CONT_REQBUF_VOLATILE, \ref MPIX_CONT_PERSISTENT, |
| 98 | + * \ref MPIX_CONT_DEFER_COMPLETE, \ref MPIX_CONT_INVOKE_FAILED |
| 99 | + * \param status MPI_STATUS_IGNORE or a pointer to a status object that will be a filled before the callback is invoked |
| 100 | + * \param cont_req a continuation request created through \ref MPIX_Continue_init |
| 101 | + */ |
| 102 | +OMPI_DECLSPEC int MPIX_Continueall(int count, MPI_Request requests[], MPIX_Continue_cb_function *cb, void *cb_data, |
29 | 103 | int flags, MPI_Status status[], MPI_Request cont_req);
|
30 |
| -OMPI_DECLSPEC int MPIX_Continue_get_failed( MPI_Request cont_req, int *count, void **cb_data); |
| 104 | + |
| 105 | +/** |
| 106 | + * Query the callback data for failed continuations, i.e., continuations that returned a value other than |
| 107 | + * MPI_SUCCESS or whose operations experienced an error. |
| 108 | + * The applications passes in \c cb_data an array of size \c count. Upon return, \c count will be set |
| 109 | + * to the actual number of elements stored in \c cb_data. If the resulting \c count equals \c count |
| 110 | + * on input there may be more failed continuations to query and the call should be repeated. |
| 111 | + * \note Handling of failed continuations requires an error handler for the involved operations that does not abort and |
| 112 | + * is not supported if \ref MPIX_CONT_REQBUF_VOLATILE is used. |
| 113 | + * |
| 114 | + * \param cont_req The continuation request from which to query failed continuations |
| 115 | + * \param[inout] count The maximum number of elements to be stored in \c cb_data |
| 116 | + * \param cb_data Buffer of size \c count elements to store the callback data of failed continuations into |
| 117 | + */ |
| 118 | +OMPI_DECLSPEC int MPIX_Continue_get_failed(MPI_Request cont_req, int *count, void **cb_data); |
31 | 119 |
|
32 | 120 | #endif // MPIEXT_CONTINUE_C_H
|
0 commit comments