Skip to content

spank_qrmi: set QRMI_QPU for srun too - #212

Merged
ohtanim merged 1 commit into
mainfrom
aw/qrmi-qpu-srun
Oct 21, 2026
Merged

ohtanim merged 1 commit into
mainfrom
aw/qrmi-qpu-srun

Conversation

@awennersteen

Copy link
Copy Markdown
Collaborator

Description of Change

Follow-up to #211. QRMI_QPU is only set in S_CTX_ALLOCATOR (sbatch, salloc). srun runs SPANK plugins in S_CTX_LOCAL, so a job submitted with srun --qpu=... reaches slurmctld without QRMI_QPU, and a job_submit plugin cannot see its QPU. This sets it in both contexts.

Evidence (Slurm 25.05.3)

Testing

On a Slurm 25.05.3 cluster, slurmctld at debug3 (which logs spank_job_env per submission), each command run with --qpu=PASQAL_LOCAL:

Command main (#211) this PR
srun spank_job_env="_SLURM_SPANK_OPTION_spank_qrmi_qpu=PASQAL_LOCAL" ..., QRMI_QPU=PASQAL_LOCAL
salloc ..., QRMI_QPU=PASQAL_LOCAL ..., QRMI_QPU=PASQAL_LOCAL
sbatch ..., QRMI_QPU=PASQAL_LOCAL ..., QRMI_QPU=PASQAL_LOCAL

In srun inside an existing allocation the call only updates the step's spank_job_env; the job runs as before.

Note for job_submit.lua

Lua sees job_desc.spank_job_env as a table with 0-based keys (job_submit_lua.c#L723-L737), so the ipairs loop in the #211 description skips the first entry. Use pairs:

for _, kv in pairs(job_desc.spank_job_env or {}) do
    local qpu = kv:match("^QRMI_QPU=(.*)$")
end

srun runs SPANK plugins in S_CTX_LOCAL, so a job submitted with
'srun --qpu=...' reached slurmctld without QRMI_QPU in its
spank_job_env. spank_job_control_setenv() accepts the local context
(spank(8) documents it as local only), and srun's allocation request
carries spank_job_env like sbatch and salloc do.

@ohtanim ohtanim left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. thanks

@ohtanim
ohtanim merged commit 3455388 into main Oct 21, 2026
1 check passed
@ohtanim
ohtanim deleted the aw/qrmi-qpu-srun branch October 21, 2026 08:16
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