Skip to content

Commit

Permalink
Merge branch 'master' into u/dthor/bazelisk
Browse files Browse the repository at this point in the history
  • Loading branch information
dougthor42 authored Sep 16, 2024
2 parents 6296de3 + c4eab57 commit 01cb1aa
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 46 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/bazeltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# Run tests with Bazel v5.3.0.
test:
name: Test with Bazel
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
# Hardware optimizers.
Expand All @@ -21,7 +21,7 @@ jobs:
parallel_opt: [openmp,nopenmp]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: bazel-contrib/[email protected]
with:
bazelisk-cache: true
Expand All @@ -45,14 +45,14 @@ jobs:
test-san:
name: Sanitizer tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
# Test sanitizers
sanitizer_opt: [msan,asan]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: bazel-contrib/[email protected]
with:
bazelisk-cache: true
Expand All @@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: bazel-contrib/[email protected]
with:
bazelisk-cache: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/cirq_compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:
jobs:
consistency:
name: Nightly Compatibility
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.7'
python-version: '3.10'
architecture: 'x64'
- name: Install Cirq nightly
run: pip3 install -U cirq --pre
run: pip3 install --upgrade cirq~=1.0.dev
- name: Install qsim requirements
run: pip3 install -r requirements.txt
- name: Install test requirements
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dockertest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Build Docker images
run: docker-compose build
run: docker compose build
- name: Run C++ tests
run: docker run --rm qsim-cxx-tests:latest
- name: Run Python tests
Expand All @@ -34,4 +34,4 @@ jobs:
- name: Test install process
run: |
cd install/tests
docker-compose up --build
docker compose up --build
6 changes: 3 additions & 3 deletions .github/workflows/python_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
name: Format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3.7'
python-version: '3.10'
architecture: 'x64'
- name: Install dev requirements
run: pip install -r dev-requirements.txt
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/release_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,51 @@ jobs:
include:
- os: macos-12 # x86_64
name: mac
env:
macosx_deployment_target: "12.0"
cibw:
build: "cp37* cp38* cp39* cp310* cp311* cp312*"
build: "cp39* cp310* cp311* cp312*"
- os: macos-13-large # Apple Silicon
name: mac_arm64
env:
macosx_deployment_target: "13.0"
cibw:
build: "cp37* cp38* cp39* cp310* cp311* cp312*"
- os: ubuntu-20.04
build: "cp39* cp310* cp311* cp312*"
- os: ubuntu-22.04
name: manylinux2014
cibw:
arch: x86_64
build: "cp37* cp38* cp39* cp310* cp311* cp312*"
build: "cp39* cp310* cp311* cp312*"
manylinux_image: manylinux2014
- os: windows-2019
name: win_amd64
architecture: x64
cibw:
build: "cp37-win_amd64 cp38-win_amd64 cp39-win_amd64 cp310-win_amd64 cp311-win_amd64 cp312-win_amd64"
build: "cp39-win_amd64 cp310-win_amd64 cp311-win_amd64 cp312-win_amd64"
env:
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.env.macosx_deployment_target }}"
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_MANYLINUX_X86_64_IMAGE: "${{ matrix.cibw.manylinux_image }}"
CIBW_BEFORE_BUILD_MACOS: "brew install libomp llvm && brew link --overwrite [email protected] && brew link --force libomp"
CIBW_BEFORE_BUILD_MACOS: "brew install libomp llvm@12 && brew link --overwrite [email protected] && brew link --force libomp"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-listdeps {wheel} && delocate-wheel --verbose --require-archs {delocate_archs} -w {dest_dir} {wheel}"
# to install latest delocate package
CIBW_DEPENDENCY_VERSIONS: "latest"
# due to package and module name conflict have to temporarily move it away to run tests
CIBW_BEFORE_TEST: mv {package}/qsimcirq /tmp
CIBW_BEFORE_TEST: "mv {package}/qsimcirq /tmp"
CIBW_TEST_EXTRAS: "dev"
CIBW_TEST_COMMAND: "pytest {package}/qsimcirq_tests/qsimcirq_test.py && mv /tmp/qsimcirq {package}"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Used to host cibuildwheel
- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install cibuildwheel and twine
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.20.0

