Skip to content

examples/slurm: wait for the DVM to resize, and make cancel usable - #2642

Merged
rhc54 merged 2 commits into
openpmix:masterfrom
Petter-Programs:examples-elastic-coord-two-phase
Aug 11, 2026
Merged

examples/slurm: wait for the DVM to resize, and make cancel usable#2642
rhc54 merged 2 commits into
openpmix:masterfrom
Petter-Programs:examples-elastic-coord-two-phase

Conversation

@Petter-Programs

Copy link
Copy Markdown
Contributor

Problem

examples/slurm/elastic-coordination.c treated the PMIx allocation callback as
the final answer to a size change. A Slurm extend now answers in two phases, so
the example reported success while the nodes it had just been granted could not
yet carry work. It also had no way to withdraw a pending request, and kept an
allocation request's wait object on the caller's stack.

Changes

examples/slurm: keep an allocation request's wait object alive

A timeout does not withdraw the request: PMIx still runs the callback whenever
the scheduler answers, by which time the submitting call may have returned and
taken its stack frame with it. The wait object is reference counted now.
Pre-existing bug, so it lands separately.

examples/slurm: wait for the DVM to resize, and make cancel usable

  • Registers for PMIX_DVM_IS_READY / PMIX_ERR_DVM_MOD, correlating by
    PMIX_ALLOC_REQ_ID and claiming the slot before submitting — nothing orders
    the event after the phase-one callback.
  • Watches each request on its own thread so the prompt returns at once. This is
    what makes cancel reachable: ras/slurm drops a request's cancellable
    record when the scheduler grants, and phase one does not answer until then,
    so waiting inline held the prompt for exactly as long as the request could
    still be withdrawn.
  • Adds cancel [REQUEST_NAME] and pending, and extend count N as REQUEST_NAME
    so the name is short enough to type inside that window.
    Generated names count requests in the session (extend-1, shrink-2).
  • Only an extend is cancellable, so only an extend takes a name; a cancel
    naming anything else is refused locally rather than sent to return
    PMIX_ERR_NOT_FOUND, which is indistinguishable from a typo.
  • Verifies an extend against the allocation its completion event names rather
    than the DVM total, which is a snapshot any concurrent request invalidates.
  • Refuses to start outside a Slurm job, or when PRRTE does not already know
    that job's allocation.
  • Serializes output behind a lock, and silences the verify polls.

A timeout does not withdraw the request: PMIx keeps the cbdata pointer and
still runs the callback whenever the scheduler answers, by which time the
submitting call may have returned and taken its stack frame with it.
Reference count the wait object so the last one out frees it.

Credits: AccelCom @ Barcelona Supercomputing Center

Signed-off-by: Petter Sandås <petter.sandas@bsc.es>
A Slurm extend is answered twice now: once when the scheduler grants, and
again when the DVM has finished resizing. This example took the first answer
as the last word, so it reported success while the nodes it had been granted
could not yet carry work. Register for PMIX_DVM_IS_READY and
PMIX_ERR_DVM_MOD and correlate them with the request by PMIX_ALLOC_REQ_ID.

Add a cancel command, and watch each request on its own thread so the prompt
returns as soon as it is submitted. ras/slurm drops a request's cancellable
record the moment the scheduler grants, and phase one does not answer until
then, so waiting inline held the prompt for exactly as long as the request
could still be withdrawn. Only an extend is cancellable, so only an extend
takes a name.

Verify an extend against the allocation its completion event names rather
than against the DVM total, which is a snapshot taken before submitting that
any concurrent request invalidates.

Credits: AccelCom @ Barcelona Supercomputing Center

Signed-off-by: Petter Sandås <petter.sandas@bsc.es>
@rhc54
rhc54 merged commit 4be0f24 into openpmix:master Aug 11, 2026
17 checks passed
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