diff --git a/.gitignore b/.gitignore index 59b6e00e4..ec24b8187 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ +# Build files build cbuild dist openql.egg-info lab +env +# Temp files *.dot *.qc *.dat @@ -14,8 +17,9 @@ lab *.pyd *.pyc *.cache -openql/openql.py -*/test_output/* -tests/cc/test_output +swig/openql.py +swig/openql/openql.py + +# Test files +test_output .ipynb_checkpoints -doc/notebooks/test_output diff --git a/CMakeLists.txt b/CMakeLists.txt index 1830cdb93..2468d8928 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,9 +41,9 @@ SET(CLI11_INCLUDE_DIRS ## These are the include directories used by the compiler. INCLUDE_DIRECTORIES( - ${PROJECT_SOURCE_DIR} ${LEMON_INCLUDE_DIRS} ${CLI11_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/src ) IF(CMAKE_COMPILER_IS_GNUCXX) @@ -52,7 +52,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_COMPILER_IS_GNUCXX) IF(MSVC) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11 /MP /D_USE_MATH_DEFINES") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11 /MP /D_USE_MATH_DEFINES") ENDIF(MSVC) IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") @@ -60,6 +60,6 @@ IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -Wall -Wfatal-errors -Wno-unused-local-typedef -ggdb") ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") -ADD_SUBDIRECTORY(programs) +ADD_SUBDIRECTORY(examples) ADD_SUBDIRECTORY(tests) -ADD_SUBDIRECTORY(openql) +ADD_SUBDIRECTORY(swig) diff --git a/Jenkinsfile-master b/Jenkinsfile-master index 25e984a8f..3c33493ac 100644 --- a/Jenkinsfile-master +++ b/Jenkinsfile-master @@ -1,11 +1,11 @@ pipeline { agent any environment { - PERSIST_WORKSPACE = "" - } + PERSIST_WORKSPACE = "" + } stages { - stage('Checkout eQASM_Assembler'){ + stage('Checkout eQASM_Assembler') { steps { script { PERSIST_WORKSPACE = WORKSPACE @@ -15,7 +15,7 @@ pipeline { sh 'GIT_SSH_COMMAND="ssh -i /var/jenkins_home/.ssh/jenkins_eqasm_assembler_deploy" git clone git@github.com:QE-Lab/eQASM_Assembler.git' } } - stage('Checkout libqasm'){ + stage('Checkout libqasm') { steps { script { PERSIST_WORKSPACE = WORKSPACE @@ -35,10 +35,10 @@ pipeline { steps { dir(PERSIST_WORKSPACE) { sh 'pwd' - sh 'rm -Rf cbuild' + sh 'rm -rf cbuild' sh 'mkdir cbuild' sh 'cd cbuild/ && cmake .. && make' - sh 'rm -Rf env' + sh 'rm -rf env' sh 'python3 -m venv env' sh ''' . ./env/bin/activate && diff --git a/Jenkinsfile-v2.2.0 b/Jenkinsfile-v2.2.0 index 0df1fd4f8..92458a2dd 100644 --- a/Jenkinsfile-v2.2.0 +++ b/Jenkinsfile-v2.2.0 @@ -1,11 +1,11 @@ pipeline { agent any environment { - PERSIST_WORKSPACE = "" - } + PERSIST_WORKSPACE = "" + } stages { - stage('Checkout eQASM_Assembler'){ + stage('Checkout eQASM_Assembler') { steps { script { PERSIST_WORKSPACE = WORKSPACE @@ -15,7 +15,7 @@ pipeline { sh 'GIT_SSH_COMMAND="ssh -i /var/jenkins_home/.ssh/jenkins_eqasm_assembler_deploy" git clone --branch v2.2.0 git@github.com:QE-Lab/eQASM_Assembler.git' } } - stage('Checkout libqasm'){ + stage('Checkout libqasm') { steps { script { PERSIST_WORKSPACE = WORKSPACE @@ -35,10 +35,10 @@ pipeline { steps { dir(PERSIST_WORKSPACE) { sh 'pwd' - sh 'rm -Rf cbuild' + sh 'rm -rf cbuild' sh 'mkdir cbuild' sh 'cd cbuild/ && cmake .. && make' - sh 'rm -Rf env' + sh 'rm -rf env' sh 'python3 -m venv env' sh ''' . ./env/bin/activate && diff --git a/license b/LICENSE similarity index 100% rename from license rename to LICENSE diff --git a/MANIFEST.in b/MANIFEST.in index 0ea53bd6c..c3a534399 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include README.md -include programs/*.py -include tests/*.py \ No newline at end of file +include examples/*.py +include tests/*.py diff --git a/README.md b/README.md index f5e2e9b4c..b0dbb943d 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ In all the instructions below, `python` refers to `Python 3` and `pip` refers to Openql can be installed as a conda package (currently on Linux and Windows) by: -``` +```sh conda install -c imran.ashraf openql ``` @@ -58,13 +58,13 @@ conda install -c imran.ashraf openql conda packages can also be built locally by using the recipie available in `conda-recipe` directory, by running the following command: -``` +```sh conda build conda-recipe/. ``` The generated package can then be installed by: -``` +```sh conda install openql --use-local ``` @@ -73,7 +73,7 @@ conda install openql --use-local N.B. the instructions below will compile the C++ files the first time you try to install OpenQL package. If you are updating an existing installation you should first clean and recompile the C++ files using the following command. -``` +```sh python cleanme.py ``` @@ -81,19 +81,19 @@ python cleanme.py Running the following command in Terminal/Power Shell should install the openql package: -``` +```sh python setup.py install --user ``` Or -``` +```sh pip install -e . ``` By defining NPROCS=N environment variable, multiple processos can be created for faster compilation. For example, the following command will create 4 processes for compilation: -``` +```sh NPROCS=4 python setup.py install --user ``` @@ -102,13 +102,13 @@ NPROCS=4 python setup.py install --user In order to pass all the tests, `qisa-as` and `libqasm` should be installed first. Follow [qisa-as](https://github.com/QE-Lab/eQASM_Assembler) and [libqasm](https://github.com/QE-Lab/libqasm) instructions to install python interfaces of these modules. Once `qisa-as` and `libqasm` are installed, you can run all the tests by: -``` +```sh py.test -v ``` Or -``` +```sh python -m pytest ``` @@ -120,18 +120,18 @@ Existing tests and programs can be compiled by the following instructions. You c ## Linux/OSX -``` -mkdir cbuild -cd OpenQL/cbuild +```sh +mkdir cbuild +cd cbuild cmake .. # generates the make file based on CMakeLists.txt in the OpenQL directory make # compiles the source code into the current directory. ``` -To execute an example program go to e.g., `OpenQL/cbuild/programs` and execute one of the files e.g., `./simple`. The output will be saved to the output directory next to the file. +To execute an example program go to e.g., `OpenQL/cbuild/examples` and execute one of the files e.g., `./simple`. The output will be saved to the output directory next to the file. If one wants to compile and run a single file, e.g., `example.cc`, to compile it one can run : -``` +```sh mkdir output # create an output directory if it does not exist g++ -std=c++11 example.cc -o example.exe -I OpenQL/ # compile the file ./example.exe # execute the file @@ -140,25 +140,26 @@ g++ -std=c++11 example.cc -o example.exe -I OpenQL/ # compile the file ## Windows ``` -cd OpenQL/cbuild +mkdir cbuild +cd cbuild cmake -G "NMake Makefiles" .. nmake ``` ## Usage -Example C++ tests and programs can be found in 'tests' and 'programs' -directories. Executables for these will be generated in 'build/tests' and 'build/programs' +Example C++ tests and programs can be found in 'tests' and 'examples' +directories. Executables for these will be generated in 'build/tests' and 'build/examples' directory. -Example python tests and programs can be found in the 'tests' and 'programs' directories. +Example python tests and programs can be found in the 'tests' and 'examples' directories. These can be executed as 'python tests/simplePyTest.py'. # Getting started After installing OpenQL a good place to get started is by looking at the files in the "tests" directory. Here you can find commented examples on how to use OpenQL. -For instance, `programs/getting_started.py` could be a good starting point. +For instance, `examples/getting_started.py` could be a good starting point. `doc` directory as well as the Wiki page documents various aspects. N.B. gates in OpenQL are *case insensitive*. diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index fb4552fd4..1dc3eba60 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -3,7 +3,7 @@ package: version: "0.7.0" source: - # use the following path for the source if this recipie is inside the repo + # use the following path for the source if this recipe is inside the repo path: ../. # otherwise, use the following to get source diff --git a/programs/CMakeLists.txt b/examples/CMakeLists.txt similarity index 75% rename from programs/CMakeLists.txt rename to examples/CMakeLists.txt index 732b51147..a61267022 100644 --- a/programs/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,6 +1,6 @@ INCLUDE_DIRECTORIES( - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/programs + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_SOURCE_DIR}/examples ${PROJECT_SOURCE_DIR}/tests ) @@ -20,15 +20,15 @@ INCLUDE_DIRECTORIES( # TARGET_LINK_LIBRARIES(multi_qubits_randomized_benchmarking ${LEMON_LIBRARIES} ) # create output directory for test outputs -ADD_CUSTOM_TARGET(programs-output-directory ALL +ADD_CUSTOM_TARGET(examples-output-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory test_output) # copy configuration files -CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/tests/test_cfg_cbox.json - test_cfg_cbox.json COPYONLY) +CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/tests/test_cfg_cbox.json + test_cfg_cbox.json COPYONLY) -CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/tests/hardware_config_cc_light.json - hardware_config_cc_light.json COPYONLY) +CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/tests/hardware_config_cc_light.json + hardware_config_cc_light.json COPYONLY) -CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/tests/hardware_config_qx.json - hardware_config_qx.json COPYONLY) +CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/tests/hardware_config_qx.json + hardware_config_qx.json COPYONLY) diff --git a/programs/getting_started.py b/examples/getting_started.py similarity index 100% rename from programs/getting_started.py rename to examples/getting_started.py diff --git a/programs/instructions.map b/examples/instructions.map similarity index 100% rename from programs/instructions.map rename to examples/instructions.map diff --git a/programs/multi_qubits_randomized_benchmarking.cc b/examples/multi_qubits_randomized_benchmarking.cc similarity index 99% rename from programs/multi_qubits_randomized_benchmarking.cc rename to examples/multi_qubits_randomized_benchmarking.cc index 73fe5f502..b60aa6290 100644 --- a/programs/multi_qubits_randomized_benchmarking.cc +++ b/examples/multi_qubits_randomized_benchmarking.cc @@ -8,7 +8,7 @@ #include -#include +#include // clifford inverse lookup table for grounded state const size_t inv_clifford_lut_gs[] = {0, 2, 1, 3, 8, 10, 6, 11, 4, 9, 5, 7, 12, 16, 23, 21, 13, 17, 18, 19, 20, 15, 22, 14}; diff --git a/programs/randomized_benchmarking.cc b/examples/randomized_benchmarking.cc similarity index 99% rename from programs/randomized_benchmarking.cc rename to examples/randomized_benchmarking.cc index ce1be0e1b..21b24375b 100644 --- a/programs/randomized_benchmarking.cc +++ b/examples/randomized_benchmarking.cc @@ -10,7 +10,7 @@ #include -#include +#include // clifford inverse lookup table for grounded state const size_t inv_clifford_lut_gs[] = {0, 2, 1, 3, 8, 10, 6, 11, 4, 9, 5, 7, 12, 16, 23, 21, 13, 17, 18, 19, 20, 15, 22, 14}; diff --git a/programs/rb_single.cc b/examples/rb_single.cc similarity index 98% rename from programs/rb_single.cc rename to examples/rb_single.cc index e14d1215a..2837d2883 100644 --- a/programs/rb_single.cc +++ b/examples/rb_single.cc @@ -10,7 +10,7 @@ #include -#include +#include // clifford inverse lookup table for grounded state const size_t inv_clifford_lut_gs[] = {0, 2, 1, 3, 8, 10, 6, 11, 4, 9, 5, 7, 12, 16, 23, 21, 13, 17, 18, 19, 20, 15, 22, 14}; diff --git a/programs/rb_single.py b/examples/rb_single.py similarity index 100% rename from programs/rb_single.py rename to examples/rb_single.py diff --git a/programs/scaffCC/square_root.cc b/examples/scaffCC/square_root.cc similarity index 100% rename from programs/scaffCC/square_root.cc rename to examples/scaffCC/square_root.cc diff --git a/programs/simple.cc b/examples/simple.cc similarity index 98% rename from programs/simple.cc rename to examples/simple.cc index b67cdb09d..4a23dd7bb 100644 --- a/programs/simple.cc +++ b/examples/simple.cc @@ -8,7 +8,7 @@ #include -#include +#include int main(int argc, char ** argv) { diff --git a/setup.py b/setup.py index e89c5b7cd..0ca48489d 100644 --- a/setup.py +++ b/setup.py @@ -6,13 +6,13 @@ from sys import platform rootDir = os.path.dirname(os.path.realpath(__file__)) -srcDir = os.path.join(rootDir, "ql") +srcDir = os.path.join(rootDir, "src") buildDir = os.path.join(rootDir, "cbuild") -clibDir = os.path.join(buildDir, "openql") +clibDir = os.path.join(buildDir, "swig") nprocs = 1 env_var_nprocs = os.environ.get('NPROCS') -if(env_var_nprocs != None): +if (env_var_nprocs != None): nprocs = int(env_var_nprocs) print('Using {} processes for compilation'.format(nprocs)) @@ -59,11 +59,13 @@ else: print('Unknown/Unsupported OS !!!') -genclib = os.path.join(clibDir, clibname) -clib = os.path.join(rootDir, "openql", clibname) -copyfile(genclib, clib) +clib = os.path.join(clibDir, clibname) +swigDir = os.path.join(rootDir, "swig", "openql") +clibSwig = os.path.join(swigDir, clibname) + +copyfile(clib, clibSwig) copyfile(os.path.join(clibDir, "openql.py"), - os.path.join(rootDir, "openql", "openql.py")) + os.path.join(swigDir, "openql.py")) os.chdir(rootDir) @@ -117,8 +119,9 @@ def read(fname): author='Nader Khammassi and Imran Ashraf', author_email='nader.khammassi@gmail.com, iimran.aashraf@gmail.com', url='https://github.com/QE-Lab/OpenQL', - license=read('license'), + license=read('LICENSE'), packages=['openql'], + package_dir={'': 'swig'}, include_package_data=True, - package_data={'openql': [clib]}, + package_data={'openql': [clibSwig]}, zip_safe=False) diff --git a/ql/arch/cbox/allxy.cc b/src/arch/cbox/allxy.cc similarity index 93% rename from ql/arch/cbox/allxy.cc rename to src/arch/cbox/allxy.cc index ab33ceb53..e06dbca01 100644 --- a/ql/arch/cbox/allxy.cc +++ b/src/arch/cbox/allxy.cc @@ -1,7 +1,7 @@ -#include -#include -#include +#include +#include +#include #define x180(q) kernel.gate("x180",q) diff --git a/ql/arch/cbox/cbox_eqasm_compiler.cc b/src/arch/cbox/cbox_eqasm_compiler.cc similarity index 97% rename from ql/arch/cbox/cbox_eqasm_compiler.cc rename to src/arch/cbox/cbox_eqasm_compiler.cc index b9b986fa2..4ecd8f5d2 100644 --- a/ql/arch/cbox/cbox_eqasm_compiler.cc +++ b/src/arch/cbox/cbox_eqasm_compiler.cc @@ -1,8 +1,8 @@ -#include -#include -#include +#include +#include +#include diff --git a/ql/arch/cbox/cbox_eqasm_compiler.h b/src/arch/cbox/cbox_eqasm_compiler.h similarity index 99% rename from ql/arch/cbox/cbox_eqasm_compiler.h rename to src/arch/cbox/cbox_eqasm_compiler.h index 4d06f72c4..48aaf1cb6 100644 --- a/ql/arch/cbox/cbox_eqasm_compiler.h +++ b/src/arch/cbox/cbox_eqasm_compiler.h @@ -8,10 +8,10 @@ #ifndef QL_CBOX_EQASM_COMPILER_H #define QL_CBOX_EQASM_COMPILER_H -#include -#include -#include -#include +#include +#include +#include +#include // eqasm code : set of qumis instructions typedef std::vector eqasm_t; diff --git a/ql/arch/cbox/hardware_configuration_loader.cc b/src/arch/cbox/hardware_configuration_loader.cc similarity index 88% rename from ql/arch/cbox/hardware_configuration_loader.cc rename to src/arch/cbox/hardware_configuration_loader.cc index 7d17f01ca..f209e02a1 100644 --- a/ql/arch/cbox/hardware_configuration_loader.cc +++ b/src/arch/cbox/hardware_configuration_loader.cc @@ -12,9 +12,9 @@ #include -#include -#include -#include +#include +#include +#include using namespace nlohmann; diff --git a/ql/arch/cbox/instruction_scheduler.h b/src/arch/cbox/instruction_scheduler.h similarity index 99% rename from ql/arch/cbox/instruction_scheduler.h rename to src/arch/cbox/instruction_scheduler.h index 6c1b5d05d..6208be521 100644 --- a/ql/arch/cbox/instruction_scheduler.h +++ b/src/arch/cbox/instruction_scheduler.h @@ -12,7 +12,7 @@ #include #include -#include +#include namespace ql { diff --git a/ql/arch/cbox/qumis.h b/src/arch/cbox/qumis.h similarity index 99% rename from ql/arch/cbox/qumis.h rename to src/arch/cbox/qumis.h index 444d2320d..c1dc06dce 100644 --- a/ql/arch/cbox/qumis.h +++ b/src/arch/cbox/qumis.h @@ -11,7 +11,7 @@ #include #include -#include +#include namespace ql { diff --git a/ql/arch/cc/codegen_cc.h b/src/arch/cc/codegen_cc.h similarity index 100% rename from ql/arch/cc/codegen_cc.h rename to src/arch/cc/codegen_cc.h diff --git a/ql/arch/cc/eqasm_backend_cc.h b/src/arch/cc/eqasm_backend_cc.h similarity index 98% rename from ql/arch/cc/eqasm_backend_cc.h rename to src/arch/cc/eqasm_backend_cc.h index 315e26fca..b75cc949d 100644 --- a/ql/arch/cc/eqasm_backend_cc.h +++ b/src/arch/cc/eqasm_backend_cc.h @@ -11,13 +11,13 @@ #define OPT_CC_SCHEDULE_RC 0 // 1=use resource constraint scheduler -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #if OPT_CC_SCHEDULE_RC - #include + #include #endif #include "codegen_cc.h" diff --git a/ql/arch/cc_light/cc_light_eqasm.cc b/src/arch/cc_light/cc_light_eqasm.cc similarity index 95% rename from ql/arch/cc_light/cc_light_eqasm.cc rename to src/arch/cc_light/cc_light_eqasm.cc index 4d8a26cc7..5c32ef440 100644 --- a/ql/arch/cc_light/cc_light_eqasm.cc +++ b/src/arch/cc_light/cc_light_eqasm.cc @@ -1,9 +1,9 @@ -#include +#include -#include -// #include +#include +// #include typedef ql::arch::cc_light_eqasm_instruction ccl_instr; diff --git a/ql/arch/cc_light/cc_light_eqasm.h b/src/arch/cc_light/cc_light_eqasm.h similarity index 100% rename from ql/arch/cc_light/cc_light_eqasm.h rename to src/arch/cc_light/cc_light_eqasm.h diff --git a/ql/arch/cc_light/cc_light_eqasm_compiler.h b/src/arch/cc_light/cc_light_eqasm_compiler.h similarity index 99% rename from ql/arch/cc_light/cc_light_eqasm_compiler.h rename to src/arch/cc_light/cc_light_eqasm_compiler.h index 78b46daf2..5692d80ab 100644 --- a/ql/arch/cc_light/cc_light_eqasm_compiler.h +++ b/src/arch/cc_light/cc_light_eqasm_compiler.h @@ -9,14 +9,14 @@ #ifndef QL_CC_LIGHT_EQASM_COMPILER_H #define QL_CC_LIGHT_EQASM_COMPILER_H -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include // eqasm code : set of cc_light_eqasm instructions typedef std::vector eqasm_t; diff --git a/ql/arch/cc_light/cc_light_resource_manager.h b/src/arch/cc_light/cc_light_resource_manager.h similarity index 99% rename from ql/arch/cc_light/cc_light_resource_manager.h rename to src/arch/cc_light/cc_light_resource_manager.h index 9ae978b8f..6cc482d58 100644 --- a/ql/arch/cc_light/cc_light_resource_manager.h +++ b/src/arch/cc_light/cc_light_resource_manager.h @@ -13,8 +13,8 @@ #include #include #include -#include -#include +#include +#include using json = nlohmann::json; diff --git a/ql/arch/cc_light/cc_light_scheduler.h b/src/arch/cc_light/cc_light_scheduler.h similarity index 97% rename from ql/arch/cc_light/cc_light_scheduler.h rename to src/arch/cc_light/cc_light_scheduler.h index dcf899a02..f1e4d0579 100644 --- a/ql/arch/cc_light/cc_light_scheduler.h +++ b/src/arch/cc_light/cc_light_scheduler.h @@ -14,12 +14,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/ql/arch/quantumsim_eqasm_compiler.h b/src/arch/quantumsim_eqasm_compiler.h similarity index 98% rename from ql/arch/quantumsim_eqasm_compiler.h rename to src/arch/quantumsim_eqasm_compiler.h index 7bfa53a62..d88915211 100644 --- a/ql/arch/quantumsim_eqasm_compiler.h +++ b/src/arch/quantumsim_eqasm_compiler.h @@ -8,11 +8,11 @@ #ifndef QL_QUANTUMSIM_EQASM_COMPILER_H #define QL_QUANTUMSIM_EQASM_COMPILER_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace ql { diff --git a/ql/arch/spin_demo_2811.json b/src/arch/spin_demo_2811.json similarity index 100% rename from ql/arch/spin_demo_2811.json rename to src/arch/spin_demo_2811.json diff --git a/ql/attic/transmon.h b/src/attic/transmon.h similarity index 100% rename from ql/attic/transmon.h rename to src/attic/transmon.h diff --git a/ql/circuit.h b/src/circuit.h similarity index 100% rename from ql/circuit.h rename to src/circuit.h diff --git a/ql/classical.h b/src/classical.h similarity index 98% rename from ql/classical.h rename to src/classical.h index 859a88b69..7183926e7 100644 --- a/ql/classical.h +++ b/src/classical.h @@ -17,10 +17,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace ql diff --git a/ql/eqasm_compiler.h b/src/eqasm_compiler.h similarity index 96% rename from ql/eqasm_compiler.h rename to src/eqasm_compiler.h index bbe1f331d..bb11b43aa 100644 --- a/ql/eqasm_compiler.h +++ b/src/eqasm_compiler.h @@ -12,9 +12,9 @@ #include -#include -#include -#include +#include +#include +#include typedef std::vector eqasm_t; diff --git a/ql/exception.cc b/src/exception.cc similarity index 100% rename from ql/exception.cc rename to src/exception.cc diff --git a/ql/exception.h b/src/exception.h similarity index 100% rename from ql/exception.h rename to src/exception.h diff --git a/ql/gate.h b/src/gate.h similarity index 99% rename from ql/gate.h rename to src/gate.h index d4e74e6fc..a1027450d 100644 --- a/ql/gate.h +++ b/src/gate.h @@ -19,11 +19,11 @@ #include #include -#include -#include +#include +#include -#include -#include +#include +#include using json = nlohmann::json; diff --git a/ql/hardware_configuration.h b/src/hardware_configuration.h similarity index 99% rename from ql/hardware_configuration.h rename to src/hardware_configuration.h index 572262736..f871e0998 100644 --- a/ql/hardware_configuration.h +++ b/src/hardware_configuration.h @@ -18,10 +18,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include namespace ql { diff --git a/ql/instruction_map.h b/src/instruction_map.h similarity index 100% rename from ql/instruction_map.h rename to src/instruction_map.h diff --git a/ql/interactionMatrix.h b/src/interactionMatrix.h similarity index 100% rename from ql/interactionMatrix.h rename to src/interactionMatrix.h diff --git a/ql/ir.h b/src/ir.h similarity index 100% rename from ql/ir.h rename to src/ir.h diff --git a/ql/json.h b/src/json.h similarity index 100% rename from ql/json.h rename to src/json.h diff --git a/ql/kernel.h b/src/kernel.h similarity index 99% rename from ql/kernel.h rename to src/kernel.h index ff5e6f8c6..76c5e29b7 100644 --- a/ql/kernel.h +++ b/src/kernel.h @@ -13,13 +13,13 @@ #include #include -#include "ql/json.h" -#include "ql/utils.h" -#include "ql/options.h" -#include "ql/gate.h" -#include "ql/classical.h" -#include "ql/optimizer.h" -#include "ql/ir.h" +#include "json.h" +#include "utils.h" +#include "options.h" +#include "gate.h" +#include "classical.h" +#include "optimizer.h" +#include "ir.h" #define PI M_PI diff --git a/ql/matrix.h b/src/matrix.h similarity index 100% rename from ql/matrix.h rename to src/matrix.h diff --git a/ql/openql.h b/src/openql.h similarity index 100% rename from ql/openql.h rename to src/openql.h diff --git a/ql/optimizer.h b/src/optimizer.h similarity index 100% rename from ql/optimizer.h rename to src/optimizer.h diff --git a/ql/options.h b/src/options.h similarity index 99% rename from ql/options.h rename to src/options.h index 8ff7992a4..5494d7911 100644 --- a/ql/options.h +++ b/src/options.h @@ -8,7 +8,7 @@ #ifndef QL_OPTIONS_H #define QL_OPTIONS_H -#include +#include #include #include diff --git a/ql/platform.h b/src/platform.h similarity index 98% rename from ql/platform.h rename to src/platform.h index d94dea461..b17b209f6 100644 --- a/ql/platform.h +++ b/src/platform.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include namespace ql { diff --git a/ql/program.h b/src/program.h similarity index 98% rename from ql/program.h rename to src/program.h index 77a5fe3c0..9695dfde5 100644 --- a/ql/program.h +++ b/src/program.h @@ -9,16 +9,16 @@ #ifndef QL_PROGRAM_H #define QL_PROGRAM_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static unsigned long phi_node_count = 0; diff --git a/ql/qasm_loader.cc b/src/qasm_loader.cc similarity index 94% rename from ql/qasm_loader.cc rename to src/qasm_loader.cc index 6f2cef69e..0c5728a77 100644 --- a/ql/qasm_loader.cc +++ b/src/qasm_loader.cc @@ -6,7 +6,7 @@ */ -#include +#include /** diff --git a/ql/resource_manager.h b/src/resource_manager.h similarity index 100% rename from ql/resource_manager.h rename to src/resource_manager.h diff --git a/ql/scheduler.h b/src/scheduler.h similarity index 99% rename from ql/scheduler.h rename to src/scheduler.h index 9bc3ac1b6..b7a9cc130 100644 --- a/ql/scheduler.h +++ b/src/scheduler.h @@ -66,11 +66,11 @@ #include #include -#include "ql/utils.h" -#include "ql/gate.h" -#include "ql/circuit.h" -#include "ql/ir.h" -#include "ql/resource_manager.h" +#include "utils.h" +#include "gate.h" +#include "circuit.h" +#include "ir.h" +#include "resource_manager.h" using namespace std; using namespace lemon; diff --git a/ql/str.h b/src/str.h similarity index 100% rename from ql/str.h rename to src/str.h diff --git a/ql/utils.h b/src/utils.h similarity index 100% rename from ql/utils.h rename to src/utils.h diff --git a/ql/version.h b/src/version.h similarity index 100% rename from ql/version.h rename to src/version.h diff --git a/openql/CMakeLists.txt b/swig/CMakeLists.txt similarity index 97% rename from openql/CMakeLists.txt rename to swig/CMakeLists.txt index 25e7a99cf..ff5386b55 100644 --- a/openql/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -3,10 +3,10 @@ INCLUDE(${SWIG_USE_FILE}) FIND_PACKAGE(PythonLibs) INCLUDE_DIRECTORIES( - ${PROJECT_SOURCE_DIR} ${PYTHON_INCLUDE_PATH} - ${CMAKE_CURRENT_SOURCE_DIR} ${LEMON_INCLUDE_DIRS} + ${CMAKE_CURRENT_SOURCE_DIR} + ${PROJECT_SOURCE_DIR}/src ) # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -Wall -Wfatal-errors") diff --git a/openql/openql.i b/swig/openql.i similarity index 99% rename from openql/openql.i rename to swig/openql.i index 561b34171..9826dc598 100644 --- a/openql/openql.i +++ b/swig/openql.i @@ -21,7 +21,7 @@ namespace std { }; %{ -#include "openql.h" +#include "openql_i.h" %} @@ -42,7 +42,7 @@ def set_output_dir(path): %exception { -try + try { $action if (PyErr_Occurred()) SWIG_fail; @@ -87,8 +87,6 @@ str 'scheduler_commute' : 'no' : 'yes/no' 'scheduler_post179' : 'yes' : 'yes/no' 'cz_mode' : 'manual' : 'auto/manual' - - Parameters ---------- @@ -764,4 +762,4 @@ str // Include the header file with above prototypes -%include "openql.h" +%include "openql_i.h" diff --git a/openql/__init__.py b/swig/openql/__init__.py similarity index 100% rename from openql/__init__.py rename to swig/openql/__init__.py diff --git a/openql/openql.h b/swig/openql_i.h similarity index 99% rename from openql/openql.h rename to swig/openql_i.h index 180be6c70..2472cfb94 100644 --- a/openql/openql.h +++ b/swig/openql_i.h @@ -15,9 +15,9 @@ #include #include -#include -#include -#include +#include +#include +#include static std::string get_version() { diff --git a/openql/quick_feature_test.cc b/swig/quick_feature_test.cc similarity index 98% rename from openql/quick_feature_test.cc rename to swig/quick_feature_test.cc index 853811d60..2e91f3688 100644 --- a/openql/quick_feature_test.cc +++ b/swig/quick_feature_test.cc @@ -11,7 +11,7 @@ // enable optimizations // #define ql_optimize -#include +#include int main(int argc, char ** argv) { diff --git a/openql/quick_feature_test.makefile b/swig/quick_feature_test.makefile similarity index 100% rename from openql/quick_feature_test.makefile rename to swig/quick_feature_test.makefile diff --git a/openql/quick_feature_test.py b/swig/quick_feature_test.py similarity index 100% rename from openql/quick_feature_test.py rename to swig/quick_feature_test.py diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 130b791d2..6063c027b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,6 @@ INCLUDE_DIRECTORIES( - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/programs + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_SOURCE_DIR}/examples ${PROJECT_SOURCE_DIR}/tests ) diff --git a/tests/cc/test_cc.cc b/tests/cc/test_cc.cc index 77648aa3b..f1b12e384 100644 --- a/tests/cc/test_cc.cc +++ b/tests/cc/test_cc.cc @@ -15,9 +15,8 @@ #include -#include "ql/openql.h" -#include "ql/utils.h" - +#include +#include #define CFG_FILE_JSON "test_cfg_cc.json" diff --git a/tests/program_test.cc b/tests/program_test.cc index c82bda1ac..3cdc64d8f 100644 --- a/tests/program_test.cc +++ b/tests/program_test.cc @@ -8,7 +8,7 @@ #include -#include +#include int main(int argc, char ** argv) { diff --git a/tests/test_179.cc b/tests/test_179.cc index c21b84c58..f788608f5 100644 --- a/tests/test_179.cc +++ b/tests/test_179.cc @@ -8,7 +8,7 @@ #include -#include +#include // all tests below should be run with scheduler_post179 yes and no