This repository has been archived by the owner on Oct 27, 2023. It is now read-only.
Test QuantumPhaseEstimation and associated decomp values #663
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 (MacOS) | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
TF_VERSION: 2.10.0 | |
TORCH_VERSION: 1.11.0 | |
jobs: | |
cpptests: | |
strategy: | |
matrix: | |
os: [macos-11] | |
exec_model: ["SERIAL"] | |
name: C++ tests (MacOS) for ${{ matrix.exec_model }} Kokkos backend | |
runs-on: ${{ matrix.os }} | |
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: '3.8' | |
- name: Checkout PennyLane-Lightning-Kokkos | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Install dependencies | |
run: | | |
brew uninstall --force oclint | |
brew install libomp llvm cmake ninja | |
- name: Build and run unit tests | |
run: | | |
cmake . -BBuild -DKokkos_ENABLE_${{ matrix.exec_model }}=ON -DPLKOKKOS_BUILD_TESTS=ON -DPLKOKKOS_ENABLE_SANITIZER=ON -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ -G Ninja | |
cmake --build ./Build --verbose | |
./Build/pennylane_lightning_kokkos/src/tests/runner_kokkos | |
pythontests: | |
strategy: | |
matrix: | |
os: [macos-11] | |
exec_model: ["SERIAL"] | |
name: Python tests for ${{ matrix.exec_model }} Kokkos Backend | |
runs-on: ${{ matrix.os }} | |
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: '3.8' | |
- name: Install dependencies | |
run: | | |
brew uninstall --force oclint | |
brew install libomp llvm cmake ninja | |
- name: Get required Python packages | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-mock flaky | |
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 ML libraries for interfaces | |
run: | | |
pip install --upgrade torch==${{ env.TORCH_VERSION }} -f https://download.pytorch.org/whl/cpu/torch_stable.html | |
pip install --upgrade "jax[cpu]" # This also installs jaxlib | |
pip install --upgrade tensorflow~=${{ env.TF_VERSION }} | |
- name: Install lightning.kokkos device | |
run: | | |
cd main | |
python setup.py build_ext -i --define="Kokkos_ENABLE_${{ matrix.exec_model }}=ON;CMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++" | |
pip install -e . | |
- name: Run PennyLane-Lightning 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 |