Skip to content

Commit 03456fc

Browse files
ystadecoderabbitai[bot]burgholzerrenovate[bot]denialhaag
authored
✨ New QDMI Device to represent SC Devices (#1328)
## Description This PR adds a—for the moment—minimalistic SC QDMI device that only features a coupling map. The changes extend the QDMI device framework by relocating the Device class to the qdmi::na namespace, adding a new superconducting (SC) device backend with session and job management APIs, introducing JSON-based device configuration and code generation utilities, and providing a CLI tool and comprehensive test coverage for the SC device. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are focused and relevant to this change. - [x] I have added appropriate tests that cover the new/changed functionality. - [x] I have updated the documentation to reflect these changes. - [x] I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals. - [x] I have added migration instructions to the upgrade guide (if needed). - [x] The changes follow the project's style guidelines and introduce no new warnings. - [x] The changes are fully tested and pass the CI checks. - [x] I have reviewed my own code changes. --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: burgholzer <burgholzer@me.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Lukas Burgholzer <burgholzer@me.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Co-authored-by: matthias <matthias.reumann@tum.de>
1 parent 2fdc815 commit 03456fc

26 files changed

Lines changed: 3527 additions & 180 deletions

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel
1111

1212
### Added
1313

14+
- ✨ Add a new QDMI device that represents a superconducting architecture featuring a coupling map ([#1328]) ([**@ystade**])
1415
- ✨ Add bi-directional iterator that traverses the def-use chain of a qubit value ([#1310]) ([**@MatthiasReumann**])
1516
- ✨ Add `OptionalDependencyTester` to lazily handle optional Python dependencies like Qiskit ([#1243]) ([**@marcelwa**], [**@burgholzer**])
1617
- ✨ Expose the QDMI job interface through FoMaC ([#1243]) ([**@marcelwa**], [**@burgholzer**])
@@ -265,6 +266,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool
265266
<!-- PR links -->
266267

267268
[#1336]: https://github.com/munich-quantum-toolkit/core/pull/1336
269+
[#1328]: https://github.com/munich-quantum-toolkit/core/pull/1328
268270
[#1327]: https://github.com/munich-quantum-toolkit/core/pull/1327
269271
[#1310]: https://github.com/munich-quantum-toolkit/core/pull/1310
270272
[#1301]: https://github.com/munich-quantum-toolkit/core/pull/1301

include/mqt-core/na/device/Device.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <variant>
2828
#include <vector>
2929

30-
namespace qdmi {
30+
namespace qdmi::na {
3131
class Device final {
3232
/// @brief Provides access to the device name.
3333
std::string name_;
@@ -118,7 +118,7 @@ class Device final {
118118
auto queryProperty(QDMI_Device_Property prop, size_t size, void* value,
119119
size_t* sizeRet) -> int;
120120
};
121-
} // namespace qdmi
121+
} // namespace qdmi::na
122122

123123
/**
124124
* @brief Implementation of the MQT_NA_QDMI_Device_Session structure.
@@ -216,46 +216,46 @@ struct MQT_NA_QDMI_Device_Job_impl_d {
216216
* @brief Sets a parameter for the job.
217217
* @see MQT_NA_QDMI_device_job_set_parameter
218218
*/
219-
static auto setParameter(QDMI_Device_Job_Parameter param, size_t size,
220-
const void* value) -> int;
219+
auto setParameter(QDMI_Device_Job_Parameter param, size_t size,
220+
const void* value) -> int;
221221

222222
/**
223223
* @brief Queries a property of the job.
224224
* @see MQT_NA_QDMI_device_job_query_property
225225
*/
226-
static auto queryProperty(QDMI_Device_Job_Property prop, size_t size,
227-
void* value, size_t* sizeRet) -> int;
226+
auto queryProperty(QDMI_Device_Job_Property prop, size_t size, void* value,
227+
size_t* sizeRet) -> int;
228228

229229
/**
230230
* @brief Submits the job to the device.
231231
* @see MQT_NA_QDMI_device_job_submit
232232
*/
233-
static auto submit() -> int;
233+
auto submit() -> int;
234234

235235
/**
236236
* @brief Cancels the job.
237237
* @see MQT_NA_QDMI_device_job_cancel
238238
*/
239-
static auto cancel() -> int;
239+
auto cancel() -> int;
240240

241241
/**
242242
* @brief Checks the status of the job.
243243
* @see MQT_NA_QDMI_device_job_check
244244
*/
245-
static auto check(QDMI_Job_Status* status) -> int;
245+
auto check(QDMI_Job_Status* status) -> int;
246246

247247
/**
248248
* @brief Waits for the job to complete but at most for the specified timeout.
249249
* @see MQT_NA_QDMI_device_job_wait
250250
*/
251-
static auto wait(size_t timeout) -> int;
251+
auto wait(size_t timeout) -> int;
252252

253253
/**
254254
* @brief Gets the results of the job.
255255
* @see MQT_NA_QDMI_device_job_get_results
256256
*/
257-
static auto getResults(QDMI_Job_Result result, size_t size, void* data,
258-
[[maybe_unused]] size_t* sizeRet) -> int;
257+
auto getResults(QDMI_Job_Result result, size_t size, void* data,
258+
[[maybe_unused]] size_t* sizeRet) -> int;
259259
};
260260

261261
/**

include/mqt-core/qdmi/Driver.hpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class DynamicDeviceLibrary final : public DeviceLibrary {
140140
// Call the above macro for all static libraries that we want to support.
141141
DECLARE_STATIC_LIBRARY(MQT_NA)
142142
DECLARE_STATIC_LIBRARY(MQT_DDSIM)
143+
DECLARE_STATIC_LIBRARY(MQT_SC)
143144

144145
/**
145146
* @brief The status of a session.
@@ -407,11 +408,22 @@ class Driver final {
407408
#ifndef _WIN32
408409
/**
409410
* @brief Adds a dynamic device library to the driver.
410-
* @param libName is the path to the dynamic library to load.
411-
* @param prefix is the prefix used for the device interface functions.
412-
* @returns `true` if the library was successfully loaded, `false`
413-
* if it was already loaded.
411+
* @details This function attempts to load a dynamic library containing
412+
* QDMI device interface functions. If the library is already loaded, the
413+
* function returns `false`. Otherwise, it loads the library, initializes
414+
* the device, and adds it to the list of devices.
415+
*
416+
* @param libName The path to the dynamic library to load.
417+
* @param prefix The prefix used for the device interface functions in the
418+
* library.
419+
* @returns `true` if the library was successfully loaded, `false` if it was
420+
* already loaded.
421+
*
414422
* @note This function is only available on non-Windows platforms.
423+
*
424+
* @throws std::runtime_error If the library fails to load or the device
425+
* cannot be initialized.
426+
* @throws std::bad_alloc If memory allocation fails during the process.
415427
*/
416428
auto addDynamicDeviceLibrary(const std::string& libName,
417429
const std::string& prefix) -> bool;

0 commit comments

Comments
 (0)