Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.6.0 #121

Merged
merged 2 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 12 additions & 27 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,28 @@ jobs:
strategy:
matrix:
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v2
- name: Checkout with submodules
uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
brew install bison flex swig libomp
brew install bison flex swig
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH
python -m pip install --upgrade pip setuptools wheel
- name: Enable CPU compatibility mode
run: echo "QX_CPU_COMPATIBILITY_MODE=ON" >> $GITHUB_ENV
- name: Build wheel
env:
NPROCS: 5
QX_CPU_COMPATIBILITY_MODE: ON
NPROCS: 10
run: python setup.py bdist_wheel
- name: Wheel path
id: wheel
Expand All @@ -62,42 +61,29 @@ jobs:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux${{ matrix.manylinux }}_x86_64:latest
env:
FLEX_VERSION: "2.6.4"
BISON_VERSION: "3.0.4-2.el7"
SWIG_VERSION: "3.0.12-17.el7"
CMAKE_VERSION: "3.13.0"
strategy:
matrix:
manylinux:
- 2014
cpython_version:
- "cp37-cp37m"
- "cp38-cp38"
- "cp39-cp39"
- "cp310-cp310"
- "cp311-cp311"
steps:
- uses: actions/checkout@v2
- name: Checkout with submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: |
yum install -y bison-$BISON_VERSION swig3-$SWIG_VERSION
yum install -y flex bison-$BISON_VERSION swig3-$SWIG_VERSION cmake
/opt/python/${{ matrix.cpython_version }}/bin/python -m pip install auditwheel
- name: Install flex
run: |
mkdir -p $HOME/flex
curl -L https://github.com/westes/flex/releases/download/v$FLEX_VERSION/flex-$FLEX_VERSION.tar.gz | tar xz --strip-components=1 -C $HOME/flex
cd $HOME/flex
./configure
make -j
make install
- name: Install cmake
run: curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz | tar xz --strip-components=1 -C /usr
- name: Enable CPU compatibility mode
run: echo "QX_CPU_COMPATIBILITY_MODE=ON" >> $GITHUB_ENV
- name: Build wheel
env:
QX_CPU_COMPATIBILITY_MODE: ON
NPROCS: 5
run: |
/opt/python/${{ matrix.cpython_version }}/bin/python setup.py bdist_wheel
Expand Down Expand Up @@ -126,13 +112,13 @@ jobs:
strategy:
matrix:
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v2
- name: Checkout with submodules
uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
Expand All @@ -149,10 +135,9 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools wheel
choco install winflexbison3 --version 2.5.24.20210105
- name: Enable CPU compatibility mode
run: echo "QX_CPU_COMPATIBILITY_MODE=ON" >> $GITHUB_ENV
- name: Build wheel
env:
QX_CPU_COMPATIBILITY_MODE: ON
NPROCS: 5
run: python setup.py bdist_wheel
- name: Wheel path
Expand Down
147 changes: 89 additions & 58 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,98 @@ on:
pull_request:

jobs:
cpp:
name: "C++ tests"
runs-on: ${{ matrix.os }}
cpp-linux:
name: "C++ tests on Linux"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
build_type:
- Debug
- Release
compiler:
- clang++
- g++
steps:
- uses: actions/checkout@v2
- name: Checkout with submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
if: matrix.os == 'macos-latest'
- name: Create build directory
run: mkdir -p build-${{ matrix.compiler }}-${{ matrix.build_type }}
- name: Configure
working-directory: build-${{ matrix.compiler }}-${{ matrix.build_type }}
env:
CXX: ${{ matrix.compiler }}
run: cmake -S .. -B . -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DQX_BUILD_TESTS=ON
- name: Build
working-directory: build-${{ matrix.compiler }}-${{ matrix.build_type }}
env:
CXX: ${{ matrix.compiler }}
run: cmake --build . --parallel 10
- name: Test
working-directory: build-${{ matrix.compiler }}-${{ matrix.build_type }}
run: ctest --output-on-failure

cpp-macos:
name: "C++ tests on MacOS with Clang"
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
build_type:
- Debug
- Release
steps:
- name: Checkout with submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Bison and Flex
run: |
brew install bison flex
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH
- uses: actions/cache@v2
if: matrix.os == 'windows-latest'
- name: Create build directory
run: mkdir -p build-${{ matrix.build_type }}
- name: Configure
working-directory: build-${{ matrix.build_type }}
run: cmake -S .. -B . -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DQX_BUILD_TESTS=ON
- name: Build
working-directory: build-${{ matrix.build_type }}
run: cmake --build . --parallel 10
- name: Test
working-directory: build-${{ matrix.build_type }}
run: ctest --output-on-failure

