Skip to content

Commit d8f4f5c

Browse files
authored
Update to newest QFR Submodule Version (#10)
* 🎨 add clang-format to QMAP * 💚 adjusting code coverage statistics gathering * ⬆️ update QFR submodule * 🔖 bumping version number * 🐛 fix MANIFEST.in * 📄 updating license
1 parent 6db4606 commit d8f4f5c

29 files changed

+2736
-2654
lines changed

.clang-format

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Generated from CLion C/C++ Code Style settings
2+
BasedOnStyle: LLVM
3+
AccessModifierOffset: -4
4+
AlignAfterOpenBracket: Align
5+
AlignConsecutiveAssignments: Consecutive
6+
AlignConsecutiveDeclarations: Consecutive
7+
AlignEscapedNewlines: Left
8+
AlignOperands: AlignAfterOperator
9+
AlignTrailingComments: true
10+
AllowAllArgumentsOnNextLine: true
11+
AllowAllConstructorInitializersOnNextLine: true
12+
AllowAllParametersOfDeclarationOnNextLine: true
13+
AllowShortBlocksOnASingleLine: Empty
14+
AllowShortCaseLabelsOnASingleLine: true
15+
AllowShortEnumsOnASingleLine: true
16+
AllowShortFunctionsOnASingleLine: Inline
17+
AllowShortIfStatementsOnASingleLine: WithoutElse
18+
AllowShortLambdasOnASingleLine: All
19+
AllowShortLoopsOnASingleLine: true
20+
AlwaysBreakAfterReturnType: None
21+
AlwaysBreakTemplateDeclarations: Yes
22+
BreakBeforeBraces: Custom
23+
BraceWrapping:
24+
AfterCaseLabel: false
25+
AfterClass: false
26+
AfterControlStatement: Never
27+
AfterEnum: false
28+
AfterFunction: false
29+
AfterNamespace: false
30+
AfterUnion: false
31+
BeforeCatch: false
32+
BeforeElse: false
33+
IndentBraces: false
34+
SplitEmptyFunction: false
35+
SplitEmptyRecord: false
36+
BreakBeforeBinaryOperators: None
37+
BreakBeforeTernaryOperators: false
38+
BreakConstructorInitializers: AfterColon
39+
BreakInheritanceList: AfterColon
40+
ColumnLimit: 0
41+
CompactNamespaces: false
42+
ContinuationIndentWidth: 8
43+
Cpp11BracedListStyle: true
44+
DeriveLineEnding: true
45+
EmptyLineBeforeAccessModifier: LogicalBlock
46+
IncludeBlocks: Regroup
47+
IndentCaseBlocks: false
48+
IndentCaseLabels: true
49+
IndentPPDirectives: BeforeHash
50+
IndentWidth: 4
51+
KeepEmptyLinesAtTheStartOfBlocks: false
52+
Language: Cpp
53+
MaxEmptyLinesToKeep: 1
54+
NamespaceIndentation: All
55+
ObjCSpaceAfterProperty: false
56+
ObjCSpaceBeforeProtocolList: true
57+
PointerAlignment: Left
58+
ReflowComments: false
59+
SortIncludes: true
60+
SpaceAfterCStyleCast: false
61+
SpaceAfterLogicalNot: false
62+
SpaceAfterTemplateKeyword: false
63+
SpaceBeforeAssignmentOperators: true
64+
SpaceBeforeCaseColon: false
65+
SpaceBeforeCpp11BracedList: false
66+
SpaceBeforeCtorInitializerColon: false
67+
SpaceBeforeInheritanceColon: false
68+
SpaceBeforeParens: ControlStatements
69+
SpaceBeforeRangeBasedForLoopColon: false
70+
SpaceBeforeSquareBrackets: false
71+
SpaceInEmptyBlock: false
72+
SpaceInEmptyParentheses: false
73+
SpacesBeforeTrailingComments: 1
74+
SpacesInAngles: false
75+
SpacesInConditionalStatement: false
76+
SpacesInCStyleCastParentheses: false
77+
SpacesInContainerLiterals: false
78+
SpacesInParentheses: false
79+
SpacesInSquareBrackets: false
80+
Standard: c++17
81+
TabWidth: 4
82+
UseTab: Never

.github/codecov.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ignore:
2+
- "extern/**/*"
3+
- "apps/*"
4+
- "test/*.cpp"
5+
- "jkq/**/*"
6+
7+
coverage:
8+
range: 60..90
9+
precision: 1
10+
status:
11+
project:
12+
default:
13+
threshold: 0.5%
14+
patch:
15+
default:
16+
threshold: 1%

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ env:
1717
Z3_GIT_TAG: z3-4.8.10
1818

1919
jobs:
20+
codestyle:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
submodules: recursive
26+
- uses: DoozyX/clang-format-lint-action@v0.12
27+
with:
28+
source: 'apps include src test jkq/qmap'
29+
extensions: 'h,hpp,c,cpp'
30+
clangFormatVersion: 12
31+
2032
ubuntu-ci:
2133
runs-on: ubuntu-latest
2234

.github/workflows/deploy.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ on:
1111

1212
env:
1313
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
14-
CIBW_BEFORE_ALL_LINUX: >
15-
/opt/python/cp38-cp38/bin/python -m pip install z3-solver;
16-
CIBW_ENVIRONMENT_LINUX: "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python/cp38-cp38/lib/python3.8/site-packages/z3/lib Z3_ROOT=/opt/python/cp38-cp38/lib/python3.8/site-packages/z3 Z3_DIR=/opt/python/cp38-cp38/lib/python3.8/site-packages/z3"
17-
CIBW_BUILD: cp3?-*
18-
CIBW_SKIP: "*-win32 *-manylinux_i686 cp35-*"
19-
CIBW_BUILD_VERBOSITY: 3
20-
CIBW_TEST_COMMAND: "python -c \"from jkq import qmap\""
21-
Z3_GIT_TAG: z3-4.8.10
14+
CIBW_BEFORE_ALL_LINUX: >
15+
/opt/python/cp38-cp38/bin/python -m pip install z3-solver;
16+
CIBW_ENVIRONMENT_LINUX: "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python/cp38-cp38/lib/python3.8/site-packages/z3/lib Z3_ROOT=/opt/python/cp38-cp38/lib/python3.8/site-packages/z3 Z3_DIR=/opt/python/cp38-cp38/lib/python3.8/site-packages/z3"
17+
CIBW_BUILD: cp3?-*
18+
# CIBW_ARCHS_MACOS: "x86_64 arm64"
19+
# CIBW_TEST_SKIP: "*_arm64"
20+
CIBW_SKIP: "*-win32 *-manylinux_i686"
21+
CIBW_BUILD_VERBOSITY: 3
22+
CIBW_TEST_COMMAND: "python -c \"from jkq import qmap\""
23+
Z3_GIT_TAG: z3-4.8.10
2224

2325
jobs:
2426
build_manylinux_wheels:
@@ -32,9 +34,9 @@ jobs:
3234
- uses: actions/setup-python@v2
3335
name: Install Python
3436
with:
35-
python-version: '3.8'
37+
python-version: '3.9'
3638
- name: Build wheels
37-
uses: pypa/cibuildwheel@v1.11.1
39+
uses: pypa/cibuildwheel@v2.1.1
3840
- uses: actions/upload-artifact@v2
3941
with:
4042
path: ./wheelhouse/*.whl
@@ -50,11 +52,11 @@ jobs:
5052
- uses: actions/setup-python@v2
5153
name: Install Python
5254
with:
53-
python-version: '3.8'
55+
python-version: '3.9'
5456
- name: Install Z3
5557
run: brew install z3
5658
- name: Build wheels
57-
uses: pypa/cibuildwheel@v1.11.1
59+
uses: pypa/cibuildwheel@v2.1.1
5860
- uses: actions/upload-artifact@v2
5961
with:
6062
path: ./wheelhouse/*.whl
@@ -70,7 +72,7 @@ jobs:
7072
- uses: actions/setup-python@v2
7173
name: Install Python
7274
with:
73-
python-version: '3.8'
75+
python-version: '3.9'
7476
- uses: ilammy/msvc-dev-cmd@v1
7577
- name: Cache Z3
7678
id: cache-z3
@@ -90,7 +92,7 @@ jobs:
9092
working-directory: ${{github.workspace}}/z3/build
9193
run: cmake --build . --config Release --target INSTALL;
9294
- name: Build wheels
93-
uses: pypa/cibuildwheel@v1.11.1
95+
uses: pypa/cibuildwheel@v2.1.1
9496
- uses: actions/upload-artifact@v2
9597
with:
9698
path: ./wheelhouse/*.whl
@@ -105,7 +107,7 @@ jobs:
105107
- uses: actions/setup-python@v2
106108
name: Install Python
107109
with:
108-
python-version: '3.8'
110+
python-version: '3.9'
109111
- name: Install Z3
110112
run: brew install z3
111113
- name: Build sdist

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14...3.19)
22

33
project(qmap
44
LANGUAGES CXX
5-
VERSION 1.3.2
5+
VERSION 1.4.0
66
DESCRIPTION "QMAP - A JKQ library for mapping of quantum circuits to quantum architectures"
77
)
88

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Alwin Zulehner, Stefan Hillmich, Lukas Burgholzer, Hartwig Bauer, Alexandru Paler, and Robert Wille
3+
Copyright (c) 2021 Alwin Zulehner, Stefan Hillmich, Lukas Burgholzer, Hartwig Bauer, Alexandru Paler, and Robert Wille
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ graft extern/qfr/src
1515
graft extern/qfr/include
1616
graft extern/qfr/jkq/qfr
1717
include extern/qfr/extern/dd_package/CMakeLists.txt
18-
graft extern/qfr/extern/dd_package/src
1918
graft extern/qfr/extern/dd_package/include
2019
graft extern/qfr/extern/json
2120
graft extern/qfr/extern/pybind11

apps/exact_app.cpp

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
* See file README.md or go to https://iic.jku.at/eda/research/ibm_qx_mapping/ for more information.
44
*/
55

6+
#include "exact/ExactMapper.hpp"
7+
8+
#include <boost/program_options.hpp>
69
#include <iostream>
710
#include <locale>
8-
#include <boost/program_options.hpp>
9-
10-
#include "exact/ExactMapper.hpp"
1111

1212
int main(int argc, char** argv) {
1313
namespace po = boost::program_options;
1414
po::options_description description("JKQ QMAP exact mapper by https://iic.jku.at/eda/quantum -- Options");
15+
// clang-format off
1516
description.add_options()
1617
("help,h", "produce help message")
1718
("in", po::value<std::string>()->required(), "File to read from")
@@ -22,6 +23,7 @@ int main(int argc, char** argv) {
2223
("ps", "print statistics")
2324
("verbose", "Increase verbosity and output additional information to stderr")
2425
;
26+
// clang-format on
2527
po::variables_map vm;
2628
try {
2729
po::store(po::parse_command_line(argc, argv, description), vm);
@@ -30,63 +32,62 @@ int main(int argc, char** argv) {
3032
return 0;
3133
}
3234
po::notify(vm);
33-
} catch (const po::error &e) {
35+
} catch (const po::error& e) {
3436
std::cerr << "[ERROR] " << e.what() << "! Try option '--help' for available commandline options.\n";
3537
std::exit(1);
3638
}
3739

38-
39-
const std::string circuit = vm["in"].as<std::string>();
40-
qc::QuantumComputation qc{};
41-
try {
42-
qc.import(circuit);
43-
} catch (std::exception const& e) {
44-
std::stringstream ss{};
45-
ss << "Could not import circuit: " << e.what();
46-
std::cerr << ss.str() << std::endl;
47-
std::exit(1);
48-
}
40+
const std::string circuit = vm["in"].as<std::string>();
41+
qc::QuantumComputation qc{};
42+
try {
43+
qc.import(circuit);
44+
} catch (std::exception const& e) {
45+
std::stringstream ss{};
46+
ss << "Could not import circuit: " << e.what();
47+
std::cerr << ss.str() << std::endl;
48+
std::exit(1);
49+
}
4950
const std::string cm = vm["arch"].as<std::string>();
50-
Architecture arch{};
51-
try {
52-
arch.loadCouplingMap(cm);
53-
} catch (std::exception const& e) {
54-
std::stringstream ss{};
55-
ss << "Could not import coupling map: " << e.what();
56-
std::cerr << ss.str() << std::endl;
57-
std::exit(1);
58-
}
51+
Architecture arch{};
52+
try {
53+
arch.loadCouplingMap(cm);
54+
} catch (std::exception const& e) {
55+
std::stringstream ss{};
56+
ss << "Could not import coupling map: " << e.what();
57+
std::cerr << ss.str() << std::endl;
58+
std::exit(1);
59+
}
5960

60-
if (vm.count("calibration")) {
61-
const std::string cal = vm["calibration"].as<std::string>();
62-
try {
63-
arch.loadCalibrationData(cal);
64-
} catch (std::exception const& e) {
65-
std::stringstream ss{};
66-
ss << "Could not import calibration data: " << e.what();
67-
std::cerr << ss.str() << std::endl;
68-
std::exit(1);
69-
}
70-
}
61+
if (vm.count("calibration")) {
62+
const std::string cal = vm["calibration"].as<std::string>();
63+
try {
64+
arch.loadCalibrationData(cal);
65+
} catch (std::exception const& e) {
66+
std::stringstream ss{};
67+
ss << "Could not import calibration data: " << e.what();
68+
std::cerr << ss.str() << std::endl;
69+
std::exit(1);
70+
}
71+
}
7172

72-
ExactMapper mapper(qc, arch);
73+
ExactMapper mapper(qc, arch);
7374

7475
MappingSettings ms{};
7576
ms.initialLayoutStrategy = InitialLayoutStrategy::None;
76-
if (vm.count("layering")) {
77-
std::string layering = vm["layering"].as<std::string>();
78-
if (layering == "individual") {
79-
ms.layeringStrategy = LayeringStrategy::IndividualGates;
80-
} else if (layering == "disjoint") {
81-
ms.layeringStrategy = LayeringStrategy::DisjointQubits;
82-
} else if (layering == "odd") {
83-
ms.layeringStrategy = LayeringStrategy::OddGates;
84-
} else if (layering == "triangle") {
85-
ms.layeringStrategy = LayeringStrategy::QubitTriangle;
86-
} else {
87-
ms.layeringStrategy = LayeringStrategy::None;
88-
}
89-
}
77+
if (vm.count("layering")) {
78+
std::string layering = vm["layering"].as<std::string>();
79+
if (layering == "individual") {
80+
ms.layeringStrategy = LayeringStrategy::IndividualGates;
81+
} else if (layering == "disjoint") {
82+
ms.layeringStrategy = LayeringStrategy::DisjointQubits;
83+
} else if (layering == "odd") {
84+
ms.layeringStrategy = LayeringStrategy::OddGates;
85+
} else if (layering == "triangle") {
86+
ms.layeringStrategy = LayeringStrategy::QubitTriangle;
87+
} else {
88+
ms.layeringStrategy = LayeringStrategy::None;
89+
}
90+
}
9091
ms.verbose = vm.count("verbose") > 0;
9192
mapper.map(ms);
9293

0 commit comments

Comments
 (0)