Skip to main content

Quantum Resource Management Interface(QRMI)

Project description

QRMI: Quantum Resource Management Interface

[!IMPORTANT] New Deprecations(Since 0.13.0)

The IBM Direct Access API has been renamed to the IBM Quantum System API.

As part of this change, the resource names and the prefixes of environment variables used by QRMI have been updated accordingly.

Items Deprecated names New names
Resource type text direct-access ibm-quantum-system
Resource type(C) QRMI_RESOURCE_TYPE_IBM_DIRECT_ACCESS QRMI_RESOURCE_TYPE_IBM_QUANTUM_SYSTEM
Resource type(Python) ResourceType.IBMDirectAccess ResourceType.IBMQuantumSystem
Resource type(Rust) ResourceType::IBMDirectAccess ResourceType::IBMQuantumSystem
QuantumResource trait implementator(Rust) qrmi::ibm::IBMDirectAccess qrmi::ibm::IBMQuantumSystem
Environment variable prefixes QRMI_IBM_DA_ QRMI_IBM_QS_

A transition period will be in effect until July 2, 2026. During this period, both the legacy and the new resource names and environment variable prefixes are supported to ensure backward compatibility. After the transition period ends, support for the legacy names will be removed, and users are expected to migrate fully to the new naming scheme.

This is repository with Quantum Resource Management Interface (QRMI) implementation.

QRMI ⚛️ is a vendor agnostic library to control state, run tasks and monitor behavior of quantum computational resources (qubits, QPUs, entire quantum systems, etc.).

QRMI acts like a thin middleware layer that abstracts away complexities of controling quantum resources by exposing set of simple APIs to acquire/release hardware, run tasks and monitor state of quantum resources.

QRMI is written in Rust 🦀 with Python 🐍 and C ©️ APIs exposed for ease of integration to pretty much any computational envrionment.

📒 Contents


Examples

All full examples are available in examples folder.

C

This example demonstrates QRMI using the Quantum System API for IBM Quantum machines.

#include "qrmi.h"

int main(int argc, char *argv[]) {
    ...

    QrmiQuantumResource *qrmi = qrmi_resource_new(argv[1], QRMI_RESOURCE_TYPE_IBM_QUANTUM_SYSTEM);
    ...

    QrmiReturnCode rc = qrmi_resource_metadata(qrmi, &metadata);
    ...

    QrmiResourceMetadata *metadata = NULL;
    rc = qrmi_resource_acquire(qrmi, &acquisition_token);
    ...

    QrmiPayload payload;
    payload.tag = QRMI_PAYLOAD_QISKIT_PRIMITIVE;
    payload.QISKIT_PRIMITIVE.input = (char *)input;
    payload.QISKIT_PRIMITIVE.program_id = argv[3];
    ...

    char *job_id = NULL;
    rc = qrmi_resource_task_start(qrmi, &payload, &job_id);
    ...

    QrmiTaskStatus status;
    rc = qrmi_resource_task_status(qrmi, job_id, &status);
    ...

    qrmi_resource_task_stop(qrmi, job_id);
    qrmi_string_free(job_id);
    qrmi_resource_free(qrmi);

    return EXIT_SUCCESS;

error:
    qrmi_resource_free(qrmi);
    return EXIT_FAILURE;
}

Full example is available here.

See example of QRMI C working with IBM Qiskit Runtime Service or Pasqal Cloud.

All examples for QRMI C are available in this folder.

Python

This example demonstrates QRMI using the Quantum System API for IBM Quantum machines.

from qrmi import QuantumResource, ResourceType, Payload, TaskStatus

# create resource handler
qrmi = QuantumResource("ibm_rensselaer", ResourceType.IBMQuantumSystem)

# acquire resource
lock = qrmi.acquire()

# run task
payload = Payload.QiskitPrimitive(input=primitive_input, program_id=args.program_id)
job_id = qrmi.task_start(payload)

print(qrmi.task_result(job_id).value)

qrmi.task_stop(job_id)

# release resource
qrmi.release(lock)

Full example is available here.

Python QRMI can be used to implement Qiskit primitives (Sampler and Estimator). See example of Qiskit primitives here for IBM backends or for Pasqal machines.

See example of QRMI working with Pasqal Pulser.

Pasqal Cloud Examples

QRMI Pasqal Cloud supports both Qiskit, Pulser and CUDA-Q analog programs.

See the Pasqal Cloud examples in this repository:

Rust

This example demonstrates QRMI using the Quantum System API for IBM Quantum machines.

