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

[WIP] Add lgpu docs #523

Closed
wants to merge 129 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 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
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
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
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
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
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
6bc75d7
tidy up code and add more tests
multiphaseCFD Oct 17, 2023
5f20309
add more unit tests for algorithm
multiphaseCFD Oct 17, 2023
76e5783
more unit tests in py layer
multiphaseCFD Oct 17, 2023
2a3dab9
add adjoint tests for sparseH
multiphaseCFD Oct 17, 2023
0974aa2
make format
multiphaseCFD Oct 17, 2023
72f07d1
quick fix
multiphaseCFD Oct 17, 2023
bc998fd
quick fix
multiphaseCFD Oct 17, 2023
967bea2
another fix
multiphaseCFD Oct 17, 2023
c26c109
fix
multiphaseCFD Oct 18, 2023
fb8a017
fix codecov complaints
multiphaseCFD Oct 18, 2023
16dd415
resolve comments
multiphaseCFD Oct 18, 2023
9c6e08f
add appropriate license
multiphaseCFD Oct 18, 2023
e867229
tidy up
multiphaseCFD Oct 18, 2023
25f0880
quick fix
multiphaseCFD Oct 18, 2023
ae3d255
add docstring to LGPU
multiphaseCFD Oct 18, 2023
d111cb1
Auto update version
github-actions[bot] Oct 18, 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
8 changes: 7 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

### New features since last release

* 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)

* Build Linux wheels for Lightning-GPU (CUDA-11).
[(#517)](https://github.com/PennyLaneAI/pennylane-lightning/pull/517)

* Add `Dockerfile` in `docker` and `make docker` workflow in `Makefile`. The Docker images and documentation are available on [DockerHub](https://hub.docker.com/repository/docker/pennylaneai/pennylane).
[(#496)](https://github.com/PennyLaneAI/pennylane-lightning/pull/496)

Expand Down Expand Up @@ -78,7 +84,7 @@

This release contains contributions from (in alphabetical order):

Ali Asadi, Amintor Dusko, Vincent Michaud-Rioux, Lee J. O'Riordan
Ali Asadi, Amintor Dusko, Vincent Michaud-Rioux, Lee J. O'Riordan, Shuli Shu

---

Expand Down
325 changes: 325 additions & 0 deletions .github/workflows/tests_gpu_cu11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
name: Testing::Linux::x86_64 (Lightning-GPU)
on:
pull_request:
push:
branches:
- master

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_gpu-${{ github.ref }}
cancel-in-progress: true

jobs:
builddeps:
runs-on:
- self-hosted
- ubuntu-22.04
- gpu

strategy:
max-parallel: 1
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_gpu"]

steps:
- name: Validate GPU version and installed compiler
run: |
source /etc/profile.d/modules.sh
module use /opt/modules
module load cuda/11.8
echo "${PATH}" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
nvcc --version
nvidia-smi

cpptestswithLGPU_cu11:
needs: [builddeps]
strategy:
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_gpu"]

name: C++ tests (Lightning-GPU)
runs-on: ${{ matrix.os }}

steps:
- name: Validate GPU version and installed compiler
run: |
source /etc/profile.d/modules.sh
module use /opt/modules
module load cuda/11.8
echo "${PATH}" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
nvcc --version
nvidia-smi

- name: Checkout PennyLane-Lightning-GPU
uses: actions/checkout@v3
with:
path: main
fetch-depth: 2

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

- 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: 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: |
cd main
cmake . -BBuild \
-DCUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")\
-DBUILD_TESTS=ON \
-DENABLE_PYTHON=OFF \
-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 }}
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 }}.info
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: ubuntu-tests-reports-${{ github.job }}_${{ matrix.pl_backend }}
path: ./main/Build/tests/results_${{ github.job }}_${{ matrix.pl_backend }}
if-no-files-found: error

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

pythontestswithLGPU:
needs: [builddeps]
strategy:
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_gpu"]
default_backend: ["lightning_qubit"]

name: Python tests with LGPU
runs-on: ${{ matrix.os }}

steps:
- name: Validate GPU version and installed compiler
run: |
source /etc/profile.d/modules.sh
module use /opt/modules
module load cuda/11.8
echo "${PATH}" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
nvcc --version
nvidia-smi

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

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

- 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: |
python -m pip install pip~=22.0
python -m pip install ninja cmake custatevec-cu11 pytest pytest-mock flaky pytest-cov

- name: Build and install package
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")
run: |
cd main
rm -rf build
CMAKE_ARGS="-DPL_BACKEND=${{ matrix.default_backend }} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \
python -m pip install -e . -vv
rm -rf build

rm -rf build
CMAKE_ARGS="-DPL_BACKEND=${{ matrix.pl_backend }} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) -DPython_EXECUTABLE=${{ steps.python_path.outputs.python }}" \
python -m pip install -e . -vv

- name: Run PennyLane-Lightning-GPU unit tests
if: ${{ matrix.pl_backend != 'all'}}
env:
OMP_NUM_THREADS: 1
OMP_PROC_BIND: false
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
CMAKE_ARGS="-DPL_BACKEND=${{matrix.default_backend}} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \
python -m pip install -e . -vv
rm -rf build

CMAKE_ARGS="-DPL_BACKEND=${{ matrix.pl_backend }} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \
python -m pip install -e . -vv

- name: Run PennyLane-Lightning unit tests for lightning.qubit with all devices installed
if: ${{ matrix.pl_backend == 'all' }}
env:
OMP_NUM_THREADS: 1
OMP_PROC_BIND: false
run: |
cd main/
PL_DEVICE=lightning.qubit python -m pytest tests/ $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
mv coverage.xml coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml

- name: Upload code coverage results
uses: actions/upload-artifact@v3
with:
name: ubuntu-codecov-results-python
path: ./main/coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml

upload-to-codecov-linux-python:
needs: [pythontestswithLGPU]
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
token: ${{ secrets.CODECOV_TOKEN }}

upload-to-codecov-linux-cpp:
needs: [cpptestswithLGPU_cu11]
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
token: ${{ secrets.CODECOV_TOKEN }}

- name: Cleanup
if: always()
run: |
rm -rf ${{ steps.setup_venv.outputs.venv_name }}
rm -rf *
rm -rf .git
rm -rf .gitignore
rm -rf .github
pip cache purge
4 changes: 2 additions & 2 deletions .github/workflows/tests_without_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_qubit", "lightning_kokkos"]
pl_backend: ["lightning_qubit", "lightning_kokkos", "lightning_gpu"]

steps:
- name: Checkout PennyLane-Lightning
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
python -m pip uninstall -y pennylane && python -m pip install -U pennylane

- name: Install the pennylane_lightning package
if: ${{ matrix.pl_backend == 'lightning_kokkos'}}
if: ${{ matrix.pl_backend == 'lightning_kokkos' || matrix.pl_backend == 'lightning_gpu'}}
run: |
cd main
SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" pip install -e . -vv
Expand Down
Loading