Skip to content
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

Fix issue with circular dependency in request.h #1

Open
wants to merge 20 commits into
base: mpi-continue-master
Choose a base branch
from

Conversation

cniethammer
Copy link

Some static functions in request.h make use of continuation routines if continuations are enabled. This causes problems with the circular include dependency of both. To overcome this problem include request.h here without enabling features of the continuation extension.

Note: This solution must be rethought if one wants to use the affected static functions from request.h in continuation.h itself.

Signed-off-by: Christoph Niethammer niethammer@hlrs.de

devreal and others added 20 commits November 2, 2021 11:14
Continuations provide a mechanism for attaching callbacks to outstanding
operation requests. A call to MPIX_Continue takes a request, a
function pointer, a user-provided data pointer, and a status object (or
`MPI_STATUS_IGNORE`), along with a continution request:

```
MPI_Request req;
// status object has to remain valid until the callback is invoked
MPI_Status *status = malloc(sizeof(MPI_Status));
char *buf = ...;
MPI_Irecv(buf, ..., MPI_ANY_SOURCE, ... &req);
MPIX_Continue(&req, &complete_cb, buf, status, cont_req);
assert(req == MPI_REQUEST_NULL);
```

The ownership of non-persistent requests is returned to MPI and the pointer
to the request will be set to `MPI_REQUEST_NULL`. The callback is passed
the status pointer and the user-provided data pointer:

```
void complete_cb(MPI_Status *status, void *user_data) {
  printf("Send completed\n");
  char *buf = (char*)user_data;
  process_msg(buf, status->MPI_SOURCE);
  free(buf); // free the send buffer
  free(status);    // free the status
}
```

The status has to remain valid until the invocation of the callback
and is set according to the operation before the callback is invoked.

The continuation is *registered* with the provided contination
request. The continuation request is a request allocated with `MPIX_Continue_init`:

```
MPIX_Continue_init(info, &cont_req);
```

Continuation requests may be used to test/wait for completion of all
continuations registered with cont_req using `MPI_Test/Wait`. Supported
info keys are:

- "mpi_continue_poll_only": only execute continuations when MPI_Test/Wait is
  called on the continuation request (default: false)
- "mpi_continue_enqueue_complete": if true, the continuation is executed
  immediately if the operations are already complete when MPIX_Continue is
  called. Execution is deferred otherwise (default: false)
- "mpi_continue_max_poll": the maximum number of continuations to execute
  when calling MPI_Test on the continuation request (default: -1, meaning unlimited)

A continuation may in turn be attached to a continuation request, in which
case the continuation request will be executed once all continuations
registered with the continuation request have completed.

In addition to MPIX_Continue, the proposal also includes MPIX_Continueall
which attaches a continuation to a set of requests such that the
continuation is executed once all operations have completed.

The implementation reflects the current state of the proposal and may
change at any time, following discussions in the MPI Forum. The goal
of this Open MPI extension is to provide a working implementation to
the community to experiment with this API.

Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: George Bosilca <bosilca@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
…active

Continuation requests are persistent requests that are always active.
They are implicitly restarted when the first continuation is registered.

Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
…lete at registration

Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
…/waiting on them

Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
…he sync

Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
…ns while waiting

No other threads should execute them if the continuation request is limited
to polling only.

Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
…quests

Signed-off-by: Joseph Schuchart <schuchart@icl.utk.edu>
Some static functions in request.h make use of continuation routines if
continuations are enabled. This causes problems with the circular include
dependency of both. To overcome this problem include request.h here
without enabling features of the continuation extension.

Note: This solution must be rethought if one wants to use the affected
static functions from request.h in continuation.h itself.

Signed-off-by: Christoph Niethammer <niethammer@hlrs.de>
@devreal devreal force-pushed the mpi-continue-master branch from 03c36a5 to e2979db Compare November 22, 2022 15:04
@devreal devreal force-pushed the mpi-continue-master branch from a02d677 to b6440c0 Compare April 2, 2024 19:44
@devreal devreal force-pushed the mpi-continue-master branch from 31f7b91 to fcd2d9b Compare May 3, 2024 22:58
@devreal devreal force-pushed the mpi-continue-master branch from fcd2d9b to 790a7b6 Compare June 11, 2024 14:42
@devreal devreal force-pushed the mpi-continue-master branch from 790a7b6 to 68b887c Compare July 18, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants