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.
- ⬇️ Installation
▶️ Examples- How to Give Feedback
- How to Cite This Work
- Contribution Guidelines
- References and Acknowledgements
All full examples are available in examples folder.
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.
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.
QRMI Pasqal Cloud supports both Qiskit, Pulser and CUDA-Q analog programs.
See the Pasqal Cloud examples in this repository:
- Python: examples/qrmi/python/pasqal_cloud
- Rust: examples/qrmi/rust/pasqal_cloud
- C: examples/qrmi/c/pasqal_cloud
- CUDA-Q examples/qrmi/python/cudaq
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.
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.
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
We encourage your feedback! You can share your thoughts with us by:
- Opening an issue in the repository
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.
For information on how to contribute to this project, please take a look at our contribution guidelines.
- Quantum spank plugins for Slurm https://github.com/qiskit-community/spank-plugins
- Slurm documentation https://slurm.schedmd.com/
- Qiskit https://www.ibm.com/quantum/qiskit
- IBM Quantum https://www.ibm.com/quantum
- Pasqal https://pasqal.com
- STFC The Hartree Centre, https://www.hartree.stfc.ac.uk. This work was supported by the Hartree National Centre for Digital Innovation (HNCDI) programme.
- Rensselaer Polytechnic Institute, Center for Computational Innovation, http://cci.rpi.edu/