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

Add python layer for LGPU_MPI #518

Merged
merged 210 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 188 commits
Commits
Show all changes
210 commits
Select commit Hold shift + click to select a range
15e42fd
add LGPU cpp layer
multiphaseCFD Sep 12, 2023
ece63c6
update measurement
multiphaseCFD Sep 13, 2023
9431ef6
add openmp to adjgpu
multiphaseCFD Sep 13, 2023
44237ea
Merge branch 'master' into add_LGPU
multiphaseCFD Sep 13, 2023
39d144e
Auto update version
github-actions[bot] Sep 13, 2023
832dc68
Add support for building multiple backend simulators (#497)
maliasadi Sep 13, 2023
5b2220d
add python layer & isingxy gate in the cpp layer
multiphaseCFD Sep 15, 2023
b10494b
add batched adjoint method
multiphaseCFD Sep 15, 2023
62ee28b
Update DefaultQubit to DefaultQubitLegacy (#500)
AmintorDusko Sep 15, 2023
d921b4f
Auto update version
github-actions[bot] Sep 15, 2023
cd06aa6
add batch support for adjoint method
multiphaseCFD Sep 16, 2023
38bfad3
add gitignore
multiphaseCFD Sep 16, 2023
516447f
tidy up code
multiphaseCFD Sep 16, 2023
8de101a
Merge branch 'master' into add_LGPU
multiphaseCFD Sep 16, 2023
c7d6012
Auto update version
github-actions[bot] Sep 16, 2023
6bcd87c
make format
multiphaseCFD Sep 16, 2023
c9cbdaa
revert complexT delete in LKokkosBingds
multiphaseCFD Sep 18, 2023
108e1fe
make format
multiphaseCFD Sep 18, 2023
d94fc0e
update based on tidy
multiphaseCFD Sep 18, 2023
ee914a2
fix tidy format
multiphaseCFD Sep 18, 2023
e1a9bb0
add_gpu_runners_tests
multiphaseCFD Sep 18, 2023
ce49548
add cuquantum_sdk path to ci workflow
multiphaseCFD Sep 18, 2023
a99363c
debug
multiphaseCFD Sep 18, 2023
ad4b938
add path to cuquantum sdk
multiphaseCFD Sep 18, 2023
78bab88
add python layer tests in ci workflow
multiphaseCFD Sep 18, 2023
3c9e9c0
ci tests
multiphaseCFD Sep 18, 2023
b805ec2
quick fix
multiphaseCFD Sep 18, 2023
08412c4
skip pr ci for some workflows
multiphaseCFD Sep 18, 2023
f0dc631
quick fix
multiphaseCFD Sep 18, 2023
9639b41
quick fix
multiphaseCFD Sep 18, 2023
ba3bf42
update python ci tests
multiphaseCFD Sep 18, 2023
083fdd7
remove dependency on lightning_qubit in ci
multiphaseCFD Sep 18, 2023
ed6ea62
fix directory
multiphaseCFD Sep 18, 2023
c3ad7aa
fix directory
multiphaseCFD Sep 18, 2023
e7afb36
quick fix
multiphaseCFD Sep 18, 2023
d35628e
quick fix
multiphaseCFD Sep 18, 2023
4a58c98
test for cuda-12
multiphaseCFD Sep 19, 2023
81fc5b9
update measurement
multiphaseCFD Sep 19, 2023
c3db409
Merge branch 'master' into add_LGPU
multiphaseCFD Sep 20, 2023
61ffa3d
updata cu12 workflows
multiphaseCFD Sep 20, 2023
e5c2c4b
add getDataVector support to LQubitRaw
multiphaseCFD Sep 21, 2023
2ba7e96
Merge branch 'master' into add_LGPU
multiphaseCFD Sep 21, 2023
23e154d
install lightning.qubit before lightning.gpu in ci
multiphaseCFD Sep 21, 2023
a1ca506
update test_obs
multiphaseCFD Sep 21, 2023
f52fe36
activate all CI checks
multiphaseCFD Sep 22, 2023
2cc0242
quick fix
multiphaseCFD Sep 22, 2023
b6cde23
tidy up code
multiphaseCFD Sep 22, 2023
d76ec44
tidy up code
multiphaseCFD Sep 22, 2023
d48351e
make format
multiphaseCFD Sep 22, 2023
4f4e1fa
update ci for more tests
multiphaseCFD Sep 22, 2023
3a45666
tidy up code
multiphaseCFD Sep 22, 2023
443aae5
tidy up code
multiphaseCFD Sep 22, 2023
e8ac990
tidy up code
multiphaseCFD Sep 22, 2023
74d3667
make format
multiphaseCFD Sep 22, 2023
3efeb1f
fix for codecov
multiphaseCFD Sep 22, 2023
ec393f4
codecov fix
multiphaseCFD Sep 22, 2023
f3f1a85
quick fix
multiphaseCFD Sep 22, 2023
4ff0c61
quick fix
multiphaseCFD Sep 22, 2023
34a05d9
quick fix
multiphaseCFD Sep 22, 2023
60b2a3d
quick test
multiphaseCFD Sep 22, 2023
9bbd2d4
fix test
multiphaseCFD Sep 22, 2023
d96d793
fix tests
multiphaseCFD Sep 22, 2023
a290364
another quick fix
multiphaseCFD Sep 22, 2023
41d90e3
coverage fix
multiphaseCFD Sep 22, 2023
1410fee
update ci tests
multiphaseCFD Sep 22, 2023
08c8453
update ci for no binary
multiphaseCFD Sep 22, 2023
394ceab
codecov fix
multiphaseCFD Sep 22, 2023
79a6c34
update adj tests for no binary case
multiphaseCFD Sep 22, 2023
2d238eb
update python layer tests
multiphaseCFD Sep 22, 2023
98db424
fix codecov
multiphaseCFD Sep 22, 2023
11fa5c2
make format
multiphaseCFD Sep 22, 2023
9a4bb0b
Merge branch 'add_LGPU' into add_LGPUMPI
multiphaseCFD Sep 25, 2023
939f7ce
initial commit for MPI
multiphaseCFD Sep 26, 2023
219cfde
revert to cu11
multiphaseCFD Sep 26, 2023
2530925
enable more py tests
multiphaseCFD Sep 27, 2023
314c06d
update CI
multiphaseCFD Sep 27, 2023
9b9fbbe
upload codecov ci
multiphaseCFD Sep 27, 2023
d1b05f9
add more tests for statevectorcudamanaged
multiphaseCFD Sep 27, 2023
9e3e834
add more unit tests
multiphaseCFD Sep 27, 2023
4d1ea37
add more tests
multiphaseCFD Sep 27, 2023
b54759e
make format
multiphaseCFD Sep 27, 2023
a27d1a1
add more cpp tests
multiphaseCFD Sep 27, 2023
d353a6e
skip cpp tests pauli param gates
multiphaseCFD Sep 27, 2023
cfd7f3b
make format
multiphaseCFD Sep 27, 2023
1fbad9f
add more files to gitignore
multiphaseCFD Sep 27, 2023
43c7e52
Merge branch 'master' into add_LGPU
multiphaseCFD Sep 27, 2023
893c61b
Auto update version
github-actions[bot] Sep 27, 2023
8f56589
Merge branch 'add_LGPU' into add_LGPUMPI
multiphaseCFD Sep 27, 2023
f572875
init commit
multiphaseCFD Oct 2, 2023
722cc28
Trigger CI
multiphaseCFD Oct 2, 2023
6f49902
update gpu runner
multiphaseCFD Oct 10, 2023
36ea421
quick fix
multiphaseCFD Oct 10, 2023
643d9b0
update fix
multiphaseCFD Oct 10, 2023
1229ea6
add cpp layer for LGPU-MPI backend
multiphaseCFD Oct 11, 2023
77dacd5
add py layer
multiphaseCFD Oct 12, 2023
68a798c
quick fix
multiphaseCFD Oct 12, 2023
3a06309
make format
multiphaseCFD Oct 12, 2023
8044aad
fix for fp32 support in expval calculation
multiphaseCFD Oct 12, 2023
e099fc4
quick fix
multiphaseCFD Oct 12, 2023
38773b7
fix for cray_mpich_serialize_py
multiphaseCFD Oct 13, 2023
c8f9f1a
copy to move for hamiltonian operation
multiphaseCFD Oct 13, 2023
4edb007
add unit tests for adjoint method
multiphaseCFD Oct 13, 2023
3e80ce6
add more tests
multiphaseCFD Oct 13, 2023
114438a
resolve comments py layer
multiphaseCFD Oct 13, 2023
7e825ce
remove omp support in LGPU
multiphaseCFD Oct 13, 2023
6efb5dc
Merge branch 'master' into add_LGPU
multiphaseCFD Oct 13, 2023
19f85e1
update version
multiphaseCFD Oct 13, 2023
b7ef71f
Auto update version
github-actions[bot] Oct 13, 2023
ade064d
fix based on comments
multiphaseCFD Oct 13, 2023
500a0c4
Add L-GPU and L-Kokkos as package extras (#515)
mlxd Oct 13, 2023
52d7293
Auto update version
github-actions[bot] Oct 13, 2023
f09db5f
Merge branch 'master' into add_LGPU
multiphaseCFD Oct 13, 2023
8888060
make format
multiphaseCFD Oct 13, 2023
6b503b7
remove sparseH
multiphaseCFD Oct 15, 2023
997515f
remove applyHostMatrixGate
multiphaseCFD Oct 15, 2023
c263264
Add wheel_linux_x86_64_cu11.yml (#517)
vincentmr Oct 16, 2023
e6d802c
resolve more comments
multiphaseCFD Oct 16, 2023
6d9c443
add more tests to non_param gates
multiphaseCFD Oct 16, 2023
3f6268c
resolve cpp tests comments
multiphaseCFD Oct 16, 2023
db04384
remove unused methods in measurement class
multiphaseCFD Oct 16, 2023
cba4849
remove unused methods
multiphaseCFD Oct 16, 2023
34e00d2
resolve more comments
multiphaseCFD Oct 17, 2023
61ba81a
add changelog and matrixhasher
multiphaseCFD Oct 17, 2023
5be027b
quick update
multiphaseCFD Oct 17, 2023
1d1793c
Merge branch 'add_LGPU' into add_LGPUMPI
multiphaseCFD Oct 17, 2023
8b42b8c
add more tests and merge base branch
multiphaseCFD Oct 17, 2023
6633d2e
add mpi unit tests for algorithm base class
multiphaseCFD Oct 18, 2023
f89e4d0
add more unit tests for utils
multiphaseCFD Oct 18, 2023
9232e92
ctor test for MPIManager
multiphaseCFD Oct 18, 2023
9d172dc
Add mpi tests to LGPU (#519)
vincentmr Oct 18, 2023
7bc687e
add CI checks for cpp unit tests
multiphaseCFD Oct 18, 2023
9a7cc37
add cpp layer ci check for mpi backend
multiphaseCFD Oct 18, 2023
6520923
Merge branch 'master' into add_LGPUMPI
multiphaseCFD Oct 18, 2023
9310500
Auto update version
github-actions[bot] Oct 18, 2023
747f72d
remove redundant blank lines
multiphaseCFD Oct 18, 2023
bf776c5
tidy up code
multiphaseCFD Oct 18, 2023
8a69d05
Trigger CI
multiphaseCFD Oct 18, 2023
3a18ce0
remove single GPU backend tests in mpi ci
multiphaseCFD Oct 19, 2023
e7a0d44
upload codecov results
multiphaseCFD Oct 19, 2023
63f98ae
add more unit tests
multiphaseCFD Oct 19, 2023
bef8e97
add tests for pauli word based expval
multiphaseCFD Oct 19, 2023
3ba0c9a
add more docs
multiphaseCFD Oct 19, 2023
5532fc8
add more tests
multiphaseCFD Oct 19, 2023
79a3e46
skip lcov for native gates
multiphaseCFD Oct 19, 2023
48aed47
add mpi_helpers
multiphaseCFD Oct 19, 2023
63cef9a
add more docstrings
multiphaseCFD Oct 19, 2023
717f8d5
add change log
multiphaseCFD Oct 19, 2023
8973ee8
Merge branch 'master' into add_LGPUMPI
multiphaseCFD Oct 19, 2023
4d47ea0
Auto update version
github-actions[bot] Oct 19, 2023
5a75cfe
Merge branch 'add_LGPUMPI' into add_py_LGPUMPI
multiphaseCFD Oct 19, 2023
e17728d
Auto update version
github-actions[bot] Oct 19, 2023
69dc625
fix failures caused by merging
multiphaseCFD Oct 20, 2023
dc25439
add changelog
multiphaseCFD Oct 20, 2023
34c3b9a
Trigger multi-GPU runner
multiphaseCFD Oct 20, 2023
f9974b8
add more fp32 tests to the measurement class
multiphaseCFD Oct 20, 2023
84e2eb6
add number of devices and mpi procs check
multiphaseCFD Oct 23, 2023
6ad1c7c
Add coverage for py-mpitests. (#522)
vincentmr Oct 23, 2023
d3af819
Merge branch 'add_LGPUMPI' into add_py_LGPUMPI
vincentmr Oct 23, 2023
d0f6a89
add more tests in obs base class
multiphaseCFD Oct 23, 2023
2f82e1b
Merge branch 'fix_linting_lgpu' into add_LGPUMPI
multiphaseCFD Oct 23, 2023
1cca83d
Revert "Merge branch 'add_LGPUMPI' into add_py_LGPUMPI"
multiphaseCFD Oct 23, 2023
6de79c9
Fix pylint [skip ci]
vincentmr Oct 23, 2023
935a6c0
resolve comments on source codes and tidy up code
multiphaseCFD Oct 23, 2023
09538c8
Use CRTP to define initSV and remove initSV_MPI
multiphaseCFD Oct 23, 2023
1a33cdb
resolve more typos
multiphaseCFD Oct 23, 2023
c32b60d
resolve more typoes
multiphaseCFD Oct 23, 2023
740308f
resolve adjoint class
multiphaseCFD Oct 23, 2023
3bcad80
remove py&pybind layer
multiphaseCFD Oct 23, 2023
baaee12
resolve more comments
multiphaseCFD Oct 24, 2023
57fbf38
Remove redundant blank line
multiphaseCFD Oct 24, 2023
eb096d6
Merge branch 'add_LGPUMPI' into add_py_LGPUMPI
multiphaseCFD Oct 24, 2023
50c87e0
add num mpi & ngpudevice proc check
multiphaseCFD Oct 24, 2023
420ecc6
Merge branch 'add_LGPUMPI' into add_py_LGPUMPI
multiphaseCFD Oct 24, 2023
acec720
fix typo
multiphaseCFD Oct 24, 2023
72d1394
Merge branch 'add_LGPUMPI' into add_py_LGPUMPI
multiphaseCFD Oct 24, 2023
68829cd
remove unused lines
multiphaseCFD Oct 24, 2023
faf39da
add more tests
multiphaseCFD Oct 24, 2023
ef9e436
remove initsv_mpi
multiphaseCFD Oct 24, 2023
0efcf14
add reset
multiphaseCFD Oct 24, 2023
9dc9181
make format
multiphaseCFD Oct 24, 2023
17ef6e6
Merge branch 'add_LGPUMPI' into add_py_LGPUMPI
multiphaseCFD Oct 24, 2023
9ebed9a
use_mpi as _use_mpi in QuantumScriptSerializer
multiphaseCFD Oct 24, 2023
eabf80d
resolve more comments
multiphaseCFD Oct 24, 2023
1934338
check->require
multiphaseCFD Oct 24, 2023
839025c
make format
multiphaseCFD Oct 24, 2023
4f13272
Merge branch 'add_LGPUMPI' into add_py_LGPUMPI
multiphaseCFD Oct 24, 2023
ccea774
rename mpi workflow
multiphaseCFD Oct 24, 2023
b1b698d
Add sparseH for LGPU (#526)
multiphaseCFD Oct 24, 2023
74595d9
Merge branch 'master' into add_py_LGPUMPI
multiphaseCFD Oct 24, 2023
96d33d3
update work flow
multiphaseCFD Oct 24, 2023
cf2449b
resolve comments for unit tests
multiphaseCFD Oct 24, 2023
577c106
add more unit tests for sparseH
multiphaseCFD Oct 24, 2023
378a5d7
quick fix
multiphaseCFD Oct 24, 2023
41aace7
add fp32 tests
multiphaseCFD Oct 24, 2023
6bcb1fb
tidy up code
multiphaseCFD Oct 25, 2023
ee76db0
remove redundant lines
multiphaseCFD Oct 25, 2023
ca8ccbd
add pylintrc to mpitests
multiphaseCFD Oct 25, 2023
a6262a7
add mpitests dir to commit-config
multiphaseCFD Oct 25, 2023
e55f9ba
add mpitests to .coveragerc
multiphaseCFD Oct 25, 2023
fd4b96b
add mpitests path to coveragerc
multiphaseCFD Oct 25, 2023
f0f690c
Fix mpitests/test_adjoint_jacobian.py
vincentmr Oct 25, 2023
d563dcc
Fix pylint in mpitests/test_apply [skip ci].
vincentmr Oct 25, 2023
3d84c9a
pylint fix for mpi py_d_e_m_p tets
multiphaseCFD Oct 25, 2023
a4cc5e3
tidy up cpp code
multiphaseCFD Oct 25, 2023
5f84616
fix codefactor
multiphaseCFD Oct 25, 2023
b02f951
revert skipp condition for openfermionpyscf
multiphaseCFD Oct 25, 2023
31facd3
codefactor fix
multiphaseCFD Oct 25, 2023
6c9101b
add sparseH tests for mpi backend
multiphaseCFD Oct 25, 2023
f6b9fdb
Install openfermion in CI workflows and fix H2 QChem integration test.
vincentmr Oct 25, 2023
e0787e1
update changelog
multiphaseCFD Oct 25, 2023
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
15 changes: 15 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

### New features since last release

* Add `SparseHamiltonian` support for Lightning-GPU.
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
[(#526)] (https://github.com/PennyLaneAI/pennylane-lightning/pull/526)

* Add `SparseHamiltonian` support for Lightning-Kokkos.
[(#527)] (https://github.com/PennyLaneAI/pennylane-lightning/pull/527)

* Integrate python/pybind layer of distributed Lightning-GPU into the Lightning monorepo with python unit tests.
[(#518)] (https://github.com/PennyLaneAI/pennylane-lightning/pull/518)

* Integrate the distributed C++ backend of Lightning-GPU into the Lightning monorepo.
[(#514)] (https://github.com/PennyLaneAI/pennylane-lightning/pull/514)

* Integrate Lightning-GPU into the Lightning monorepo. The new backend is named `lightning_gpu` and includes all single-GPU features.
[(#499)] (https://github.com/PennyLaneAI/pennylane-lightning/pull/499)

Expand Down Expand Up @@ -43,6 +55,9 @@

### Improvements

* Improve Python testing for Lightning-GPU (+MPI) by adding jobs in Actions files and adding Python tests to increase code coverage.
[(#522)](https://github.com/PennyLaneAI/pennylane-lightning/pull/522)

* Add support for `pip install pennylane-lightning[kokkos]` for the OpenMP backend.
[(#515)](https://github.com/PennyLaneAI/pennylane-lightning/pull/515)

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
cp -rf ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/

- name: Install dependencies
run: sudo apt update && sudo apt -y install clang-tidy-14 cmake g++-10 ninja-build libomp-14-dev
run: sudo apt update && sudo apt -y install clang-tidy-14 cmake gcc-11 g++-11 ninja-build libomp-14-dev
env:
DEBIAN_FRONTEND: noninteractive

Expand All @@ -96,5 +96,6 @@ jobs:
-DBUILD_TESTS=ON \
-DENABLE_WARNINGS=ON \
-DPL_BACKEND=${{ matrix.pl_backend }} \
-DCMAKE_CXX_COMPILER="$(which g++-10)"
-DCMAKE_CXX_COMPILER="$(which g++-11)" \
-DCMAKE_C_COMPILER="$(which gcc-11)"
cmake --build ./Build
4 changes: 2 additions & 2 deletions .github/workflows/tests_gpu_cu11.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing::Linux::x86_64 (Lightning-GPU)
name: Testing::Linux::x86_64::LGPU
on:
pull_request:
push:
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
if-no-files-found: error

pythontestswithLGPU:
needs: [builddeps]
needs: [builddeps, cpptestswithLGPU_cu11]
strategy:
matrix:
os: [ubuntu-22.04]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing (GPU)
name: Testing::LKokkos::GPU
on:
pull_request:
push:
Expand Down
320 changes: 320 additions & 0 deletions .github/workflows/tests_linux_x86_mpi_gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,320 @@
name: Tests::Linux::x86_64::LGPU::MPI
on:
workflow_call:
inputs:
lightning-version:
type: string
required: true
description: The version of lightning to use. Valid values are either '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 'stable' (most recent git-tag) or 'latest' (most recent commit from master)
release:
push:
branches:
- main
pull_request:

env:
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
OMP_NUM_THREADS: "2"
CI_CUDA_ARCH: 86

concurrency:
group: gpu-test-mpi-${{ github.ref }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }}
cancel-in-progress: true

jobs:
cpp_tests:
if: contains(github.event.pull_request.labels.*.name, 'ci:use-multi-gpu-runner') || (inputs.lightning-version != '' && inputs.pennylane-version != '')
runs-on:
- self-hosted
- linux
- x64
- ubuntu-22.04
- multi-gpu
strategy:
max-parallel: 1
matrix:
mpilib: ["mpich", "openmpi"]
timeout-minutes: 30

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-tags: true

- name: Switch to stable build of Lightning-GPU
if: inputs.lightning-version == 'stable'
run: |
git fetch tags --force
git checkout $(git tag | sort -V | tail -1)
- uses: actions/setup-python@v4
id: setup_python
name: Install Python
with:
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
- name: Setup Python virtual environment
id: setup_venv
env:
VENV_NAME: ${{ github.workspace }}/venv_${{ steps.setup_python.outputs.python-version }}_${{ github.sha }}
run: |
# Clear any pre-existing venvs
rm -rf venv_*

# Create new venv for this workflow_run
python --version
python -m venv ${{ env.VENV_NAME }}

# Add the venv to PATH for subsequent steps
echo ${{ env.VENV_NAME }}/bin >> $GITHUB_PATH

# Adding venv name as an output for subsequent steps to reference if needed
echo "venv_name=${{ env.VENV_NAME }}" >> $GITHUB_OUTPUT

- name: Display Python-Path
id: python_path
run: |
py_path=$(which python)
echo "Python Interpreter Path => $py_path"
echo "python=$py_path" >> $GITHUB_OUTPUT

pip_path=$(which python)
echo "PIP Path => $pip_path"
echo "pip=$pip_path" >> $GITHUB_OUTPUT

- name: Install required packages
run: |
python -m pip install ninja cmake custatevec-cu11

- name: Validate GPU version and installed compiler
run: |
source /etc/profile.d/modules.sh && module use /opt/modules && module load cuda/11.8
which -a nvcc
nvcc --version
- name: Validate Multi-GPU packages
run: |
source /etc/profile.d/modules.sh && module use /opt/modules/ && module load ${{ matrix.mpilib }}
echo 'Checking for ${{ matrix.mpilib }}'
which -a mpirun
mpirun --version
which -a mpicxx
mpicxx --version
module unload ${{ matrix.mpilib }}
- name: Install Latest PennyLane
if: inputs.pennylane-version == 'latest'
run: python -m pip install git+https://github.com/PennyLaneAI/pennylane.git@master

- name: Build and run unit tests
run: |
source /etc/profile.d/modules.sh && module use /opt/modules/ && module load ${{ matrix.mpilib }}
export CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')")
cmake . -BBuild \
-DPL_BACKEND=lightning_gpu \
-DENABLE_MPI=ON \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_COVERAGE=ON \
-DBUILD_TESTS=ON \
-DCMAKE_CXX_COMPILER=mpicxx \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
-DPython_EXECUTABLE:FILE="${{ steps.python_path.outputs.python }}" \
-G Ninja
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results
for file in *runner ; do ./$file --order lex --reporter junit --out ./tests/results/report_$file.xml; done;
for file in *runner_mpi ; do /opt/mpi/${{ matrix.mpilib }}/bin/mpirun -np 2 ./$file --order lex --reporter junit --out ./tests/results/report_$file.xml; done;
lcov --directory . -b ../pennylane_lightning/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}-lightning_gpu_${{ matrix.mpilib }}.info

- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
if-no-files-found: error
name: ubuntu-tests-reports
path: ./Build/tests/results/

- name: Upload code coverage results
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: ubuntu-codecov-results-cpp
path: ./Build/coverage-${{ github.job }}-lightning_gpu_${{ matrix.mpilib }}.info

- name: Cleanup
if: always()
run: |
rm -rf ${{ steps.setup_venv.outputs.venv_name }}
rm -rf * .git .gitignore .github
pip cache purge


python_tests:
if: contains(github.event.pull_request.labels.*.name, 'ci:use-multi-gpu-runner') || (inputs.lightning-version != '' && inputs.pennylane-version != '')
runs-on:
- self-hosted
- linux
- x64
- ubuntu-22.04
- multi-gpu
strategy:
max-parallel: 1
matrix:
mpilib: ["mpich", "openmpi"]
timeout-minutes: 30

steps:
- name: Checkout pennyLane-lightning-gpu
uses: actions/checkout@v3
with:
fetch-tags: true

- name: Switch to stable build of Lightning-GPU
if: inputs.lightning-version == 'stable'
run: |
git fetch tags --force
git checkout $(git tag | sort -V | tail -1)

- uses: actions/setup-python@v4
id: setup_python
name: Install Python
with:
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
- name: Setup Python virtual environment
id: setup_venv
env:
VENV_NAME: ${{ github.workspace }}/venv_${{ steps.setup_python.outputs.python-version }}_${{ github.sha }}
run: |
# Clear any pre-existing venvs
rm -rf venv_*

# Create new venv for this workflow_run
python --version
python -m venv ${{ env.VENV_NAME }}

# Add the venv to PATH for subsequent steps
echo ${{ env.VENV_NAME }}/bin >> $GITHUB_PATH

# Adding venv name as an output for subsequent steps to reference if needed
source ${{ env.VENV_NAME }}/bin/activate
echo "venv_name=${{ env.VENV_NAME }}" >> $GITHUB_OUTPUT

- name: Display Python-Path
id: python_path
run: |
py_path=$(which python)
echo "Python Interpreter Path => $py_path"
echo "python=$py_path" >> $GITHUB_OUTPUT

pip_path=$(which python)
echo "PIP Path => $pip_path"
echo "pip=$pip_path" >> $GITHUB_OUTPUT

- name: Install Latest PennyLane
# We want to install the latest PL on non workflow_call events
if: inputs.pennylane-version == 'latest' || inputs.pennylane-version == ''
run: python -m pip install git+https://github.com/PennyLaneAI/pennylane.git@master

- name: Install required packages
run: |
source /etc/profile.d/modules.sh && module use /opt/modules/ && module load ${{ matrix.mpilib }}
python -m pip install pip~=22.0
python -m pip install ninja cmake custatevec-cu11 pytest pytest-mock flaky pytest-cov mpi4py
SKIP_COMPILATION=True PL_BACKEND=lightning_qubit python -m pip install -e . -vv

- name: Build and install package
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')")
run: |
source /etc/profile.d/modules.sh && module use /opt/modules/ && module load ${{ matrix.mpilib }}
PL_BACKEND=lightning_gpu python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=mpicxx;ENABLE_MPI=ON;CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc;CMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }};Python_EXECUTABLE=${{ steps.python_path.outputs.python }}"
PL_BACKEND=lightning_gpu python -m pip install -e . --verbose

- name: Run PennyLane-Lightning-GPU unit tests
run: |
source /etc/profile.d/modules.sh && module use /opt/modules/ && module load ${{ matrix.mpilib }}
PL_DEVICE=lightning.gpu python -m pytest ./tests/ $COVERAGE_FLAGS
mv coverage.xml coverage-${{ github.job }}-lightning_gpu_${{ matrix.mpilib }}-0.xml
PL_DEVICE=lightning.gpu /opt/mpi/${{ matrix.mpilib }}/bin/mpirun -np 2 python -m pytest ./mpitests $COVERAGE_FLAGS
mv coverage.xml coverage-${{ github.job }}-lightning_gpu_${{ matrix.mpilib }}-1.xml
# PL_DEVICE=lightning.gpu /opt/mpi/${{ matrix.mpilib }}/bin/mpirun --oversubscribe -n 4 pytest -s -x mpitests/test_device.py -k test_create_device $COVERAGE_FLAGS

- name: Upload code coverage results
uses: actions/upload-artifact@v3
with:
name: ubuntu-codecov-results-python
path: coverage-${{ github.job }}-lightning_gpu_${{ matrix.mpilib }}-*.xml
if-no-files-found: error

- name: Cleanup
if: always()
run: |
rm -rf ${{ steps.setup_venv.outputs.venv_name }}
rm -rf * .git .gitignore .github
pip cache purge

upload-to-codecov-linux-cpp:
needs: ["cpp_tests"]
name: Upload coverage data to codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download coverage reports
uses: actions/download-artifact@v3
with:
name: ubuntu-codecov-results-cpp

- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Cleanup
if: always()
run: |
rm -rf ${{ steps.setup_venv.outputs.venv_name }}
rm -rf * .git .gitignore .github
pip cache purge

upload-to-codecov-linux-python:
needs: ["python_tests"]
name: Upload coverage data to codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download coverage reports
uses: actions/download-artifact@v3
with:
name: ubuntu-codecov-results-python

- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Cleanup
if: always()
run: |
rm -rf ${{ steps.setup_venv.outputs.venv_name }}
rm -rf * .git .gitignore .github
pip cache purge
Loading