Easy Integration with the iqm-qdmi Python Package¶
To ease the distribution and integration of the IQM QDMI Device library, we have
packaged it as a Python module available on PyPI under the name iqm-qdmi. This
package provides a convenient way to discover installation paths and metadata
that are useful when integrating the IQM QDMI Device into downstream build
systems, such as CMake-based projects or Python workflows.
Install From PyPI¶
Use uv (or your Python package manager of choice) to install the package:
uv pip install iqm-qdmi
Quick Usage¶
The package itself makes the following variables available for import:
__version__: installed package version.IQM_QDMI_INCLUDE_DIR: include directory for C/C++ headers.IQM_QDMI_CMAKE_DIR: CMake package directory forfind_packageintegration.IQM_QDMI_LIBRARY_PATH: full path to the shared library.
1from iqm.qdmi import __version__, IQM_QDMI_INCLUDE_DIR, IQM_QDMI_CMAKE_DIR, IQM_QDMI_LIBRARY_PATH
2
3print(f"QDMI on IQM version: {__version__}")
4print(f"Include directory: {IQM_QDMI_INCLUDE_DIR}")
5print(f"CMake directory: {IQM_QDMI_CMAKE_DIR}")
6print(f"Library path: {IQM_QDMI_LIBRARY_PATH}")
QDMI on IQM version: 1.2.0
Include directory: /home/runner/work/QDMI-on-IQM/QDMI-on-IQM/.nox/docs/lib/python3.12/site-packages/iqm/qdmi/data/include
CMake directory: /home/runner/work/QDMI-on-IQM/QDMI-on-IQM/.nox/docs/lib/python3.12/site-packages/iqm/qdmi/data/share/cmake
Library path: /home/runner/work/QDMI-on-IQM/QDMI-on-IQM/.nox/docs/lib/python3.12/site-packages/iqm/qdmi/data/lib/libiqm-qdmi-device.so
Command Line Interface¶
The above values can also be conveniently queried from the command line via the
iqm-qdmi entry point.
1!iqm-qdmi --help
usage: iqm-qdmi [-h] [--version | --include_dir | --cmake_dir | --lib_path]
Command line interface for the QDMI on IQM library.
options:
-h, --help show this help message and exit
--version show program's version number and exit
--include_dir Print the path to the iqm-qdmi C/C++ include directory
--cmake_dir Print the path to the iqm-qdmi CMake module directory
--lib_path Print the path to the iqm-qdmi shared library
1!iqm-qdmi --version
1.2.0
1!iqm-qdmi --include_dir
/home/runner/work/QDMI-on-IQM/QDMI-on-IQM/.nox/docs/lib/python3.12/site-packages/iqm/qdmi/data/include
1!iqm-qdmi --cmake_dir
/home/runner/work/QDMI-on-IQM/QDMI-on-IQM/.nox/docs/lib/python3.12/site-packages/iqm/qdmi/data/share/cmake
1!iqm-qdmi --lib_path
/home/runner/work/QDMI-on-IQM/QDMI-on-IQM/.nox/docs/lib/python3.12/site-packages/iqm/qdmi/data/lib/libiqm-qdmi-device.so
Sampler and Estimator CLI Utilities¶
If you install the package with the qiskit extra, the following additional
command-line scripts are exposed:
iqm-sampler(see thesamplerentry point module): Samples a serialized QPY circuit on the specified backend.iqm-estimator(see theestimatorentry point module): Variational Quantum Eigensolver (VQE) parameter estimation for a serialized ansatz and observable.
iqm-sampler Usage¶
For example, to execute a QPY circuit file (bell.qpy):
iqm-sampler bell.qpy --shots 128
iqm-estimator Usage¶
To run a parameter estimation job:
iqm-estimator ansatz.qpy observable.pkl --maxiter 10