Skip to content

Commit

Permalink
Migrate to MQT Core (#253)
Browse files Browse the repository at this point in the history
* Migrate to MQT Core
- Change the submodule
- Adapt References to the previous QFR
- Remove benchmark from tests

* Fixed Manifest for python
* Use correct variable for coverage
* Remove googletest from manifest
* ⬆️ update mqt-core
* 🩹 only link to `MQT::CoreDD`
* 🩹 fix includes

---------

Co-authored-by: Lukas Burgholzer <lukas.burgholzer@jku.at>
  • Loading branch information
hillmich and burgholzer authored Jun 17, 2023
1 parent 59002d8 commit d5a0584
Show file tree
Hide file tree
Showing 18 changed files with 52 additions and 347 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Set up mold as linker
uses: rui314/setup-mold@v1
- name: Configure CMake
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=1 -DBUILD_DDSIM_TESTS=ON -DBINDINGS=ON
run: cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=1 -DBUILD_DDSIM_TESTS=ON -DBINDINGS=ON
- name: Build
run: cmake --build "${{github.workspace}}/build" --config Debug --target ddsim_test
- name: Test
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "extern/qfr"]
path = extern/qfr
url = https://github.com/cda-tum/qfr.git
[submodule "extern/mqt-core"]
path = extern/mqt-core
url = https://github.com/cda-tum/mqt-core.git
branch = main
shallow = true
[submodule "extern/taskflow"]
Expand Down
17 changes: 7 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,22 @@ macro(CHECK_SUBMODULE_PRESENT modulename)
endif()
endmacro()

check_submodule_present(qfr)
if(NOT BUILD_DDSIM_TESTS)
set(BUILD_MQT_CORE_TESTS
OFF
CACHE BOOL "")
endif()

check_submodule_present(mqt-core)
check_submodule_present(taskflow)

add_subdirectory(src)

option(BUILD_DDSIM_TESTS "Also build tests and benchmarks for DDSIM project"
OFF)
if(BUILD_DDSIM_TESTS)
check_submodule_present(qfr/extern/dd_package/extern/benchmark)

enable_testing()
include(GoogleTest)
if(NOT TARGET benchmark::benchmark_main)
set(BENCHMARK_ENABLE_TESTING
OFF
CACHE BOOL "Skip gbenchmark self tests")
add_subdirectory("extern/qfr/extern/dd_package/extern/benchmark"
EXCLUDE_FROM_ALL)
endif()
add_subdirectory(test)
endif()

Expand Down
52 changes: 26 additions & 26 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,25 @@ global-exclude *.py[cod]
global-exclude *.so

# Include relevant files from other MQT projects
include extern/qfr/CMakeLists.txt
graft extern/qfr/include
graft extern/qfr/src
graft extern/qfr/mqt/qfr
include extern/qfr/extern/dd_package/CMakeLists.txt
graft extern/qfr/extern/dd_package/include
graft extern/qfr/extern/dd_package/cmake
graft extern/qfr/extern/zx

# Include necessary files from nlohmann and pybind11 (especially don't include the docs)
graft extern/qfr/extern/json
prune extern/qfr/extern/json/docs
prune extern/qfr/extern/json/tests
prune extern/qfr/extern/json/benchmarks
prune extern/qfr/extern/json/tools
prune extern/qfr/extern/json/third_party
prune extern/qfr/extern/json/include

graft extern/qfr/extern/pybind11
prune extern/qfr/extern/pybind11/docs
prune extern/qfr/extern/pybind11/tests

graft extern/qfr/extern/pybind11_json
prune extern/qfr/extern/pybind11_json/test
include extern/mqt-core/CMakeLists.txt
graft extern/mqt-core/include
graft extern/mqt-core/src
graft extern/mqt-core/cmake

# Include necessary files submodules
graft extern/mqt-core/extern/json
prune extern/mqt-core/extern/json/benchmarks
prune extern/mqt-core/extern/json/tools
prune extern/mqt-core/extern/json/third_party
prune extern/mqt-core/extern/json/include

