Skip to content

Add initial det/obs support to crumble, plus other polish #1768

Add initial det/obs support to crumble, plus other polish

Add initial det/obs support to crumble, plus other polish #1768

Workflow file for this run

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: ci
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
build_dist:
runs-on: ${{ matrix.os_dist.os }}
strategy:
fail-fast: false
matrix:
os_dist: [
{os: ubuntu-latest, dist: cp36-manylinux_x86_64},
{os: ubuntu-latest, dist: cp37-manylinux_x86_64},
{os: ubuntu-latest, dist: cp38-manylinux_x86_64},
{os: ubuntu-latest, dist: cp39-manylinux_x86_64},
{os: ubuntu-latest, dist: cp310-manylinux_x86_64},
{os: ubuntu-latest, dist: cp311-manylinux_x86_64},
{os: ubuntu-latest, dist: cp312-manylinux_x86_64},
{os: ubuntu-latest, dist: cp36-manylinux_i686},
{os: ubuntu-latest, dist: cp37-manylinux_i686},
# cp38-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
# {os: ubuntu-latest, dist: cp38-manylinux_i686},
# cp39-manylinux_i686 disabled because pandas isn't prebuilt and takes 20 minutes to build.
# {os: ubuntu-latest, dist: cp39-manylinux_i686},
# cp310-manylinux_i686 disabled because scipy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
# libraries found. To build Scipy from sources, BLAS & LAPACK
# libraries need to be installed.
#
#{os: ubuntu-latest, dist: cp310-manylinux_i686},
# pypy manylinux builds disabled because scipy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
# libraries found. To build Scipy from sources, BLAS & LAPACK
# libraries need to be installed.
#
# {os: ubuntu-latest, dist: pp37-manylinux_x86_64},
# {os: ubuntu-latest, dist: pp38-manylinux_x86_64},
# {os: ubuntu-latest, dist: pp39-manylinux_x86_64},
# {os: ubuntu-latest, dist: pp37-manylinux_i686},
# {os: ubuntu-latest, dist: pp38-manylinux_i686},
# {os: ubuntu-latest, dist: pp39-manylinux_i686},
# musllinux builds disabled because scipy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK
# libraries found. To build Scipy from sources, BLAS & LAPACK
# libraries need to be installed.
#
# {os: ubuntu-latest, dist: cp36-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp37-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp38-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp39-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp310-musllinux_x86_64},
# {os: ubuntu-latest, dist: cp36-musllinux_i686},
# {os: ubuntu-latest, dist: cp37-musllinux_i686},
# {os: ubuntu-latest, dist: cp38-musllinux_i686},
# {os: ubuntu-latest, dist: cp39-musllinux_i686},
# {os: ubuntu-latest, dist: cp310-musllinux_i686},
{os: macos-latest, dist: cp36-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp37-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp38-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp39-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp310-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp311-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp312-macosx_x86_64, macosarch: x86_64},
{os: macos-latest, dist: cp38-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp39-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp310-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp311-macosx_arm64, macosarch: arm64},
{os: macos-latest, dist: cp312-macosx_arm64, macosarch: arm64},
# pypy OSX builds disabled because numpy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# RuntimeError: Found /usr/lib/libcblas.dylib, but that file is a
# symbolic link to the MacOS Accelerate framework, which is not
# supported by NumPy. You must configure the build to use a
# different optimized library, or disable the use of optimized
# BLAS and LAPACK by setting the environment variables
# NPY_BLAS_ORDER="" and NPY_LAPACK_ORDER="" before building NumPy.
#
# {os: macOS-10.15, dist: pp37-macosx_x86_64},
# {os: macOS-10.15, dist: pp38-macosx_x86_64},
# {os: macOS-10.15, dist: pp39-macosx_x86_64},
{os: windows-2019, dist: cp36-win_amd64},
{os: windows-2019, dist: cp37-win_amd64},
{os: windows-2019, dist: cp38-win_amd64},
{os: windows-2019, dist: cp39-win_amd64},
{os: windows-2019, dist: cp310-win_amd64},
{os: windows-2019, dist: cp311-win_amd64},
{os: windows-2019, dist: cp312-win_amd64},
{os: windows-2019, dist: cp36-win32},
{os: windows-2019, dist: cp37-win32},
# cp38-win32 and cp39-win32 disabled because scipy fails to build.
#
# The actual error seen in github actions:
#
# Need python for 64-bit, but found 32-bit
# ..\..\meson.build:82:0: ERROR: Python dependency not found
#
#{os: windows-2019, dist: cp38-win32},
#{os: windows-2019, dist: cp39-win32},
# cp310-win32 disabled because numpy isn't prebuilt and fails to build.
#
# The actual error seen in github actions:
#
# CCompiler_spawn() got an unexpected keyword argument 'env'
#
# {os: windows-2019, dist: cp310-win32},
]
env:
CIBW_BUILD: "${{ matrix.os_dist.dist }}"
CIBW_ARCHS_MACOS: "${{ matrix.os_dist.macosarch }}"
CIBW_TEST_REQUIRES: cirq-core pytest
CIBW_TEST_COMMAND: pytest {project}/src {project}/glue/cirq && stim help
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python dev/overwrite_dev_versions_with_date.py
- run: mkdir -p output/stim
- run: mkdir -p output/stimcirq
- run: mkdir -p output/sinter
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.16.2 setuptools wheel
- run: python -m cibuildwheel --print-build-identifiers
- run: python -m cibuildwheel --output-dir output/stim
- run: python setup.py sdist
- run: cd glue/cirq && python setup.py sdist
- run: cd glue/sample && python setup.py sdist
- run: mv dist/* output/stim
- run: mv glue/cirq/dist/* output/stimcirq
- run: mv glue/sample/dist/* output/sinter
- uses: actions/upload-artifact@v3
with:
name: dist
path: |
./output/stimcirq/*.tar.gz
./output/sinter/*.tar.gz
./output/stim/*
check_sdist_installs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- run: python -m pip install pybind11~=2.11.1 cibuildwheel~=2.16.2 setuptools wheel
- run: python setup.py sdist
- run: pip install dist/*.tar.gz
upload_dev_release_to_pypi:
needs: ["build_dist"]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
packages_dir: dist/stim/
password: ${{ secrets.pypi_token_stim }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
packages_dir: dist/stimcirq/
password: ${{ secrets.pypi_token_stimcirq }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
packages_dir: dist/sinter/
password: ${{ secrets.pypi_token_sinter }}
run_main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make stim -j 2
- run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | out/stim --sample
build_bazel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :all
- run: bazel test :stim_test
build_clang:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64
- run: cmake . -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++
- run: cmake --build .
build_lib:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: cmake .
- run: make libstim -j 2
- run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc
- run: g++ -std=c++20 test.cc out/libstim.a -I src
- run: ./a.out test
build_lib_install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: mkdir install_dir
- run: cmake . -DCMAKE_INSTALL_PREFIX=install_dir
- run: make -j 2
- run: make install
- run: echo -e '#include "stim.h"\nint main(int argc,const char **argv) {return !stim::find_bool_argument("test", argc, argv);}' > test.cc
- run: g++ -std=c++20 test.cc install_dir/lib/libstim.a -I install_dir/include
- run: ./a.out test
- run: echo -e "H 0 \n CNOT 0 1 \n M 0 1" | install_dir/bin/stim --sample
benchmark_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: microsoft/[email protected]
- run: cmake .
- run: MSBuild.exe stim_perf.vcxproj /p:Configuration=Release /p:OutDir=msbuild_out /p:O=2
- run: msbuild_out/stim_perf.exe
benchmark:
runs-on: ubuntu-latest
strategy:
matrix:
simd_width: [64, 128, 256]
steps:
- uses: actions/checkout@v1
- run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }}
- run: make stim_perf -j 2
- run: out/stim_perf
test:
runs-on: ubuntu-latest
strategy:
matrix:
simd_width: [64, 128, 256]
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- run: cmake . -DSIMD_WIDTH=${{ matrix.simd_width }}
- run: make stim_test -j 2
- run: out/stim_test
test_o3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
cd ..
git clone https://github.com/google/googletest.git -b release-1.12.1
mkdir googletest/build && cd googletest/build
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
- run: cmake . -DSIMD_WIDTH=256
- run: make stim_test_o3 -j 2
- run: out/stim_test_o3
test_generated_docs_are_fresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: diff <(python dev/gen_stim_api_reference.py -dev) doc/python_api_reference_vDev.md
- run: diff <(python dev/gen_stim_stub_file.py -dev) glue/python/src/stim/__init__.pyi
- run: diff <(python dev/gen_stim_stub_file.py -dev) doc/stim.pyi
- run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'gates_markdown'])") doc/gates.md
- run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'formats_markdown'])") doc/result_formats.md
- run: diff <(python -c "import stim; stim.main(command_line_args=['help', 'commands_markdown'])") doc/usage_command_line.md
- run: diff <(dev/gen_known_gates_for_js.sh) glue/crumble/test/generated_gate_name_list.test.js
- run: python doc/stim.pyi
- run: npm install -g [email protected] [email protected]
- run: diff <(dev/regen_crumble_to_cpp_string_write_to_stdout.sh) src/stim/diagram/crumble_data.cc
- run: pip install -e glue/sample
- run: diff <(python dev/gen_sinter_api_reference.py -dev) doc/sinter_api.md
test_generated_file_lists_are_fresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: dev/regen_file_lists.sh /tmp
- run: diff /tmp/perf_files file_lists/perf_files
- run: diff /tmp/pybind_files file_lists/pybind_files
- run: diff /tmp/source_files_no_main file_lists/source_files_no_main
- run: diff /tmp/test_files file_lists/test_files
test_pybind:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install pytest
- run: pytest src
- run: dev/doctest_proper.py --module stim
test_stimcirq:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install -e glue/cirq
- run: pip install pytest
- run: pytest glue/cirq
- run: dev/doctest_proper.py --module stimcirq --import cirq sympy
test_sinter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install -e glue/sample
- run: pip install pytest pymatching fusion-blossom~=0.1.4
- run: pytest glue/sample
- run: dev/doctest_proper.py --module sinter
- run: sinter help
test_stimzx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: bazelbuild/setup-bazelisk@v1
- run: bazel build :stim_dev_wheel
- run: pip install bazel-bin/stim-0.0.dev0-py3-none-any.whl
- run: pip install -e glue/zx
- run: pip install pytest
- run: pytest glue/zx
- run: dev/doctest_proper.py --module stimzx
test_stimjs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: mymindstorm/setup-emsdk@v14
with:
version: 2.0.18
actions-cache-folder: 'emsdk-cache'
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: npm install
- run: bash glue/javascript/build_wasm.sh
- run: node puppeteer_run_tests.js
test_crumble:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: node glue/crumble/run_tests_headless.js