From 28eef52dc36fa1f311dc803e8e9240f282208cee Mon Sep 17 00:00:00 2001 From: Aleksander Wennersteen Date: Mon, 8 Jun 2026 18:19:25 +0200 Subject: [PATCH] Add QRMI_JOB_QPU_ env var backwards compatible --- docs/ux.md | 2 +- plugins/spank_qrmi/README.md | 6 ++++-- plugins/spank_qrmi/spank_qrmi.c | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/ux.md b/docs/ux.md index 24a5f51..55e8f98 100644 --- a/docs/ux.md +++ b/docs/ux.md @@ -87,7 +87,7 @@ srun ... HPC applications use the Slurm QPU resources assigned to the Slurm job. -Environment variables provide more details for use by the appliction, e.g. `SLURM_JOB_QPU_RESOURCES` listing the quantum resource names (comma separated if there are several provided). +Environment variables provide more details for use by the appliction, e.g. `QRMI_JOB_QPU_RESOURCES` listing the quantum resource names (comma separated if there are several provided). `SLURM_JOB_QPU_RESOURCES` is still exported as a legacy alias. These variables will be used by QRMI. See the README files in the various QRMI flavor directories ([ibm](https://github.com/qiskit-community/qrmi/blob/main/examples/qiskit_primitives/ibm/README.md), [pasqal](https://github.com/qiskit-community/qrmi/blob/main/examples/qiskit_primitives/pasqal/README.md)) for details. diff --git a/plugins/spank_qrmi/README.md b/plugins/spank_qrmi/README.md index d2ec001..29e2464 100644 --- a/plugins/spank_qrmi/README.md +++ b/plugins/spank_qrmi/README.md @@ -208,8 +208,10 @@ This plugin also set the following 2 environment variables which will be referre | environment varilables | descriptions | | ---- | ---- | -| SLURM_JOB_QPU_RESOURCES | Comma separated list of QPU resources to use at runtime. Undocumented resources will be filtered out. For example, `qpu1,qpu2`. | -| SLURM_JOB_QPU_TYPES | Comma separated list of Resource type (`ibm-quantum-system`, `qiskit-runtime-service` and `pasqal-cloud`). For example, `ibm-quantum-system,ibm-quantum-system` | +| QRMI_JOB_QPU_RESOURCES | Comma separated list of QPU resources to use at runtime. Undocumented resources will be filtered out. For example, `qpu1,qpu2`. | +| QRMI_JOB_QPU_TYPES | Comma separated list of Resource type (`ibm-quantum-system`, `qiskit-runtime-service` and `pasqal-cloud`). For example, `ibm-quantum-system,ibm-quantum-system` | +| SLURM_JOB_QPU_RESOURCES | Legacy alias for `QRMI_JOB_QPU_RESOURCES`. | +| SLURM_JOB_QPU_TYPES | Legacy alias for `QRMI_JOB_QPU_TYPES`. | > [!IMPORTANT] > The IBM Direct Access API has been renamed to the IBM Quantum System API. diff --git a/plugins/spank_qrmi/spank_qrmi.c b/plugins/spank_qrmi/spank_qrmi.c index 7ba47ec..b1ea19e 100644 --- a/plugins/spank_qrmi/spank_qrmi.c +++ b/plugins/spank_qrmi/spank_qrmi.c @@ -218,6 +218,8 @@ int slurm_spank_init_post_opt(spank_t spank_ctxt, int argc, char **argv) { spank_setenv(spank_ctxt, "QRMI_JOB_ID", id_str, OVERWRITE); setenv("QRMI_JOB_ID", id_str, 1); + spank_setenv(spank_ctxt, "QRMI_JOB_QPU_RESOURCES", "", OVERWRITE); + spank_setenv(spank_ctxt, "QRMI_JOB_QPU_TYPES", "", OVERWRITE); spank_setenv(spank_ctxt, "SLURM_JOB_QPU_RESOURCES", "", OVERWRITE); spank_setenv(spank_ctxt, "SLURM_JOB_QPU_TYPES", "", OVERWRITE); @@ -383,6 +385,11 @@ int slurm_spank_init_post_opt(spank_t spank_ctxt, int argc, char **argv) { } slurm_list_iterator_destroy(sessions_iter); + spank_setenv(spank_ctxt, "QRMI_JOB_QPU_RESOURCES", qpu_resources_envvar.buffer, OVERWRITE); + slurm_debug("%s: setenv(%s, %s)", plugin_name, "QRMI_JOB_QPU_RESOURCES", + qpu_resources_envvar.buffer); + spank_setenv(spank_ctxt, "QRMI_JOB_QPU_TYPES", qpu_types_envvar.buffer, OVERWRITE); + slurm_debug("%s: setenv(%s, %s)", plugin_name, "QRMI_JOB_QPU_TYPES", qpu_types_envvar.buffer); spank_setenv(spank_ctxt, "SLURM_JOB_QPU_RESOURCES", qpu_resources_envvar.buffer, OVERWRITE); slurm_debug("%s: setenv(%s, %s)", plugin_name, "SLURM_JOB_QPU_RESOURCES", qpu_resources_envvar.buffer);