Qiskit Primitives with Pasqal Cloud QRMI - Python Example#
Prerequisites#
Python 3.11 or 3.12
Installation of QRMI primitives Python package (qiskit-qrmi-primitives)
Install dependencies#
Assuming your python virtual environment is located at
~/py311venv_qrmi_primitives/bin/activate,
source ~/py311venv_qrmi_primitives/bin/activate
pip install -r requirements.txt
Set environment variables#
Because QRMI is an environment variable driven software library, all
configuration parameters must be specified in environment variables. The
required environment variables are listed below. This example assumes
that a .env file is available under the current directory.
Common#
When run as a job in a Slurm cluster, these environment variables are set by the SPANK plugin.
Environment variables |
Descriptions |
|---|---|
|
Quantum resource names. Comma-separated
values, e.g. |
|
Quantum resource types. Comma-separated
values corresponding to each Quantum
resource name specified by
|
How to run this example#
SamplerV2#
Use the Qiskit Pasqal Provider SamplerV2.
This example wraps a QRMI backend with the Qiskit Pasqal Provider
SamplerV2.
Execution returns a job object and Qiskit-style result object:
1job = sampler.run([qc], shots=100)
2result = job.result()
3print(result[0].data.counts)
QRMI run options can be passed through backend options: -
poll_interval_seconds - timeout_seconds - delete_job
Example:
1backend = QRMIPasqalBackend(
2 qrmi=qrmi,
3 options={"run_options": {"poll_interval_seconds": 1.0}},
4)
5sampler = SamplerV2(backend)
For emulator resources where device specs are not exposed, QRMI falls
back to Pulser DigitalAnalogDevice.
Run sampler.py:
python sampler.py