MQT Core’s QDMI Driver Implementation

Objective

A QDMI Driver manages the communication between QDMI devices, such as MQT Core’s NA QDMI Device or MQT Core’s DDSIM QDMI Device, and QDMI clients, see the QDMI specification. It is responsible for loading the device, forwarding requests from the client to the device, and sending back the results. MQT Core’s QDMI Driver, qdmi::Driver, comes with several preloaded devices when the bundled devices are enabled. Other devices can be loaded dynamically at runtime via qdmi::Driver::registerDevice() and qdmi::Driver::open(). Built-in and external devices can also be registered through versioned QDMI device configuration.

Building the Bundled Devices

Standalone MQT Core builds include the DDSIM, superconducting, and neutral-atom QDMI device libraries by default. When MQT Core is embedded in another CMake project using FetchContent or add_subdirectory, these device libraries are disabled by default so the consumer does not build implementations it may not use. They can be selected independently before making MQT Core available:

  • BUILD_MQT_CORE_QDMI_DDSIM_DEVICE

  • BUILD_MQT_CORE_QDMI_NA_DEVICE

  • BUILD_MQT_CORE_QDMI_SC_DEVICE

For example, an embedded simulator consumer can enable only the DDSIM device, while CUDA-Q can enable the DDSIM and superconducting devices used by its integration tests.

The QDMI driver and FoMaC libraries are available independently. Device-free builds can register external device libraries through QDMI device configuration. When MQT Core’s C++ tests are enabled, device-specific tests are omitted with their corresponding device.

Python Bindings

The QDMI interface is the low-level contract implemented by a QDMI device. The MQT Core QDMI driver loads device libraries and implements the QDMI client interface. The C++ FoMaC library adds owning wrappers for QDMI devices, sites, operations, and jobs. The Python module exposes these QDMI entities through mqt.core.qdmi. Its mqt.core.qdmi.driver submodule provides device discovery, registration, and opening.

MQT Core v3 exposes device registration, discovery, and opening through module functions. The legacy Session class remains for v3 source compatibility. It is deprecated and will be removed in MQT Core 4.0.

Usage

The following example opens each registered device by its stable ID.

1from mqt.core.qdmi.driver import open_device, registered_device_ids
2
3for device_id in registered_device_ids():
4    device = open_device(device_id)
5    print(device.name())
MQT Core DDSIM QDMI Device
MQT NA Default QDMI Device
MQT SC Default QDMI Device
IQM Emerald
IQM Garnet

The former module remains available in MQT Core v3:

from mqt.core import fomac

Importing mqt.core.fomac emits a DeprecationWarning. Its public objects are the same objects as those in mqt.core.qdmi and mqt.core.qdmi.driver.