Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge lightning.gpu and lightning.tensor test CIs and add control by a label #911

Merged
merged 27 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bf65fcc
merge LGPU and LTENSOR; add control by label
AmintorDusko Sep 17, 2024
30e9805
Auto update version from '0.39.0-dev24' to '0.39.0-dev25'
ringo-but-quantum Sep 17, 2024
6affb44
trigger CIs
AmintorDusko Sep 17, 2024
9a041b4
Merge branch 'update/GPU-CIs' of https://github.com/PennyLaneAI/penny…
AmintorDusko Sep 17, 2024
174a937
fix condition
AmintorDusko Sep 17, 2024
f0254a2
return validation
AmintorDusko Sep 17, 2024
007fef1
delete obsolete workflows
AmintorDusko Sep 17, 2024
30aaaf8
update workflows
AmintorDusko Sep 17, 2024
d23c027
update workflow name
AmintorDusko Sep 17, 2024
7cd42df
rename python gpu tests
AmintorDusko Sep 18, 2024
a881160
Auto update version from '0.39.0-dev25' to '0.39.0-dev26'
ringo-but-quantum Sep 18, 2024
c1f263c
Merge branch 'master' into update/GPU-CIs
AmintorDusko Sep 18, 2024
982734b
trigger CIs
AmintorDusko Sep 18, 2024
3275ad1
return draft limitation to C++
AmintorDusko Sep 18, 2024
10e49cd
segment tests
AmintorDusko Sep 18, 2024
f6d3316
separate coverage file
AmintorDusko Sep 18, 2024
a595492
re-disable draft CI
AmintorDusko Sep 18, 2024
fb149e8
trigger CIS
AmintorDusko Sep 18, 2024
1b264c4
trigger CIS
AmintorDusko Sep 18, 2024
a3a186d
trigger CIS
AmintorDusko Sep 18, 2024
dfa6aaa
Merge branch 'master' into update/GPU-CIs
AmintorDusko Sep 18, 2024
4213790
update changelog
AmintorDusko Sep 18, 2024
67770f1
Auto update version from '0.39.0-dev26' to '0.39.0-dev27'
ringo-but-quantum Sep 18, 2024
14f195c
Review suggestions; remove custatevec from lightning.tensor; remove C…
AmintorDusko Sep 19, 2024
89a5550
Merge branch 'update/GPU-CIs' of https://github.com/PennyLaneAI/penny…
AmintorDusko Sep 19, 2024
6b5ed41
Review discussions and run pennylane tests with LTensor
AmintorDusko Sep 19, 2024
0a2ca07
remove pl tests from LTensor
AmintorDusko Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@

### Improvements

