Add support for multi-GPU measurement processes #8948
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 without binary | |
on: | |
workflow_call: | |
inputs: | |
lightning-version: | |
type: string | |
required: true | |
description: The version of Lightning to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master) | |
pennylane-version: | |
type: string | |
required: true | |
description: The version of PennyLane to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master) | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
paths-ignore: | |
- pennylane_lightning/core/src/** | |
push: | |
branches: | |
- master | |
env: | |
COVERAGE_FLAGS: "--cov=pennylane_lightning --cov-report=term-missing --cov-report=xml:./coverage.xml --no-flaky-report -p no:warnings --tb=native" | |
concurrency: | |
group: tests_without_binary-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} | |
cancel-in-progress: true | |
jobs: | |
determine_runner: | |
if: github.event.pull_request.draft == false | |
name: Determine runner type to use | |
uses: ./.github/workflows/determine-workflow-runner.yml | |
with: | |
default_runner: ubuntu-22.04 | |
pythontests: | |
needs: [determine_runner] | |
timeout-minutes: 30 | |
runs-on: ${{ needs.determine_runner.outputs.runner_group }} | |
strategy: | |
matrix: | |
pl_backend: ["lightning_qubit", "lightning_kokkos", "lightning_gpu", "lightning_tensor"] | |
name: Python Tests without Binary (${{ matrix.pl_backend }}) | |
steps: | |
- name: Make disk space | |
run: | | |
for DIR in /usr/share/dotnet /usr/local/share/powershell /usr/share/swift; do | |
sudo du -sh $DIR || echo $DIR not found | |
sudo rm -rf $DIR | |
done | |
- name: Checkout PennyLane-Lightning | |
uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- name: Switch to release build of Lightning | |
if: inputs.lightning-version == 'release' | |
run: | | |
git fetch --all | |
git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) | |
- name: Switch to stable build of Lightning | |
if: inputs.lightning-version == 'stable' | |
run: | | |
git fetch --tags --force | |
git checkout latest_release | |
git log -1 --format='%H' | |
git status | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.10' | |
- name: Get required Python packages | |
run: | | |
rm -fr $(python -m pip cache dir)/selfcheck/ | |
python -m pip install -r requirements-dev.txt | |
- name: Checkout PennyLane for release build | |
if: inputs.pennylane-version == 'release' | |
uses: actions/checkout@v4 | |
with: | |
path: pennylane | |
repository: PennyLaneAI/pennylane | |
- name: Switch to release build of PennyLane | |
if: inputs.pennylane-version == 'release' | |
run: | | |
cd pennylane | |
git fetch --all | |
git checkout $(git branch -a --list "origin/v0.*rc*" | sort | tail -1) | |
python -m pip uninstall -y pennylane && python -m pip install . -vv --no-deps | |
- name: Install Stable PennyLane | |
if: inputs.pennylane-version == 'stable' | |
run: | | |
python -m pip uninstall -y pennylane && python -m pip install -U pennylane | |
- name: Install the pennylane_lightning core package (lightning_qubit) | |
env: | |
SKIP_COMPILATION: True | |
run: | | |
PL_BACKEND="lightning_qubit" python scripts/configure_pyproject_toml.py || true | |
PL_BACKEND="lightning_qubit" python -m pip install . -vv | |
- name: Install extra backend device | |
if: matrix.pl_backend != 'lightning_qubit' | |
env: | |
SKIP_COMPILATION: True | |
run: | | |
PL_BACKEND=${{ matrix.pl_backend }} python scripts/configure_pyproject_toml.py || true | |
PL_BACKEND=${{ matrix.pl_backend }} python -m pip install . -vv | |
- name: Run PennyLane-Lightning unit tests for all backends | |
run: | | |
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` | |
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: coverage.xml | |
fail_ci_if_error: true | |
verbose: true | |
token: ${{ secrets.CODECOV_TOKEN }} |