Skip to content

Commit 7a056cf

Browse files
authored
✨ Native Support for Qiskit Backends (#75)
* ♻ completely refactor how device properties and calibration data are handled * ✨allow direct use of Qiskit backends as Architectures (including calibration data) * 🐛 the fidelity of unavailable operations should be 0.0 * 💚 restore CI build of mapping apps * ✅ add Python tests for new feature and integrate into CI * 🔧require Python >=3.7 * 🔥 remove calibration️ filename * 📝update README.md * ⬆️ update qfr
1 parent 18a0d3d commit 7a056cf

File tree

21 files changed

+589
-211
lines changed

21 files changed

+589
-211
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ jobs:
5757
5858
- name: Build
5959
run: |
60+
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic
61+
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact
6062
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic_test
6163
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact_test
6264
@@ -96,6 +98,8 @@ jobs:
9698

9799
- name: Build
98100
run: |
101+
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic
102+
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact
99103
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_heuristic_test
100104
cmake --build "${{github.workspace}}/build" --config $BUILD_TYPE --target qmap_exact_test
101105

README.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,7 @@ It builds upon [our quantum functionality representation (QFR)](https://github.c
3737
* `TFC` (e.g. from [Reversible Logic Synthesis Benchmarks Page](http://webhome.cs.uvic.ca/~dmaslov/mach-read.html))
3838
* `QC` (e.g. from [Feynman](https://github.com/meamy/feynman))
3939

40-
to any given architecture, e.g., the 5-qubit, T-shaped IBMQ London architecture, which is specified by the coupling map
41-
42-
```
43-
5
44-
0 1
45-
1 0
46-
1 2
47-
2 1
48-
1 3
49-
3 1
50-
3 4
51-
4 3
52-
```
53-
with the following available methods:
40+
to any given architecture with the following available methods:
5441

5542
- **Heuristic Mapper**: Heuristic solution based on A* search. For details see [[1]](https://www.cda.cit.tum.de/files/eda/2018_tcad_efficient_mapping_of_quantum_circuits_to_ibm_qx_architectures.pdf)
5643
and [[3]](https://www.cda.cit.tum.de/files/eda/2021_aspdac_exploiting_teleportation_in_quantum_circuit_mappping.pdf).
@@ -78,14 +65,18 @@ MQT QMAP is developed as a C++ library with an easy to use Python interface.
7865
This enables platform specific compiler optimizations that cannot be enabled on portable wheels.
7966
- Once installed, start using it in Python:
8067
```python
81-
from mqt.qmap import *
82-
results = compile(circ, arch)
68+
from mqt import qmap
69+
results = qmap.compile(circ, arch)
8370
```
8471

8572
where `circ` is either a Qiskit `QuantumCircuit` object or the path to an input file (in any of the formats listed above)
86-
and `arch` is either one of the pre-defined architectures (see below) or the path to a file containing the number of qubits and a line-by-line enumeration of the qubit connections.
73+
and `arch` is either
74+
75+
- a Qiskit `Backend` instance such as those defined under `qiskit.test.mock` **(recommended)**,
76+
- one of the pre-defined architectures (see below), or
77+
- the path to a file containing the number of qubits and a line-by-line enumeration of the qubit connections.
8778

88-
Architectures that are available per default (either as strings or under `qmap.Arch.<...>`) include (corresponding files are available in `extern/architectures/`):
79+
Architectures that are available per default (either as strings or under `qmap.Arch.<...>`) include:
8980

9081
- `IBM_QX4` (5 qubit, directed bow tie layout)
9182
- `IBM_QX5` (16 qubit, directed ladder layout)
@@ -192,7 +183,7 @@ Internally the MQT QMAP library works in the following way
192183
- (Optional) Import calibration file into `arch` object
193184
```c++
194185
std::string cal = "<PATH_TO_CAL_FILE>";
195-
arch.loadCalibrationData(cal);
186+
arch.loadProperties(cal);
196187
```
197188
- Depending on `Method`, instantiate a `HeuristicMapper` or `ExactMapper` object with the circuit and the architecture
198189
```c++

apps/exact_app.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char** argv) {
7373
if (vm.count("calibration")) {
7474
const std::string cal = vm["calibration"].as<std::string>();
7575
try {
76-
arch.loadCalibrationData(cal);
76+
arch.loadProperties(cal);
7777
} catch (std::exception const& e) {
7878
std::stringstream ss{};
7979
ss << "Could not import calibration data: " << e.what();

apps/heuristic_app.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int main(int argc, char** argv) {
6868
if (vm.count("calibration")) {
6969
const std::string cal = vm["calibration"].as<std::string>();
7070
try {
71-
arch.loadCalibrationData(cal);
71+
arch.loadProperties(cal);
7272
} catch (std::exception const& e) {
7373
std::stringstream ss{};
7474
ss << "Could not import calibration data: " << e.what();

extern/qfr

Submodule qfr updated from 5c7361c to b1fe5cc

0 commit comments

Comments
 (0)