- name: Install requirements
run: python -m pip install -r requirements.txt
Expand All @@ -64,20 +69,21 @@ jobs:
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: python-wheels
name: python-wheels-${{ matrix.name }}
path: ./wheelhouse/*.whl
release-wheels:
name: Publish all wheels
needs: [build_wheels]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: python-wheels
path: dist/
pattern: python-wheels-*
merge-multiple: true
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/testing_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,34 @@ jobs:
include:
- os: macos-12 # x86_64
name: mac
env:
macosx_deployment_target: "12.0"
cibw:
build: "cp37* cp38* cp39* cp310* cp311* cp312*"
build: "cp39* cp310* cp311* cp312*"
- os: macos-13-large # Apple Silicon
name: mac_arm64
env:
macosx_deployment_target: "13.0"
cibw:
build: "cp37* cp38* cp39* cp310* cp311* cp312*"
- os: ubuntu-20.04
build: "cp39* cp310* cp311* cp312*"
- os: ubuntu-22.04
name: manylinux2014
cibw:
arch: x86_64
build: "cp37* cp38* cp39* cp310* cp311* cp312*"
build: "cp39* cp310* cp311* cp312*"
manylinux_image: manylinux2014
- os: windows-2019
name: win_amd64
architecture: x64
cibw:
build: "cp37-win_amd64 cp38-win_amd64 cp39-win_amd64 cp310-win_amd64 cp311-win_amd64 cp312-win_amd64"
build: "cp39-win_amd64 cp310-win_amd64 cp311-win_amd64 cp312-win_amd64"
env:
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.env.macosx_deployment_target }}"
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: "${{ matrix.cibw.arch || 'auto' }}"
CIBW_MANYLINUX_X86_64_IMAGE: "${{ matrix.cibw.manylinux_image }}"
CIBW_BEFORE_BUILD_MACOS: "brew install libomp llvm && brew link --overwrite [email protected] && brew link --force libomp"
CIBW_BEFORE_BUILD_MACOS: "brew install libomp llvm@12 && brew link --overwrite [email protected] && brew link --force libomp"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "delocate-listdeps {wheel} && delocate-wheel --verbose --require-archs {delocate_archs} -w {dest_dir} {wheel}"
# to install latest delocate package
CIBW_DEPENDENCY_VERSIONS: "latest"
Expand All @@ -50,15 +55,15 @@ jobs:
CIBW_TEST_EXTRAS: "dev"
CIBW_TEST_COMMAND: "pytest {package}/qsimcirq_tests/qsimcirq_test.py && mv /tmp/qsimcirq {package}"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

# Used to host cibuildwheel
- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install cibuildwheel and twine
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.20.0

- name: Install requirements
run: python -m pip install -r requirements.txt
Expand All @@ -69,8 +74,7 @@ jobs:
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: python-wheels
name: python-wheels-${{ matrix.name }}
path: ./wheelhouse/*.whl

6 changes: 3 additions & 3 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ git submodule update --init --recursive
To build qsim and run all the tests:

```
# docker-compose up --build
# docker compose up --build
```

`docker-compose` will create the `qsim`, `qsim-cxx-tests`, and `qsim-py-tests`
`docker compose` will create the `qsim`, `qsim-cxx-tests`, and `qsim-py-tests`
images and automatically run all tests. A successful run should have the
following messages somewhere in the logs:

Expand All @@ -34,7 +34,7 @@ qsim-py-tests exited with code 0
To build without running tests, simply run:

```
# docker-compose build
# docker compose build
```

## Run Simulations
Expand Down
2 changes: 1 addition & 1 deletion tests/mps_simulator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ TEST(MPSSimulator, Apply1InteriorArbitrary) {
ASSERT_NEAR(state.get()[l_offset + 56], -11.8, 1e-5);
ASSERT_NEAR(state.get()[l_offset + 57], 138, 1e-5);
ASSERT_NEAR(state.get()[l_offset + 58], -12.2, 1e-5);
ASSERT_NEAR(state.get()[l_offset + 59], 143.2, 1e-5);
ASSERT_NEAR(state.get()[l_offset + 59], 143.2, 2e-5);
ASSERT_NEAR(state.get()[l_offset + 60], -12.6, 1e-5);
ASSERT_NEAR(state.get()[l_offset + 61], 148.4, 1e-5);
ASSERT_NEAR(state.get()[l_offset + 62], -13, 1e-5);
Expand Down

0 comments on commit 01cb1aa

Please sign in to comment.