* Merge `lightning.gpu` and `lightning.tensor` GPU tests in single Python and C++ CIs controlled by the `ci:use-gpu-runner` label.
[(#911)](https://github.com/PennyLaneAI/pennylane-lightning/pull/911)

AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
* Update the test suite to remove deprecated code.
[(#912)](https://github.com/PennyLaneAI/pennylane-lightning/pull/912)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing::x86_64::LGPU::C++
name: Testing::x86_64::GPU::C++
on:
workflow_call:
inputs:
Expand All @@ -17,11 +17,10 @@ on:
- synchronize
- ready_for_review
paths:
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
- .github/workflows/tests_lgpu_cpp.yml
- .github/workflows/tests_gpu_cpp.yml
- pennylane_lightning/core/src/**
- '!pennylane_lightning/core/src/simulators/lightning_kokkos/**'
- '!pennylane_lightning/core/src/simulators/lightning_qubit/**'
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
- '!pennylane_lightning/core/src/simulators/lightning_tensor/**'
push:
branches:
- master
Expand All @@ -30,16 +29,14 @@ env:
CI_CUDA_ARCH: 86
COVERAGE_FLAGS: "--cov=pennylane_lightning --cov-report=term-missing --cov-report=xml:./coverage.xml --no-flaky-report -p no:warnings --tb=native"
GCC_VERSION: 11
TF_VERSION: 2.10.0
TORCH_VERSION: 1.11.0+cpu

concurrency:
group: tests_lgpu_cpp-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }}
group: tests_gpu_cpp-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }}
cancel-in-progress: true

jobs:
builddeps:
if: github.event.pull_request.draft == false
if: ${{ github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'ci:use-gpu-runner') }}
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
runs-on:
- self-hosted
- ubuntu-22.04
Expand All @@ -61,16 +58,15 @@ jobs:
nvcc --version
nvidia-smi

cpptestswithLGPU:
cpptests:
if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
needs: [builddeps]
strategy:
matrix:
pl_backend: ["lightning_gpu"]
enable_lapack: ["OFF"]
pl_backend: ["lightning_gpu", "lightning_tensor"]
cuda_version: ["12"]

name: C++ Tests (${{ matrix.pl_backend }}, cuda-${{ matrix.cuda_version }}, enable_lapack=${{ matrix.enable_lapack }})
name: C++ Tests (${{ matrix.pl_backend }}, cuda-${{ matrix.cuda_version }})
runs-on:
- ubuntu-22.04
- self-hosted
Expand All @@ -87,20 +83,20 @@ jobs:
nvcc --version
nvidia-smi

- name: Checkout PennyLane-Lightning-GPU
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v4
with:
path: main

- uses: actions/setup-python@v5
name: Install Python
name: Setup Python
with:
python-version: '3.10'

- name: Setup Python virtual environment
id: setup_venv
env:
VENV_NAME: ${{ github.workspace }}/venv_${{ steps.setup_python.outputs.python-version }}_${{ github.sha }}
VENV_NAME: ${{ github.workspace }}/venv_${{ steps.setup_python.outputs.python-version }}_${{ github.sha }}_${{ matrix.pl_backend }}
run: |
# Clear any pre-existing venvs
rm -rf venv_*
Expand All @@ -117,7 +113,7 @@ jobs:
echo "Python_ROOT_DIR=${{ env.VENV_NAME }}" >> $GITHUB_ENV
echo "Python3_ROOT_DIR=${{ env.VENV_NAME }}" >> $GITHUB_ENV

# Adding venv site-packages to output for subsequent step to referecen if needed
# Adding venv site-packages to output for subsequent step to referece if needed
echo "site_packages_dir=$(${{ env.VENV_NAME }}/bin/python -c 'import sysconfig; print(sysconfig.get_path("platlib"))')" >> $GITHUB_OUTPUT

- name: Display Python-Path
Expand All @@ -131,10 +127,14 @@ jobs:
echo "PIP Path => $pip_path"
echo "pip=$pip_path" >> $GITHUB_OUTPUT

- name: Install required packages
- name: Install required basic packages
run: |
python -m pip install ninja cmake custatevec-cu${{ matrix.cuda_version }} scipy
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
sudo apt-get -y -q install liblapack-dev black

- name: Install required lightning_tensor only packages
if: matrix.pl_backend == 'lightning_tensor'
run: |
python -m pip install cutensornet-cu${{ matrix.cuda_version }}
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved

- name: Build and run unit tests
run: |
Expand All @@ -143,40 +143,39 @@ jobs:
-DCUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")\
-DBUILD_TESTS=ON \
-DENABLE_PYTHON=OFF \
-DENABLE_LAPACK=${{ matrix.enable_lapack }} \
-DPL_BACKEND=${{ matrix.pl_backend }} \
-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) \
-DENABLE_COVERAGE=ON \
-G Ninja
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results_${{ github.job }}_${{ matrix.pl_backend }}-${{ matrix.enable_lapack }}
for file in *runner ; do ./$file --order lex --reporter junit --out ./tests/results_${{ github.job }}_${{ matrix.pl_backend }}-${{ matrix.enable_lapack }}/report_$file.xml; done;
mkdir -p ./tests/results_${{ github.job }}_${{ matrix.pl_backend }}
for file in *runner ; do ./$file --order lex --reporter junit --out ./tests/results_${{ github.job }}_${{ matrix.pl_backend }}/report_$file.xml; done;
lcov --directory . -b ../pennylane_lightning/core/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}-${{ matrix.pl_backend }}-${{ matrix.enable_lapack }}.info
mv coverage.info coverage-${{ github.job }}-${{ matrix.pl_backend }}.info

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: ubuntu-tests-reports-${{ github.job }}_${{ matrix.pl_backend }}-${{ matrix.enable_lapack }}
path: ./main/Build/tests/results_${{ github.job }}_${{ matrix.pl_backend }}-${{ matrix.enable_lapack }}
name: ubuntu-tests-reports-${{ github.job }}_${{ matrix.pl_backend }}
path: ./main/Build/tests/results_${{ github.job }}_${{ matrix.pl_backend }}
retention-days: 1
if-no-files-found: error
include-hidden-files: true

- name: Upload code coverage results
uses: actions/upload-artifact@v4
with:
name: ubuntu-codecov-results-cpp-${{ matrix.pl_backend }}-${{ matrix.enable_lapack }}
path: ./main/Build/coverage-${{ github.job }}-${{ matrix.pl_backend }}-${{ matrix.enable_lapack }}.info
name: ubuntu-codecov-results-cpp-${{ matrix.pl_backend }}
path: ./main/Build/coverage-${{ github.job }}-${{ matrix.pl_backend }}.info
retention-days: 1
if-no-files-found: error
include-hidden-files: true

upload-to-codecov-linux-cpp:
needs: [cpptestswithLGPU]
needs: [cpptests]
name: Upload coverage data to codecov
runs-on: ubuntu-latest
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing::x86_64::LGPU::Python
name: Testing::x86_64::GPU::Python
on:
workflow_call:
inputs:
Expand All @@ -18,14 +18,12 @@ on:
- ready_for_review
paths-ignore:
- .github/**
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
- '!.github/workflows/tests_lgpu_python.yml'
- '!.github/workflows/tests_gpu_python.yml'
- pennylane_lightning/core/_version.py
- pennylane_lightning/core/src/simulators/lightning_kokkos/**
- pennylane_lightning/core/src/simulators/lightning_qubit/**
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
- pennylane_lightning/core/src/simulators/lightning_tensor/**
- pennylane_lightning/lightning_kokkos/**
- pennylane_lightning/lightning_qubit/**
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
- pennylane_lightning/lightning_tensor/**
push:
branches:
- master
Expand All @@ -34,16 +32,14 @@ env:
CI_CUDA_ARCH: 86
COVERAGE_FLAGS: "--cov=pennylane_lightning --cov-report=term-missing --cov-report=xml:./coverage.xml --no-flaky-report -p no:warnings --tb=native"
GCC_VERSION: 11
TF_VERSION: 2.10.0
TORCH_VERSION: 1.11.0+cpu

concurrency:
group: tests_lgpu_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }}
group: tests_gpu_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }}
cancel-in-progress: true

jobs:
builddeps:
if: github.event.pull_request.draft == false
if: github.event.pull_request.draft == false && contains(github.event.pull_request.labels.*.name, 'ci:use-gpu-runner')
runs-on:
- self-hosted
- ubuntu-22.04
Expand All @@ -65,11 +61,11 @@ jobs:
nvcc --version
nvidia-smi

pythontestswithLGPU:
pythontestswithGPU:
needs: [builddeps]
strategy:
matrix:
pl_backend: ["lightning_gpu"]
pl_backend: ["lightning_gpu", "lightning_tensor"]
cuda_version: ["12"]

name: Python Tests (${{ matrix.pl_backend }}, cuda-${{ matrix.cuda_version }})
Expand All @@ -93,19 +89,16 @@ jobs:
uses: actions/checkout@v4
with:
fetch-tags: true
path: main

- name: Switch to release build of Lightning
if: inputs.lightning-version == 'release'
if: inputs.lightning-version == 'release' && matrix.pl_backend == 'lightning.qubit'
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
run: |
cd main
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'
if: inputs.lightning-version == 'stable' && matrix.pl_backend == 'lightning.qubit'
run: |
cd main
git fetch --tags --force
git checkout latest_release

Expand All @@ -117,7 +110,7 @@ jobs:
- name: Setup Python virtual environment
id: setup_venv
env:
VENV_NAME: ${{ github.workspace }}/venv_${{ steps.setup_python.outputs.python-version }}_${{ github.sha }}
VENV_NAME: ${{ github.workspace }}/venv_${{ steps.setup_python.outputs.python-version }}_${{ github.sha }}_${{ matrix.pl_backend }}
run: |
# Clear any pre-existing venvs
rm -rf venv_*
Expand Down Expand Up @@ -152,10 +145,14 @@ jobs:

- name: Install required packages
run: |
cd main
python -m pip install -r requirements-dev.txt
python -m pip install cmake custatevec-cu${{ matrix.cuda_version }} openfermionpyscf
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved

- name: Install required lightning_tensor only packages
if: matrix.pl_backend == 'lightning_tensor'
run: |
python -m pip install cutensornet-cu${{ matrix.cuda_version }}

AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
- name: Checkout PennyLane for release build
if: inputs.pennylane-version == 'release'
uses: actions/checkout@v4
Expand All @@ -174,76 +171,53 @@ jobs:
- name: Install Stable PennyLane
if: inputs.pennylane-version == 'stable'
run: |
cd main
python -m pip uninstall -y pennylane && python -m pip install -U pennylane

- name: Build and install package
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")
run: |
cd main
rm -rf build
PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py || true
PL_BACKEND=lightning_qubit SKIP_COMPILATION=True python -m pip install . -vv
SKIP_COMPILATION=True python -m pip install . -vv
maliasadi marked this conversation as resolved.
Show resolved Hide resolved

rm -rf build
PL_BACKEND=${{ matrix.pl_backend }} python scripts/configure_pyproject_toml.py || true
PL_BACKEND=${{ matrix.pl_backend }} CMAKE_ARGS="-DPython_EXECUTABLE=${{ steps.python_path.outputs.python }}" \
python -m pip install . -vv

- name: Run PennyLane-Lightning-GPU unit tests
if: ${{ matrix.pl_backend != 'all'}}
- name: Run PennyLane unit tests
env:
OMP_NUM_THREADS: 1
OMP_PROC_BIND: false
if: matrix.pl_backend == 'lightning_gpu'
run: |
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
pl-device-test --device ${DEVICENAME} --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS
mv coverage.xml coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml

- name: Install all backend devices
if: ${{ matrix.pl_backend == 'all' }}
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")
run: |
cd main
rm -rf build
PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py || true
PL_BACKEND=lightning_qubit python -m pip install . -vv
rm -rf build

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 lightning.qubit with all devices installed
if: ${{ matrix.pl_backend == 'all' }}
- name: Run PennyLane Lightning unit tests
env:
OMP_NUM_THREADS: 1
OMP_PROC_BIND: false
run: |
cd main/
PL_DEVICE=lightning.qubit python -m pytest tests/ -k "not test_native_mcm" $COVERAGE_FLAGS
pl-device-test --device lightning.qubit --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device lightning.qubit --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
PL_DEVICE=lightning.gpu python -m pytest tests/ $COVERAGE_FLAGS
pl-device-test --device lightning.gpu --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device lightning.gpu --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS

- name: Move coverage file
run: |
mv coverage.xml coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml

- name: Upload code coverage results
uses: actions/upload-artifact@v4
with:
name: ubuntu-codecov-results-python-${{ matrix.pl_backend }}
path: ./main/coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
path: coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
retention-days: 1
if-no-files-found: error
include-hidden-files: true

upload-to-codecov-linux-python:
needs: [pythontestswithLGPU]
needs: [pythontestswithGPU]
name: Upload coverage data to codecov
runs-on: ubuntu-latest
steps:
Expand Down
Loading