QDMI Devices v0.1
Quantum Device Management Interface Devices
Loading...
Searching...
No Matches
Implementations

This page contains the implementations of the QDMI devices.

Implemented Devices

Currently, there are two QDMI device implementations: Qaptiva and DCDB. While Qaptiva is implemented using C with Python components, DCDB is implemented using C++.

Qaptiva is a quantum computing emulator that has 38 qubits. On the other hand, DCDB is a database of the LRZ that monitors HPC environments.

While Qaptiva is capable of executing quantum circuits, DCDB allows the QDMI Client to query the surroundings of quantum and HPC devices located at LRZ.

The Properties of Devices

Every implemented devices has different proterties, i.e. QDMI_DEVICE_PROPERTY_NAME, the number of QDMI_Site or QDMI_TelemetrySensor.

The properties might be of composite type such as QDMI_TelemetrySensor or QDMI_Site or primitive type such as int, char* (string). i.e char* (string), int, QDMI_Site.

The QDMI_Client can query the device to get the properties using QDMI_device_query_device_property. If the device does not support the property it would return QDMI_ERROR_NOTSUPPORTED. Below you can find the respective implementation in DCDB and Qaptiva.

  • QLM
    QAPTIVA_QDMI_Device_Session session, const QDMI_Device_Property prop,
    const size_t size, void *value, size_t *size_ret) {
    if (prop >= QDMI_DEVICE_PROPERTY_MAX || (value == NULL && size_ret == NULL)) {
    return QDMI_ERROR_INVALIDARGUMENT;
    }
    ADD_STRING_PROPERTY(QDMI_DEVICE_PROPERTY_NAME, "QLM", prop, size, value,
    size_ret)
    ADD_STRING_PROPERTY(QDMI_DEVICE_PROPERTY_VERSION, "0.0.1", prop, size, value,
    size_ret)
    ADD_STRING_PROPERTY(QDMI_DEVICE_PROPERTY_LIBRARYVERSION, "0.0.1", prop, size,
    #define ADD_STRING_PROPERTY(prop_name, prop_value, prop, size, value, size_ret)
    Adds a string property to the device.
    Definition dcdb.cpp:64
    int QAPTIVA_QDMI_device_session_query_device_property(QAPTIVA_QDMI_Device_Session session, const QDMI_Device_Property prop, const size_t size, void *value, size_t *size_ret)
    Queries the device's properties.
    Definition qaptiva.c:508
    value, size_ret)
    ADD_SINGLE_VALUE_PROPERTY(QDMI_DEVICE_PROPERTY_QUBITSNUM, size_t, 38, prop,
    size, value, size_ret)
    ADD_SINGLE_VALUE_PROPERTY(QDMI_DEVICE_PROPERTY_STATUS, QDMI_Device_Status,
    QAPTIVA_QDMI_read_device_status(), prop, size, value,
    size_ret)
    ADD_LIST_PROPERTY(QDMI_DEVICE_PROPERTY_SITES, QAPTIVA_QDMI_Site, DEVICE_SITES, 38,
    prop, size, value, size_ret)
    // Since it is a emulator, there is no coupling map.
    return QDMI_ERROR_NOTSUPPORTED;
    #define ADD_LIST_PROPERTY(prop_name, prop_type, prop_values, prop, size, value, size_ret)
    Adds a list typed value property to the device.
    Definition dcdb.cpp:151
    #define ADD_SINGLE_VALUE_PROPERTY(prop_name, prop_type, prop_value, prop, size, value, size_ret)
    Adds a primitive typed value property to the device.
    Definition dcdb.cpp:108
    QDMI_Device_Status QAPTIVA_QDMI_read_device_status(void)
    The local function to read the device status.
    Definition qaptiva.c:386
    const QAPTIVA_QDMI_Site DEVICE_SITES[]
    The array of the sites.
    Definition qaptiva.c:157
  • DCDB
    DCDB_QDMI_Device_Session session, const QDMI_Device_Property prop,
    const size_t size, void *value, size_t *size_ret) {
    if (prop >= QDMI_DEVICE_PROPERTY_MAX || (value == NULL && size_ret == NULL)) {
    return QDMI_ERROR_INVALIDARGUMENT;
    }
    ADD_STRING_PROPERTY(QDMI_DEVICE_PROPERTY_NAME, "DCDB", prop, size, value,
    size_ret)
    ADD_STRING_PROPERTY(QDMI_DEVICE_PROPERTY_VERSION, "0.0.1", prop, size, value,
    size_ret)
    ADD_STRING_PROPERTY(QDMI_DEVICE_PROPERTY_LIBRARYVERSION, "0.0.1", prop, size,
    int DCDB_QDMI_device_session_query_device_property(DCDB_QDMI_Device_Session session, const QDMI_Device_Property prop, const size_t size, void *value, size_t *size_ret)
    Queries the device's properties.
    Definition dcdb.cpp:578
    value, size_ret)
    ADD_SINGLE_VALUE_PROPERTY(QDMI_DEVICE_PROPERTY_STATUS, QDMI_Device_Status,
    DCDB_QDMI_read_device_status(), prop, size, value,
    size_ret)
    ADD_LIST_PROPERTY(QDMI_DEVICE_PROPERTY_TELEMETRYSENSORS,
    DCDB_QDMI_TelemetrySensor, DCDB_DEVICE_TELEMETRYSENSORS,
    prop, size, value, size_ret)
    return QDMI_ERROR_NOTSUPPORTED;
    QDMI_Device_Status DCDB_QDMI_read_device_status(void)
    The local function to read the device status.
    Definition dcdb.cpp:237
    constexpr std::array< const DCDB_QDMI_TelemetrySensor_impl_t *, 90 > DCDB_DEVICE_TELEMETRYSENSORS
    All the telemetry sensor array.
    Definition sensors.h:393

Both implementations use an auxiliary macro to add the string properties to the device. For an explanation of the macros, see the QDMI Documentation on Auxiliary Macros.

The Sites of the Devices

A QDMI_Site represents a qubit in the QLM implementation. Due to the nature of the emulators, the qubit is not have T1 or T2 values. Therefore, the implementation only provides the index of the qubit.

  • QLM
    int QAPTIVA_QDMI_device_session_query_site_property(QAPTIVA_QDMI_Device_Session session,
    QAPTIVA_QDMI_Site site,
    const QDMI_Site_Property prop,
    const size_t size, void *value,
    size_t *size_ret) {
    // Since it is a emulator, there is no qubit property.
    if (session == NULL || site == NULL || (value != NULL && size == 0) ||
    prop >= QDMI_SITE_PROPERTY_MAX) {
    return QDMI_ERROR_INVALIDARGUMENT;
    }
    if (prop != QDMI_SITE_PROPERTY_INDEX)
    int QAPTIVA_QDMI_device_session_query_site_property(QAPTIVA_QDMI_Device_Session session, QAPTIVA_QDMI_Site site, const QDMI_Site_Property prop, const size_t size, void *value, size_t *size_ret)
    Query a site property.
    Definition qaptiva.c:564
    return QDMI_ERROR_NOTSUPPORTED;
    ADD_SINGLE_VALUE_PROPERTY(QDMI_SITE_PROPERTY_INDEX, uint64_t, site->id, prop,
    size, value, size_ret)
    return QDMI_ERROR_NOTSUPPORTED;

The Telemetry Sensor of the Devices

A QDMI_TelemetrySensor represents a telemetry sensor that located at the LRZ in the DCDB implementation. All the predefined properties of a QDMI_TelemetrySensor can be queried.

  • DCDB
    DCDB_QDMI_Device_Session session, DCDB_QDMI_TelemetrySensor telemetrysensor,
    QDMI_TelemetrySensor_Property prop, size_t size, void *value,
    size_t *size_ret) {
    if (session == nullptr || telemetrysensor == nullptr ||
    (value != nullptr && size == 0) ||
    (prop >= QDMI_TELEMETRYSENSOR_PROPERTY_MAX &&
    prop != QDMI_TELEMETRYSENSOR_PROPERTY_CUSTOM1 &&
    prop != QDMI_TELEMETRYSENSOR_PROPERTY_CUSTOM2 &&
    prop != QDMI_TELEMETRYSENSOR_PROPERTY_CUSTOM3 &&
    prop != QDMI_TELEMETRYSENSOR_PROPERTY_CUSTOM4 &&
    prop != QDMI_TELEMETRYSENSOR_PROPERTY_CUSTOM5)) {
    return QDMI_ERROR_INVALIDARGUMENT;
    }
    ADD_STRING_PROPERTY(QDMI_TELEMETRYSENSOR_PROPERTY_ID,
    telemetrysensor->id.c_str(), prop, size, value, size_ret)
    ADD_STRING_PROPERTY(QDMI_TELEMETRYSENSOR_PROPERTY_UNIT,
    telemetrysensor->unit.c_str(), prop, size, value,
    size_ret)
    ADD_SINGLE_VALUE_PROPERTY(QDMI_TELEMETRYSENSOR_PROPERTY_SAMPLINGRATE, float,
    int DCDB_QDMI_device_session_query_telemetrysensor_property(DCDB_QDMI_Device_Session session, DCDB_QDMI_TelemetrySensor telemetrysensor, QDMI_TelemetrySensor_Property prop, size_t size, void *value, size_t *size_ret)
    Query a telemetry sensor property.
    Definition dcdb.cpp:691
    telemetrysensor->sampling_rate.count(), prop, size,
    value, size_ret)
    return QDMI_ERROR_NOTSUPPORTED;

Submitting a Job

A QDMI_Job represents a quantum job that can be executed on the device in the QLM implementation. To be able to submit a job, QDMI_DEVICE_JOB_PARAMETER_PROGRAMand QDMI_DEVICE_JOB_PARAMETER_SHOTSNUM needs to be set.

  • QLM
    int QAPTIVA_QDMI_device_job_submit(QAPTIVA_QDMI_Device_Job job) {
    if (job == NULL)
    return QDMI_ERROR_INVALIDARGUMENT;
    if (job->status != QDMI_JOB_STATUS_CREATED || job->program == NULL ||
    job->num_shots == DEFAULT_NUM_SHOT)
    return QDMI_ERROR_INVALIDARGUMENT;
    job->status = QDMI_JOB_STATUS_SUBMITTED;
    int err = submit_job(job);
    if (err)
    job->status = QDMI_JOB_STATUS_FAILED;
    int QAPTIVA_QDMI_device_job_submit(QAPTIVA_QDMI_Device_Job job)
    Submit a job to the device.
    Definition qaptiva.c:809
    #define DEFAULT_NUM_SHOT
    The default number of the shot for a quantum job.
    Definition qaptiva.c:57
    int submit_job(QAPTIVA_QDMI_Device_Job job)
    An auxiliary function for submitting job.
    Definition qaptiva.c:733
    return QDMI_SUCCESS;

Submitting a Telemetry Sensor Query

A QDMI_TelemetrySensor_Query represents a data query of a telemetry sensor that can be executed on the device in the DCDB implementation. To be able to submit a query, QDMI_DEVICE_TELEMETRYSENSOR_QUERY_PARAMETER_STARTTIME. QDMI_DEVICE_TELEMETRYSENSOR_QUERY_PARAMETER_ENDTIME and QDMI_DEVICE_TELEMETRYSENSOR_QUERY_PARAMETER_TELEMETRYSENSOR needs to be set.

  • DCDB
    int DCDB_QDMI_device_telemetrysensor_query_submit(DCDB_QDMI_Device_TelemetrySensor_Query query)
    Submit a telemetry sensor query to the device.
    Definition dcdb.cpp:919
    DCDB_QDMI_Device_TelemetrySensor_Query query) {
    if (query == nullptr || query->telemetrysensor == nullptr ||
    (query->start_time > query->end_time)) {
    return QDMI_ERROR_INVALIDARGUMENT;
    }
    query->status = QDMI_TELEMETRYSENSOR_QUERY_STATUS_SUBMITTED;
    query->async_query = std::async(submit_query, query);
    return QDMI_SUCCESS;
    void submit_query(DCDB_QDMI_Device_TelemetrySensor_Query query)
    The auxiliary function to submit a telemetry sensor query.
    Definition dcdb.cpp:878