Skip to content

Commit a8b9bf6

Browse files
committed
Updated README.md and made Boost optional
- Updated README.md to be more helpful to new users (feedback welcome) - Made Boost ProgramOptions optional (now only required to build the standalone executable)
1 parent 4aca639 commit a8b9bf6

File tree

2 files changed

+66
-49
lines changed

2 files changed

+66
-49
lines changed

README.md

+56-40
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![codecov](https://codecov.io/gh/iic-jku/ddsim/branch/master/graph/badge.svg)](https://codecov.io/gh/iic-jku/ddsim)
33
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44

5-
# DDSIM - A quantum simulator based on decision diagrams written in C++
5+
# JKQ-DDSIM - A quantum simulator based on decision diagrams written in C++
66

77
A tool for quantum circuit simulation by the [Institute for Integrated Circuits](http://iic.jku.at/eda/) at the [Johannes Kepler University Linz](https://jku.at).
88

@@ -12,30 +12,53 @@ The tool builds upon [our quantum functionality representation (QFR)](https://gi
1212

1313
For more information, please visit [iic.jku.at/eda/research/quantum_simulation](http://iic.jku.at/eda/research/quantum_simulation).
1414

15-
If you have any questions, feel free to contact us via [iic_quantum@jku.at](mailto:iic_quantum@jku.at) or by creating an issue on GitHub.
15+
If you have any questions, feel free to contact us via [iic-quantum@jku.at](mailto:iic-quantum@jku.at) or by creating an [issue](https://github.com/iic-jku/ddsim/issues) on GitHub.
1616

1717
## Usage
1818

1919
This tool can be used for simulating quantum circuits provided in any of the following formats:
20-
* `Real` from [RevLib](http://revlib.org),
21-
* `OpenQASM` used by IBM's [Qiskit](https://github.com/Qiskit/qiskit) (currently, we do not support intermediate measurements!),
22-
* `GRCS` as available on https://github.com/sboixo/GRCS
20+
* `Real` from [RevLib](http://revlib.org/documentation.php)
21+
* [Our set of circuits](https://github.com/iic-jku/quantum_circuits)
22+
* [RevLib](http://revlib.org)
23+
* `OpenQASM` used by IBM's [Qiskit](https://github.com/Qiskit/qiskit)
24+
* [Our set of circuits](https://github.com/iic-jku/quantum_circuits)
25+
* [OpenQASM Repo](https://github.com/Qiskit/openqasm)
26+
* [QUEKO](https://github.com/tbcdebug/QUEKO-benchmark) (focus on mapping though)
27+
* `GRCS`
28+
* [GRCS Repo](https://github.com/sboixo/GRCS)
29+
30+
2331
The format is automatically detected through the file extension.
2432

2533

2634
The following additional algorithms are integrated in [QFR](https://github.com/iic-jku/qfr.git) and hence available in the simulator as well:
2735
* Quantum Fourier Transformation
28-
* Grover's search
36+
* Bernstein-Vazirani
37+
* GHZ / Entanglement
38+
* Grover's search (see `--help` for different call options)
2939

3040
For details on the available methods we refer to [iic.jku.at/eda/research/quantum_simulation](http://iic.jku.at/eda/research/quantum_simulation).
3141

3242
It can either be used as a **standalone executable** with command-line interface, or as a **library** for the incorporation in other projects.
3343
- The standalone executable is launched in the following way, showing available options:
3444
```commandline
35-
ddsim_simple --help
45+
$ ./ddsim_simple --help
46+
DDSIM by http://iic.jku.at/eda/ -- Allowed options:
47+
-h [ --help ] produce help message
48+
--seed arg (=0) seed for random number generator (default zero is directly used as seed!)
49+
--simulate_file arg simulate a quantum circuit given by file (detection by the file extension)
50+
--simulate_qft arg simulate Quantum Fourier Transform for given number of qubits
51+
--simulate_grover arg simulate Grover's search for given number of qubits with random oracle
52+
--simulate_grover_emulated arg simulate Grover's search for given number of qubits with random oracle and emulation
53+
--simulate_grover_oracle_emulated arg simulate Grover's search for given number of qubits with given oracle and emulation
54+
--simulate_ghz arg simulate state preparation of GHZ state for given number of qubits
55+
--shots arg (=0) number of measurements on the final quantum state
56+
--display_vector display the state vector
57+
--ps print simulation stats (applied gates, sim. time, and maximal size of the DD)
58+
--benchmark print simulation stats in a single CSV style line (overrides --ps and suppresses most other output)
3659
```
3760
38-
- The library can be used by including, for example, the```SimpleSimulator.hpp``` header file and
61+
- The library can be used by including, for example, the```QFRSimulator.hpp``` header file and
3962
```c++
4063
std::string file1 = "PATH_TO_FILE_1.EXT";
4164
qc::QuantumComputation qc1(file1);
@@ -56,31 +79,32 @@ However, the implementation should be compatible with any current C++ compiler s
5679
### Build and Run
5780
For building the library alone the CMake target `ddsim` is available, i.e.,
5881
```commandline
59-
mkdir build && cd build
60-
cmake .. -DCMAKE_BUILD_TYPE=Release
61-
cmake --build . --config Release --target ddsim
82+
$ cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
83+
$ cmake --build build --config Release --target ddsim
6284
```
6385

6486
Windows users need to configure CMake by calling
6587

66-
`cmake .. -G "Visual Studio 15 2017" -A x64 -DCMAKE_BUILD_TYPE=Release`
88+
```commandline
89+
$ cmake -G "Visual Studio 15 2017" -A x64 -DCMAKE_BUILD_TYPE=Release -S . -B build
90+
```
6791

6892
instead.
6993

7094
To build the executable simulator, build the `ddsim_simple` CMake target (which requires `boost/program_options`) and run the resulting executable with options according to your needs.
7195
The output is JSON-formatted as shown below (with hopefully intuitive naming, the `dummy` object is just for easier handling of trailing commas).
7296

7397
```commandline
74-
# (still in the build directory after building the ddsim target from above)
75-
cmake --build . --config Release --target ddsim_simple
76-
./ddsim_simple --simulate_file entanglement_4.real --display_vector --shots 1000 --ps
98+
$ cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
99+
$ cmake --build build --config Release --target ddsim_simple
100+
$ ./build/ddsim_simple --simulate_ghz 4 --display_vector --shots 1000 --ps
77101
{
78102
"measurements": {
79-
"0000": 504,
80-
"1111": 496
103+
"0000": 484,
104+
"1111": 516
81105
},
82106
"state_vector": [
83-
√½,
107+
+0.707107+0i,
84108
0,
85109
0,
86110
0,
@@ -95,37 +119,36 @@ cmake --build . --config Release --target ddsim_simple
95119
0,
96120
0,
97121
0,
98-
√½
122+
+0.707107+0i
99123
],
124+
"non_zero_entries": 2,
100125
"statistics": {
101-
"simulation_time": 0.000147604,
102-
"measurement_time": 0.000715286,
126+
"simulation_time": 0.000104,
127+
"measurement_time": 0.000104,
128+
"benchmark": "",
103129
"shots": 1000,
104-
"benchmark": "simple",
130+
"distinct_results": 2,
105131
"n_qubits": 4,
106132
"applied_gates": 4,
107133
"max_nodes": 9,
134+
"path_of_least_resistance": "1111",
108135
"seed": 0
109-
},
110-
"dummy": 0
136+
}
111137
}
112-
113-
Process finished with exit code 0
114-
115138
```
116139

117140
The repository also includes some (rudimentary) unit tests (using GoogleTest), which aim to ensure the correct behaviour of the tool. They can be built and executed in the following way:
118141
```commandline
119-
cmake --build . --config Release --target ddsim_test
120-
./ddsim_test
142+
$ cmake --build build --config Release --target ddsim_test
143+
$ ./build/ddsim_test
144+
[...]
121145
```
122146

123147
The DDSIM library and tool may be installed on the system by executing
124148

125149
```commandline
126-
mkdir build && cd build
127-
cmake .. -DCMAKE_BUILD_TYPE=Release
128-
cmake --build . --config Release --target install
150+
$ cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
151+
$ cmake --build build --config Release --target install
129152
```
130153

131154
It can then also be included in other projects using the following CMake snippet
@@ -137,16 +160,9 @@ target_link_libraries(${TARGET_NAME} PRIVATE JKQ::ddsim)
137160

138161
## Reference
139162

140-
If you use our tool for your research, we will be thankful if you refer to it by citing the following publications:
163+
If you use our tool for your research, we will be thankful if you refer to it by citing the following publication:
141164

142165
```bibtex
143-
@article{zulehner2019package,
144-
title={How to Efficiently Handle Complex Values? Implementing Decision Diagrams for Quantum Computing},
145-
author={Zulehner, Alwin and Hillmich, Stefan and Wille, Robert},
146-
journal={International Conference on Computer-Aided Design (ICCAD)},
147-
year={2019}
148-
}
149-
150166
@article{zulehner2019advanced,
151167
title = {Advanced Simulation of Quantum Computations},
152168
author = {Zulehner, Alwin and Wille, Robert},

apps/CMakeLists.txt

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
set(Boost_USE_MULTITHREADED ON)
22
set(Boost_USE_STATIC_RUNTIME OFF)
3-
find_package( Boost 1.50 COMPONENTS program_options REQUIRED )
4-
message(STATUS "Boost version: ${Boost_VERSION}")
3+
find_package( Boost 1.50 COMPONENTS program_options )
54

6-
if(NOT TARGET Boost::program_options)
7-
add_library(Boost::program_options IMPORTED INTERFACE)
8-
set_property(TARGET Boost::program_options PROPERTY
9-
INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
10-
set_property(TARGET Boost::program_options PROPERTY
11-
INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES})
5+
if(Boost_FOUND)
6+
message(STATUS "Boost version: ${Boost_VERSION}")
7+
else()
8+
message(STATUS "Boost not found. Certain targets may not be available.")
129
endif()
1310

1411
include(GNUInstallDirs)
@@ -35,5 +32,9 @@ macro(add_sim_executable APPNAME)
3532
set_target_properties(${PROJECT_NAME}_${APPNAME} PROPERTIES EXPORT_NAME ${PROJECT_NAME}_${APPNAME})
3633
endmacro()
3734

38-
add_sim_executable(simple Boost::program_options)
35+
if(Boost_FOUND)
36+
add_sim_executable(simple Boost::program_options)
37+
else()
38+
message(STATUS "Did not find Boost! Commandline interface will not be an available target!")
39+
endif()
3940
add_sim_executable(benchmark benchmark::benchmark_main)

0 commit comments

Comments
 (0)