From b2c9b9694eaae0be4946f5b60a3f7e9b1260430c Mon Sep 17 00:00:00 2001 From: rturrado <68099809+rturrado@users.noreply.github.com> Date: Fri, 22 Dec 2023 16:27:11 +0100 Subject: [PATCH] Update with changes from OpenQL/release-0.12.0 branch. --- .github/actions/cpp-tests/action.yaml | 2 +- .github/workflows/assets.yml | 28 ++++++++++----------------- .github/workflows/test.yml | 3 +-- CHANGELOG.md | 26 +++++++++++-------------- include/ql/version.h | 4 ++-- setup.py | 23 +++------------------- version.py | 22 +++++++++++++++++++++ 7 files changed, 50 insertions(+), 58 deletions(-) create mode 100644 version.py diff --git a/.github/actions/cpp-tests/action.yaml b/.github/actions/cpp-tests/action.yaml index 063f45746..a6e72ab03 100644 --- a/.github/actions/cpp-tests/action.yaml +++ b/.github/actions/cpp-tests/action.yaml @@ -32,5 +32,5 @@ runs: shell: ${{ inputs.shell }} - name: Test working-directory: build/${{ inputs.build_type }} - run: ctest -C ${{ inputs.build_type }} --output-on-failure + run: ctest -C ${{ inputs.build_type }} --output-on-failure --parallel 10 shell: ${{ inputs.shell }} diff --git a/.github/workflows/assets.yml b/.github/workflows/assets.yml index e74f76e45..fa3f004da 100644 --- a/.github/workflows/assets.yml +++ b/.github/workflows/assets.yml @@ -83,18 +83,14 @@ jobs: - name: Install dependencies run: | dnf install -y $SWIG_VERSION - python_bin="/opt/python/${{ matrix.cpython_version }}/bin/python" - ${python_bin} -m pip install --upgrade conan wheel auditwheel - pip_installation_folder=$(${python_bin} -m pip show --files conan | grep 'Location:' | sed 's/Location: //') - conan_installation_folder_relative_path=$(${python_bin} -m pip show --files conan | grep '/bin/' | sed 's#\s\+\(.*\)/conan#\1#') - conan_installation_folder="${pip_installation_folder}/${conan_installation_folder_relative_path}" - echo "Conan installation folder: ${conan_installation_folder}" - echo "${conan_installation_folder}" >> $GITHUB_PATH + export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH" + python -m pip install --upgrade conan wheel auditwheel - name: Build wheel run: | + export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH" conan remove -c "*/*" - /opt/python/${{ matrix.cpython_version }}/bin/python setup.py bdist_wheel - /opt/python/${{ matrix.cpython_version }}/bin/python -m auditwheel repair pybuild/dist/*.whl + python setup.py bdist_wheel + python -m auditwheel repair pybuild/dist/*.whl - name: Wheel path id: wheel working-directory: wheelhouse @@ -150,18 +146,14 @@ jobs: - name: Install dependencies run: | dnf install -y $BISON_VERSION $FLEX_VERSION $JAVA_VERSION $SWIG_VERSION - python_bin="/opt/python/${{ matrix.cpython_version }}/bin/python" - ${python_bin} -m pip install --upgrade pip conan wheel auditwheel - pip_installation_folder=$(${python_bin} -m pip show --files conan | grep 'Location:' | sed 's/Location: //') - conan_installation_folder_relative_path=$(${python_bin} -m pip show --files conan | grep '/bin/' | sed 's#\s\+\(.*\)/conan#\1#') - conan_installation_folder="${pip_installation_folder}/${conan_installation_folder_relative_path}" - echo "Conan installation folder: ${conan_installation_folder}" - echo "${conan_installation_folder}" >> $GITHUB_PATH + export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH" + python -m pip install --upgrade pip conan wheel auditwheel - name: Build wheel run: | + export PATH="/opt/python/${{ matrix.cpython_version }}/bin:$PATH" conan remove -c "*/*" - /opt/python/${{ matrix.cpython_version }}/bin/python setup.py bdist_wheel - /opt/python/${{ matrix.cpython_version }}/bin/python -m auditwheel repair pybuild/dist/*.whl + python setup.py bdist_wheel + python -m auditwheel repair pybuild/dist/*.whl - name: Wheel path id: wheel working-directory: wheelhouse diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5599ec2d..7c95fd073 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -83,11 +83,10 @@ jobs: # We are having problems when using the m4 and zulu-opendjk Conan packages on an armv8 architecture # m4 is required by flex/bison and zulu-openjdk provides the Java JRE required by the ANTLR generator # So, for the time being, we are installing flex/bison and java manually for this platform - - name: Install dependencies + - name: Install bison, flex and java run: | apt-get update apt-get install -y bison flex default-jre - shell: bash - uses: ./.github/actions/cpp-tests with: build_type: ${{ matrix.build_type }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 07d341a5a..af6bf6f9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,15 +3,19 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [ next ] - [ TBD ] +## [ 0.12.0 ] - [ 2023-12-18 ] ### Added -- +- Conan as package manager +- res folder for resources ### Changed -- +- different upgrades: C++23, CMake 3.12, Python 3.8 to 3.12 +- GitHub workflows and jobs +- file reorganization: docs, include, src, test ### Removed -- +- Git submodules +- CMake folder ## [ 0.11.1 ] - [ 2023-01-06 ] @@ -45,28 +49,20 @@ This project adheres to [Semantic Versioning](http://semver.org/). - classification of gates as measurement - which is used for the resource constrained scheduler, and to output a map of measurements - now based on signal definition ("signal/type" equals "measure" and "signal/value" non-empty) - classification of gates as *real-time* measurement now based on signal definition ("signal/type" equals "measure" and "signal/value" empty) - absence of key "cc" now implies empty "signal", so `"cc": { "signal": [] }` is no longer necessary -- passes and architectures self-register statically to their respective factories -<<<<<<< HEAD -- initial placer uses new IR and new MIP solver called HiGHS -======= + - passes and architectures self-register statically to their respective factories - Mapper/Router: - uses new IR in place of old IR and com::ddg in place of Scheduler - no longer assigns cycle numbers to output circuit - no longer decomposes instructions into primitives in the output circuit (it still does internally for accurate scheduling) ->>>>>>> a3e93559 (Upgrade mapper/router to new IR) ### Removed - CC backend: - support for JSON key "pragma/break" for instruction definitions - macro expansion for JSON key instruction/signal/value (unused anyway) - support for sweep points in API and the WriteSweepPointsPass -<<<<<<< HEAD -- support for Python up to and including 3.6 -======= - Mapper/Router: - Deprecated maxfidelity route heuristic - 1qfirst lookahead mode ->>>>>>> a3e93559 (Upgrade mapper/router to new IR) ### Fixed - pass dec.Instructions @@ -106,7 +102,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - improved reporting on JSON semantic errors - added check for dimension of "instruments/qubits" against "instruments/ref_control_mode/control_bits" - added check for dimension of "instructions//cc/[signals,ref_signal]/value" against "instruments/ref_control_mode/control_bits" - - added cross check of "instruments/ref_control_mode" against "instrument_definitions" + - added cross-check of "instruments/ref_control_mode" against "instrument_definitions" - added support for "pragma/break" in JSON definition to define 'gate' that breaks out of loop - added support to distribute measurement results via DSM - added support for conditional gates @@ -135,7 +131,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - CC-light code generation, as the CC-light is being phased out in the lab, and its many passes were obstacles for pass management and refactoring - rotation optimization based on matrices; matrices in general were removed entirely because no one was using it - the commute variation pass, as it has been superseded by in-place commutations within the scheduler -- the toffoli decomposition pass, as it wasn't really used; to decompose a toffoli gate, use generic platform-driven decomposition instead +- the Toffoli decomposition pass, as it wasn't really used; to decompose a Toffoli gate, use generic platform-driven decomposition instead - the defunct fidelity estimation logic from metrics.cc; this may be added again later, but requires lots of cleanup and isn't currently in use - quantumsim and qsoverlay output; apparently this was no longer being used, and it was quite intertwined with the CC-light backend diff --git a/include/ql/version.h b/include/ql/version.h index 4ed0ee689..0dc1b95ce 100644 --- a/include/ql/version.h +++ b/include/ql/version.h @@ -5,6 +5,6 @@ * - "0.8.0" = release * - "0.8.0.dev1" = development, see https://www.python.org/dev/peps/pep-0440 * - * OPENQL_VERSION_STRING is also decoded by setup.py + * OPENQL_VERSION_STRING is also decoded by version.py */ -#define OPENQL_VERSION_STRING "0.11.1" +#define OPENQL_VERSION_STRING "0.12.0" diff --git a/setup.py b/setup.py index 155d8b926..35b844b30 100755 --- a/setup.py +++ b/setup.py @@ -13,9 +13,10 @@ from distutils.command.sdist import sdist as _sdist from setuptools.command.egg_info import egg_info as _egg_info +from version import get_version + root_dir = os.getcwd() # root of the repository src_dir = root_dir + os.sep + 'src' # C++ source directory -inc_dir = root_dir + os.sep + 'include' # C++ include directory pysrc_dir = root_dir + os.sep + 'python' # Python source files target_dir = root_dir + os.sep + 'pybuild' # python-specific build directory build_dir = target_dir + os.sep + 'build' # directory for setuptools to dump various files into @@ -35,24 +36,6 @@ copy_tree(srcmod_dir, module_dir) -def get_version(verbose=0): - """ Extract version information from source code """ - - matcher = re.compile('[\t ]*#define[\t ]+OPENQL_VERSION_STRING[\t ]+"(.*)"') - version = None - with open(os.path.join(inc_dir, 'ql', 'version.h'), 'r') as f: - for ln in f: - m = matcher.match(ln) - if m: - version = m.group(1) - break - - if verbose: - print('get_version: %s' % version) - - return version - - def read(fname): with open(os.path.join(os.path.dirname(__file__), fname)) as f: return f.read() @@ -196,11 +179,11 @@ def initialize_options(self): 'Operating System :: Microsoft :: Windows', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Scientific/Engineering' ], diff --git a/version.py b/version.py new file mode 100644 index 000000000..2c5e4629c --- /dev/null +++ b/version.py @@ -0,0 +1,22 @@ +import os +import re + + +def get_version(verbose=False): + """Extract version information from source code""" + + root_dir = os.getcwd() # root of the repository + inc_dir = os.path.join(root_dir, "include", "ql") # C++ include directory + matcher = re.compile('[\t ]*#define[\t ]+OPENQL_VERSION_STRING[\t ]+"(.*)"') + version = None + with open(os.path.join(inc_dir, "version.h"), "r") as f: + for ln in f: + m = matcher.match(ln) + if m: + version = m.group(1) + break + + if verbose: + print("get_version: %s" % version) + + return version