|
Quantum Resource Management Interface (QRMI) C API
|
Functions | |
| QrmiReturnCode | qrmi_service_resources (QrmiQuantumResources *resources_out) |
| QrmiReturnCode | qrmi_service_resources_free (QrmiQuantumResources *resources) |
Functions used to discover the QPU resources assigned to the current job from the QRMI C API.
| QrmiReturnCode qrmi_service_resources | ( | QrmiQuantumResources * | resources_out | ) |
Discovers the QPU resources assigned to the current job – read from the QRMI_JOB_QPU_RESOURCES / QRMI_JOB_QPU_TYPES environment variables, or their legacy SLURM_JOB_QPU_RESOURCES / SLURM_JOB_QPU_TYPES equivalents – and returns the ones that are currently accessible.
This is the C counterpart of qrmi.QRMIService (Python) and qrmi::QRMIService (Rust); all three share the same underlying discovery/filtering logic.
Unlike qrmi_provider_resources(), which is called against a persistent QrmiResourceProvider handle (and can be called repeatedly, e.g. with different filters), this function takes no arguments and is a one-shot operation: there is no separate "service" handle to create or free. Discovery happens inline, and each QrmiQuantumResource handle placed in resources_out is independently owned by the caller from that point on – usable with the same qrmi_resource_*() functions as a handle returned by qrmi_resource_new(), just not individually freed (see qrmi_service_resources_free() below).
The caller is responsible for freeing the returned struct with qrmi_service_resources_free(). Individual handles inside the struct must NOT be freed separately.
| (resources_out) | [out] Pointer to a QrmiQuantumResources struct to populate |
| QrmiReturnCode qrmi_service_resources_free | ( | QrmiQuantumResources * | resources | ) |
Frees a QrmiQuantumResources struct populated by qrmi_service_resources().
This frees both the individual QrmiQuantumResource handles and the internal array. After calling this, the struct's fields are zeroed. Do NOT call qrmi_resource_free() on individual elements after calling this.
| (resources) | [in] Pointer to a QrmiQuantumResources struct to free |