IQM Qiskit - Python Example#


Prerequisites#

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

QRMI_JOB_QPU_RESOURCES

Quantum resource names. Comma-separated values, e.g. garnet,emerald

QRMI_JOB_QPU_TYPES

Quantum resource types. Specify iqm-server for this example

IQM Server specific#

When run as a job in a Slurm cluster, these environment variables are set by users or administrator.

Environment variables

Descriptions

{qc_alias_name}_QRMI_IQM_ISA_ENDPOINT

IQM Server API endpoint

{qc_alias_name}_QRMI_IQM_ISA_TOKEN

IQM Server API token

Note

Replace the “:” in the {qc_alias_name} with “_” when specifying it. For example, sirius:mock -> sirius_mock.

Example#

export QRMI_JOB_QPU_RESOURCES=garnet_mock
export QRMI_JOB_QPU_TYPES=iqm-server
export garnet_mock_QRMI_IQM_ISA_ENDPOINT=https://resonance.meetiqm.com
export garnet_mock_QRMI_IQM_ISA_TOKEN=your token

How to run this example#

Run iqm_example.py:

python iqm_example.py