This repository has been archived by the owner on Oct 27, 2023. It is now read-only.
Test QuantumPhaseEstimation and associated decomp values #699
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Testing (Linux) | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
PY_VERSION: 3.8 | |
GCC_VERSION: 11 | |
COVERAGE_FLAGS: "--cov=pennylane_lightning_kokkos --cov-report=term-missing --cov-report=xml:./coverage.xml --no-flaky-report -p no:warnings --tb=native" | |
OMP_NUM_THREADS: "2" | |
jobs: | |
cpptests_openmp: | |
name: C++ tests (Linux) for OpenMP Kokkos backend | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '${{ env.PY_VERSION }}' | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 # for codecov | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-${{ env.GCC_VERSION }} g++-${{ env.GCC_VERSION }} gcovr lcov | |
- name: Build and run unit tests | |
run: | | |
cmake . -BBuild -DKokkos_ENABLE_OPENMP=ON -DPLKOKKOS_BUILD_TESTS=ON -DPLKOKKOS_ENABLE_SANITIZER=ON -DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" | |
cmake --build ./Build | |
export OMP_PROC_BIND=false | |
export OMP_PLACES=threads | |
./Build/pennylane_lightning_kokkos/src/tests/runner_kokkos | |
pythontests_openmp: | |
name: Python tests for OpenMP Kokkos Backend | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- name: Checkout PennyLane-Lightning-Kokkos | |
uses: actions/checkout@v3 | |
with: | |
path: main | |
fetch-depth: 2 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '${{ env.PY_VERSION }}' | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-${{ env.GCC_VERSION }} g++-${{ env.GCC_VERSION }} ninja-build | |
- name: Get required Python packages | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-mock flaky | |
python -m pip uninstall pennylane -y | |
python -m pip install git+https://github.com/PennyLaneAI/pennylane.git@master | |
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning --pre --force-reinstall --no-deps | |
- name: Install lightning.kokkos device | |
run: | | |
cd main | |
CC=$(which gcc-${{ env.GCC_VERSION }}) CXX=$(which g++-${{ env.GCC_VERSION }}) BACKEND="OPENMP" python -m pip install -e . --verbose | |
- name: Run PennyLane-Lightning-Kokkos unit tests | |
run: | | |
cd main/ | |
pytest tests/ | |
pl-device-test --device lightning.kokkos --skip-ops --shots=20000 | |
pl-device-test --device lightning.kokkos --skip-ops --shots=None | |
cpptests_serial: | |
name: C++ tests (Linux) for Serial Kokkos backend | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '${{ env.PY_VERSION }}' | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 # for codecov | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-${{ env.GCC_VERSION }} g++-${{ env.GCC_VERSION }} gcovr lcov | |
- name: Build and run unit tests | |
run: | | |
cmake . -BBuild -DPLKOKKOS_BUILD_TESTS=ON -DPLKOKKOS_ENABLE_SANITIZER=ON -DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" | |
cmake --build ./Build | |
./Build/pennylane_lightning_kokkos/src/tests/runner_kokkos | |
pythontests_serial: | |
name: Python tests for Serial Kokkos Backend | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- name: Checkout PennyLane-Lightning-Kokkos | |
uses: actions/checkout@v3 | |
with: | |
path: main | |
fetch-depth: 2 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '${{ env.PY_VERSION }}' | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-${{ env.GCC_VERSION }} g++-${{ env.GCC_VERSION }} ninja-build | |
- name: Get required Python packages | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-mock flaky | |
python -m pip uninstall pennylane -y | |
python -m pip install git+https://github.com/PennyLaneAI/pennylane.git@master | |
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning --pre --force-reinstall --no-deps | |
- name: Install lightning.kokkos device | |
run: | | |
cd main | |
CC=$(which gcc-${{ env.GCC_VERSION }}) CXX=$(which g++-${{ env.GCC_VERSION }}) BACKEND="SERIAL" python -m pip install -e . --verbose | |
- name: Run PennyLane-Lightning-Kokkos unit tests | |
run: | | |
cd main/ | |
pytest tests/ | |
pl-device-test --device lightning.kokkos --skip-ops --shots=20000 | |
pl-device-test --device lightning.kokkos --skip-ops --shots=None | |
cpptests_threads: | |
name: C++ tests (Linux) for C++ Threads Kokkos backend | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '${{ env.PY_VERSION }}' | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 # for codecov | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-${{ env.GCC_VERSION }} g++-${{ env.GCC_VERSION }} gcovr lcov | |
- name: Build and run unit tests | |
run: | | |
cmake . -BBuild -DPLKOKKOS_BUILD_TESTS=ON -DKokkos_ENABLE_THREADS=ON -DPLKOKKOS_ENABLE_SANITIZER=ON -DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" | |
cmake --build ./Build | |
./Build/pennylane_lightning_kokkos/src/tests/runner_kokkos | |
pythontests_threads: | |
name: Python tests for C++ Threads Kokkos Backend | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- name: Checkout PennyLane-Lightning-Kokkos | |
uses: actions/checkout@v3 | |
with: | |
path: main | |
fetch-depth: 2 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '${{ env.PY_VERSION }}' | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-${{ env.GCC_VERSION }} g++-${{ env.GCC_VERSION }} ninja-build | |
- name: Get required Python packages | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-mock flaky | |
python -m pip uninstall pennylane -y | |
python -m pip install git+https://github.com/PennyLaneAI/pennylane.git@master | |
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning --pre --force-reinstall --no-deps | |
- name: Install lightning.kokkos device | |
run: | | |
cd main | |
CC=$(which gcc-${{ env.GCC_VERSION }}) CXX=$(which g++-${{ env.GCC_VERSION }}) BACKEND="THREADS" python -m pip install -e . --verbose | |
- name: Run PennyLane-Lightning-Kokkos unit tests | |
run: | | |
cd main/ | |
pytest tests/ | |
pl-device-test --device lightning.kokkos --skip-ops --shots=20000 | |
pl-device-test --device lightning.kokkos --skip-ops --shots=None |