use qrmi::{ibm::IBMQuantumSystem, models::Payload, models::TaskStatus, QuantumResource};
...

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    ...
    let mut qrmi = IBMQuantumSystem::new(&args.backend);

    let lock = qrmi.acquire().await?;
    ...

    let target = qrmi.target().await;
    ...

    let payload = Payload::QiskitPrimitive {
        input: contents,
        program_id: args.program_id,
    };

    let job_id = qrmi.task_start(payload).await?;
    println!("Job ID: {}", job_id);
    let one_sec = time::Duration::from_millis(1000);
    loop {
        let status = qrmi.task_status(&job_id).await?;
        println!("{:?}", status);
        if matches!(status, TaskStatus::Completed) {
            println!("{}", qrmi.task_result(&job_id).await?.value);
            break;
        } else if matches!(status, TaskStatus::Failed | TaskStatus::Cancelled) {
            break;
        }
        thread::sleep(one_sec);
    }
    let _ = qrmi.task_stop(&job_id).await;

    let _ = qrmi.release(&lock).await;
    Ok(())
}

Full example is available here.

See example of QRMI Rust working with IBM Qiskit Runtime Service or Pasqal Cloud.

All examples for QRMI C are available in this folder.

QRMI usage in Slurm plugin for quantum resources

One of example of usage of QRMI in compute infrastrcture project is Slurm plugin for quantum resources. QRMI is used in Slurm plugin to control quantum resources during lifetime of Slurm job.

See implementation and documentation of Slurm plugin for quantum resources here.


Pre-commit detect-secrets

detect-secrets is an open-source, developer-friendly tool designed to scan codebases for mistakenly committed secrets—such as API keys, passwords, and private tokens—before they leak. To keep our credentials secure, we recommend that all developers integrate this into their workflow using the following instructions.

  • Prerequisites: Before you begin, ensure you have a Python virtual environment (venv) active. You will need to install pre-commit, which manages the hooks that run detect-secrets automatically.
pip install pre-commit
pre-commit install

Please find .pre-commit-config.yaml for the initial setup.
Following command was used to generate .secrets.baseline and to maximize the detection coverage.

detect-secrets scan --force-use-all-plugins > .secrets.baseline

Handling False Positives
If the pre-commit hook identifies a secret that you have verified is not sensitive (a false positive), please use the following command to audit and update the baseline file. Once updated, include the modified .secrets.baseline in your Pull Request to ensure the pre-commit passes in the future.

pip install detect-secrets
detect-secrets scan --baseline .secrets.baseline
detect-secrets audit .secrets.baseline

Manual Execution and Overrides
To manually trigger a scan of all files in the repository for a local sanity check, execute the following command:

pre-commit run --all-files

Bypassing the Hook (Not Recommended)
While not recommended, if you must force a commit without running the pre-commit checks (e.g., during an emergency fix), you may use the --no-verify flag:

git commit -m "Your message" --no-verify

How to Give Feedback

We encourage your feedback! You can share your thoughts with us by:


How to Cite This Work

If you use the “Quantum Spank plugin” or "QRMI" in your research or projects, please consider citing the associated overview paper Quantum resources in resource management systems. This helps support the continued development and visibility of the repository. The BibTeX citation handle can be found in the CITATION.bib file.

Note that the overview paper is a work in progress, and we expect multiple versions to be released as the project evolves.


Contribution Guidelines

For information on how to contribute to this project, please take a look at our contribution guidelines.


References and Acknowledgements

  1. Quantum spank plugins for Slurm https://github.com/qiskit-community/spank-plugins
  2. Slurm documentation https://slurm.schedmd.com/
  3. Qiskit https://www.ibm.com/quantum/qiskit
  4. IBM Quantum https://www.ibm.com/quantum
  5. Pasqal https://pasqal.com
  6. STFC The Hartree Centre, https://www.hartree.stfc.ac.uk. This work was supported by the Hartree National Centre for Digital Innovation (HNCDI) programme.
  7. Rensselaer Polytechnic Institute, Center for Computational Innovation, http://cci.rpi.edu/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myqrmi-0.13.4.tar.gz (252.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

myqrmi-0.13.4-cp312-abi3-manylinux_2_28_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

File details

Details for the file myqrmi-0.13.4.tar.gz.

File metadata

  • Download URL: myqrmi-0.13.4.tar.gz
  • Upload date:
  • Size: 252.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for myqrmi-0.13.4.tar.gz
Algorithm Hash digest
SHA256 d175bc2bc9eb43df367dbf9dbcd3442f2f7f2005e245c899206b241abd98bf9f
MD5 afb3857ae2716907993224acada72dce
BLAKE2b-256 956236398da312dabc11d6f73ce4f1af8dae04899444e44319037a8fadfa91cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for myqrmi-0.13.4.tar.gz:

Publisher: release.yml on cclaudio/qrmi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file myqrmi-0.13.4-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for myqrmi-0.13.4-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dbcf83701c7bb32906a98ccff1c7e0d9c7513a008f3ac80cf300d24a2c82784c
MD5 07b416a48c56cc6f17bf1566fb965042
BLAKE2b-256 6d7a7087e2fef7256e0f2f9c85e3c2267d37b029ac418447c7e51d43758f0bd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for myqrmi-0.13.4-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on cclaudio/qrmi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page