cpp-windows:
name: "C++ tests on Windows"
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
build_type:
- Debug
- Release
steps:
- name: Checkout with submodules
uses: actions/checkout@v2
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
key: ${{ runner.os }}-chocolatey-cpp-0
restore-keys: |
${{ runner.os }}-chocolatey-cpp-
${{ runner.os }}-chocolatey-
- name: Install dependencies
if: matrix.os == 'windows-latest'
submodules: recursive
- name: Install Winflexbison3
shell: powershell
run: choco install winflexbison3 --version 2.5.24.20210105
- name: Create build directory
run: mkdir -p build-${{ matrix.build_type }}
- name: Configure
run: cmake . -DCMAKE_BUILD_TYPE=Debug -DQX_BUILD_TESTS=ON -DBUILD_SHARED_LIBS=OFF
working-directory: build-${{ matrix.build_type }}
run: cmake -S .. -B . -DQX_BUILD_TESTS=ON
- name: Build
run: cmake --build . --parallel 5
working-directory: build-${{ matrix.build_type }}
run: cmake --build . --parallel 10 --config ${{ matrix.build_type }}
- name: Test
run: ctest -C Debug --output-on-failure
working-directory: build-${{ matrix.build_type }}
run: ctest -C ${{ matrix.build_type }} --output-on-failure

python:
name: Python
Expand All @@ -55,58 +110,34 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
python:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v2
- name: Checkout with submodules
uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
python-version: "3.11"
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel pytest
- name: Install dependencies
- name: Install SWIG
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y swig
- name: Install dependencies
- name: Install Bison, Flex and SWIG
if: matrix.os == 'macos-latest'
run: |
brew install bison flex swig
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH
- uses: actions/cache@v2
if: matrix.os == 'windows-latest'
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
key: ${{ runner.os }}-chocolatey-python-1
restore-keys: |
${{ runner.os }}-chocolatey-python-
${{ runner.os }}-chocolatey-
- name: Install dependencies
- name: Install Winflexbison3
if: matrix.os == 'windows-latest'
shell: powershell
run: |
choco install winflexbison3 --version 2.5.24.20210105
- name: Select build type
if: matrix.os == 'windows-latest'
shell: powershell
run: |
echo "QX_BUILD_TYPE=Release" >> $GITHUB_ENV
echo "QX_CPU_COMPATIBILITY_MODE=ON" >> $GITHUB_ENV
- name: Select build type
if: matrix.os != 'windows-latest'
run: |
echo "QX_BUILD_TYPE=Debug" >> $GITHUB_ENV
echo "QX_CPU_COMPATIBILITY_MODE=ON" >> $GITHUB_ENV
- name: Build
run: choco install winflexbison3 --version 2.5.24.20210105
- name: Build the Qxelarator module
env:
NPROCS: 5
QX_CPU_COMPATIBILITY_MODE: ON
NPROCS: 10
run: python -m pip install --verbose .
- name: Test
- name: Python tests
working-directory: tests/qxelarator
run: python -m pytest
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "deps/doctest"]
path = deps/doctest
url = https://github.com/doctest/doctest.git
[submodule "deps/abseil-cpp"]
path = deps/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [ 0.6.0 ] - [ 2023-01-19 ]

Almost a complete rewrite. No functional change except it's faster.

### Added

- Ability to easily implement any quantum gate by simply giving an arbitrary unitary matrix in Gates.h
- Performance speedup using a single thread
- Some proper linear algebra primitives using template metaprogramming
- Abseil-cpp dependency for flat_hash_map
- Ability to compile the simulator with an set maximum number of qubits - in the future this will
be using templates as well to switch data structures based on the input quantum circuit

### Changed

- Quantum state is stored as a sparse array implemented using a flat_hash_map from Abseil-cpp
- C++20 in place of C++14,
- Code style: camel case

### Removed
- OpenMP and multithreading.
- SSE, AVX and other intrinsics.
- get_measurement_outcome and get_state methods. Now accessible via JSON output.

## [ 0.5.5 ] - [ 2023-01-12 ]

### Added
Expand Down
Loading