graft extern/mqt-core/extern/pybind11
graft extern/mqt-core/extern/pybind11_json

graft extern/mqt-core/extern/boost/config
graft extern/mqt-core/extern/boost/multiprecision

graft extern/taskflow
prune extern/taskflow/docs
prune extern/taskflow/image
prune extern/taskflow/benchmarks
prune extern/taskflow/doxygen
Expand All @@ -45,4 +37,12 @@ prune extern/taskflow/unittests
prune extern/taskflow/examples

graft extern/cxxopts
prune extern/cxxopts/test


prune **/.github
prune **/doc
prune **/docs
prune **/meta
prune **/plots
prune **/test
prune **/tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

A tool for classical quantum circuit simulation by the [Chair for Design Automation](https://www.cda.cit.tum.de/) at the [Technical University of Munich](https://www.tum.de/).
QCEC is part of the Munich Quantum Toolkit (MQT; formerly known as JKQ and developed by the [Institute for Integrated Circuits](https://iic.jku.at/eda/) at the [Johannes Kepler University Linz](https://jku.at)).
It builds upon [our quantum functionality representation (QFR)](https://github.com/cda-tum/qfr) and [our decision diagram (DD) package](https://github.com/cda-tum/dd_package.git).
It builds upon [MQT Core](https://github.com/cda-tum/mqt-core).

**Detailed documentation on all available formats, options, and algorithms is available at [ReadTheDocs](https://ddsim.readthedocs.io/en/latest/).**

Expand Down
2 changes: 1 addition & 1 deletion docs/source/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If you see the following error message ::

$ cmake -S . -B <build target directory>
CMake Error at CMakeLists.txt:27 (message):
qfr was not found. Please init/update submodules (git submodule update --init --recursive) and try again.
mqt-core was not found. Please init/update submodules (git submodule update --init --recursive) and try again.

Please run :code:`git submodule update --init --recursive` and try again.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/Installation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Installation
============

MQT DDSIM is mainly developed as a C++ library that builds upon `our decision diagram (DD) package <https://github.com/cda-tum/dd_package.git>`_ as well as `our quantum functionality representation (QFR) <https://github.com/cda-tum/qfr.git>`_.
MQT DDSIM is mainly developed as a C++ library that builds upon `MQT Core <https://github.com/cda-tum/mqt-core.git>`_.
In order to make the tool as accessible as possible, it comes with an easy-to-use Python interface.

We encourage installing DDSIM via pip (preferably in a `virtual environment <https://docs.python.org/3/library/venv.html>`_):
Expand Down
1 change: 1 addition & 0 deletions extern/mqt-core
Submodule mqt-core added at 2fe672
1 change: 0 additions & 1 deletion extern/qfr
Submodule qfr deleted from 1a889d
2 changes: 1 addition & 1 deletion include/HybridSchrodingerFeynmanSimulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#include "CircuitOptimizer.hpp"
#include "CircuitSimulator.hpp"
#include "Operations.hpp"
#include "QuantumComputation.hpp"
#include "dd/Export.hpp"
#include "dd/Operations.hpp"
#include "dd/Package.hpp"

#include <complex>
Expand Down
2 changes: 1 addition & 1 deletion include/PathSimulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "CircuitOptimizer.hpp"
#include "CircuitSimulator.hpp"
#include "Operations.hpp"
#include "dd/Operations.hpp"
#include "nlohmann/json.hpp"

#include <future>
Expand Down
2 changes: 1 addition & 1 deletion include/UnitarySimulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include "CircuitOptimizer.hpp"
#include "CircuitSimulator.hpp"
#include "Operations.hpp"
#include "QuantumComputation.hpp"
#include "dd/Operations.hpp"
#include "dd/Package.hpp"

#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion mqt/ddsim/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pybind11_add_module(py${PROJECT_NAME} bindings.cpp)
target_link_libraries(py${PROJECT_NAME} PUBLIC ${PROJECT_NAME} MQT::qfr_python)
target_link_libraries(py${PROJECT_NAME} PUBLIC ${PROJECT_NAME} MQT::CorePython)
target_compile_definitions(py${PROJECT_NAME}
PRIVATE VERSION_INFO=${DDSIM_VERSION_INFO})
4 changes: 2 additions & 2 deletions mqt/ddsim/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "HybridSchrodingerFeynmanSimulator.hpp"
#include "PathSimulator.hpp"
#include "UnitarySimulator.hpp"
#include "qiskit/QasmQobjExperiment.hpp"
#include "qiskit/QuantumCircuit.hpp"
#include "python/qiskit/QasmQobjExperiment.hpp"
#include "python/qiskit/QuantumCircuit.hpp"

#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/qfr" "extern/qfr"
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/mqt-core" "extern/mqt-core"
EXCLUDE_FROM_ALL)

add_library(
Expand Down Expand Up @@ -31,7 +31,7 @@ target_include_directories(
set(JSON_MultipleHeaders
OFF
CACHE INTERNAL "")
target_link_libraries(${PROJECT_NAME} PUBLIC MQT::qfr_dd)
target_link_libraries(${PROJECT_NAME} PUBLIC MQT::CoreDD)

set(TF_BUILD_TESTS
OFF
Expand Down
2 changes: 1 addition & 1 deletion src/CircuitSimulator.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "CircuitSimulator.hpp"

#include "CircuitOptimizer.hpp"
#include "Operations.hpp"
#include "dd/Export.hpp"
#include "dd/FunctionalityConstruction.hpp"
#include "dd/Operations.hpp"

template<class Config>
std::map<std::string, std::size_t> CircuitSimulator<Config>::simulate(std::size_t shots) {
Expand Down
32 changes: 2 additions & 30 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ if(NOT TARGET gtest OR NOT TARGET gmock)
set(gtest_force_shared_crt
ON
CACHE BOOL "" FORCE)
add_subdirectory(
"${PROJECT_SOURCE_DIR}/extern/qfr/extern/dd_package/extern/googletest"
"extern/qfr/extern/dd_package/extern/googletest" EXCLUDE_FROM_ALL)
add_subdirectory("${PROJECT_SOURCE_DIR}/extern/mqt-core/extern/googletest"
"extern/mqt-core/extern/googletest" EXCLUDE_FROM_ALL)
endif()

package_add_test(
Expand Down Expand Up @@ -38,30 +37,3 @@ add_custom_command(
${CMAKE_BINARY_DIR}/circuits
COMMENT "Copying circuits and creating symlinks for ${PROJECT_NAME}_test"
VERBATIM)

if(NOT TARGET benchmark::benchmark)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(BENCHMARK_ENABLE_TESTING
OFF
CACHE BOOL "Skip google benchmark self tests")
add_subdirectory(
"${PROJECT_SOURCE_DIR}/extern/qfr/extern/dd_package/extern/benchmark"
"extern/qfr/extern/dd_package/extern/benchmark" EXCLUDE_FROM_ALL)
endif()

add_executable(ddsim_benchmark EXCLUDE_FROM_ALL
${CMAKE_CURRENT_SOURCE_DIR}/benchmark.cpp)
target_link_libraries(ddsim_benchmark PRIVATE ${PROJECT_NAME}
benchmark::benchmark_main)
set_target_properties(ddsim_benchmark PROPERTIES EXPORT_NAME ddsim_benchmark)

add_custom_command(
TARGET ${PROJECT_NAME}_benchmark
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E create_symlink
$<TARGET_FILE_DIR:${PROJECT_NAME}_test>/${PROJECT_NAME}_benchmark
${CMAKE_BINARY_DIR}/${PROJECT_NAME}_benchmark
COMMENT "Creating symlinks for ${PROJECT_NAME}_benchmark"
VERBATIM)
Loading

1 comment on commit d5a0584

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-Linter Report ✔️

No problems need attention.

Have any feedback or feature suggestions? Share it here.

Please sign in to comment.