diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 334d76ffab..d9209800a8 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -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) + * Update the test suite to remove deprecated code. [(#912)](https://github.com/PennyLaneAI/pennylane-lightning/pull/912) diff --git a/.github/workflows/tests_lgpu_cpp.yml b/.github/workflows/tests_gpu_cpp.yml similarity index 80% rename from .github/workflows/tests_lgpu_cpp.yml rename to .github/workflows/tests_gpu_cpp.yml index 143c7ebccf..b88c4392f1 100644 --- a/.github/workflows/tests_lgpu_cpp.yml +++ b/.github/workflows/tests_gpu_cpp.yml @@ -1,4 +1,4 @@ -name: Testing::x86_64::LGPU::C++ +name: Testing::x86_64::GPU::C++ on: workflow_call: inputs: @@ -16,12 +16,6 @@ on: - reopened - synchronize - ready_for_review - paths: - - .github/workflows/tests_lgpu_cpp.yml - - pennylane_lightning/core/src/** - - '!pennylane_lightning/core/src/simulators/lightning_kokkos/**' - - '!pennylane_lightning/core/src/simulators/lightning_qubit/**' - - '!pennylane_lightning/core/src/simulators/lightning_tensor/**' push: branches: - master @@ -30,16 +24,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') }} runs-on: - self-hosted - ubuntu-22.04 @@ -61,16 +53,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 @@ -87,20 +78,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_* @@ -117,7 +108,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 @@ -131,10 +122,19 @@ 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 - sudo apt-get -y -q install liblapack-dev black + python -m pip install ninja cmake scipy + + - name: Install required lightning_gpu only packages + if: matrix.pl_backend == 'lightning_gpu' + run: | + python -m pip install custatevec-cu${{ matrix.cuda_version }} + + - name: Install required lightning_tensor only packages + if: matrix.pl_backend == 'lightning_tensor' + run: | + python -m pip install cutensornet-cu${{ matrix.cuda_version }} - name: Build and run unit tests run: | @@ -143,25 +143,24 @@ 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 @@ -169,14 +168,14 @@ jobs: - 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: diff --git a/.github/workflows/tests_lgpu_python.yml b/.github/workflows/tests_gpu_python.yml similarity index 70% rename from .github/workflows/tests_lgpu_python.yml rename to .github/workflows/tests_gpu_python.yml index 46ca40fea7..2fad7ee75e 100644 --- a/.github/workflows/tests_lgpu_python.yml +++ b/.github/workflows/tests_gpu_python.yml @@ -1,4 +1,4 @@ -name: Testing::x86_64::LGPU::Python +name: Testing::x86_64::GPU::Python on: workflow_call: inputs: @@ -16,16 +16,6 @@ on: - reopened - synchronize - ready_for_review - paths-ignore: - - .github/** - - '!.github/workflows/tests_lgpu_python.yml' - - pennylane_lightning/core/_version.py - - pennylane_lightning/core/src/simulators/lightning_kokkos/** - - pennylane_lightning/core/src/simulators/lightning_qubit/** - - pennylane_lightning/core/src/simulators/lightning_tensor/** - - pennylane_lightning/lightning_kokkos/** - - pennylane_lightning/lightning_qubit/** - - pennylane_lightning/lightning_tensor/** push: branches: - master @@ -34,16 +24,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 @@ -65,11 +53,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 }}) @@ -93,19 +81,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' 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 @@ -117,7 +102,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_* @@ -152,9 +137,18 @@ 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 + python -m pip install cmake openfermionpyscf + + - name: Install required lightning_gpu only packages + if: matrix.pl_backend == 'lightning_gpu' + run: | + python -m pip install custatevec-cu${{ matrix.cuda_version }} + + - name: Install required lightning_tensor only packages + if: matrix.pl_backend == 'lightning_tensor' + run: | + python -m pip install cutensornet-cu${{ matrix.cuda_version }} - name: Checkout PennyLane for release build if: inputs.pennylane-version == 'release' @@ -174,76 +168,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 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 + PL_BACKEND=${{ matrix.pl_backend }} 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: diff --git a/.github/workflows/tests_lmps_tncuda_cpp.yml b/.github/workflows/tests_lmps_tncuda_cpp.yml deleted file mode 100644 index f4aaab6d35..0000000000 --- a/.github/workflows/tests_lmps_tncuda_cpp.yml +++ /dev/null @@ -1,211 +0,0 @@ -name: Testing::Linux::x86_64::MPSTNCuda::C++ -# TODO remove MPS from the workflow name and the workflow filename once exact is in. -# TODO remove the `PL_TENSOR_METHOD` option once exact TN is added. -# TODO remove the `pl_tensor_method` once exact TN is added. -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: - - .github/workflows/tests_lmps_tncuda_cpp.yml - - pennylane_lightning/core/src/** - - '!pennylane_lightning/core/src/simulators/lightning_kokkos/**' - - '!pennylane_lightning/core/src/simulators/lightning_qubit/**' - - '!pennylane_lightning/core/src/simulators/lightning_gpu/**' - 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 - -concurrency: - # TODO: Revert back to using event_name - group: tests_lmps_tncuda_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 - runs-on: - - self-hosted - - ubuntu-22.04 - - gpu - - strategy: - max-parallel: 1 - matrix: - os: [ubuntu-22.04] - pl_backend: ["lightning_tensor"] - cuda_version: ["12"] - - steps: - - name: Validate GPU version and installed compiler - run: | - source /etc/profile.d/modules.sh - module use /opt/modules - module load cuda/${{ matrix.cuda_version }} - echo "${PATH}" >> $GITHUB_PATH - echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV - nvcc --version - nvidia-smi - - cpptestswithMPSTNCuda: - if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }} - needs: [builddeps] - strategy: - matrix: - os: [ubuntu-22.04] - pl_backend: ["lightning_tensor"] - pl_tensor_method: ["mps"] - pl_tensor_backend: ["cutensornet"] - cuda_version: ["12"] - - name: C++ Tests (${{ matrix.pl_backend }}, method-${{ matrix.pl_tensor_method }}, backend-${{ matrix.pl_tensor_backend }}, cuda-${{ matrix.cuda_version }}) - runs-on: - - ${{ matrix.os }} - - self-hosted - - gpu - - steps: - - name: Validate GPU version and installed compiler - run: | - source /etc/profile.d/modules.sh - module use /opt/modules - module load cuda/${{ matrix.cuda_version }} - echo "${PATH}" >> $GITHUB_PATH - echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV - nvcc --version - nvidia-smi - - name: Checkout PennyLane-Lightning-Tensor-MPS-TNCuda - uses: actions/checkout@v4 - with: - path: main - - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.10' - - # 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 - 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 - echo "site_packages_dir=$(${{ env.VENV_NAME }}/bin/python -c 'import sysconfig; print(sysconfig.get_path("platlib"))')" >> $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 scipy custatevec-cu${{ matrix.cuda_version }} cutensornet-cu${{ matrix.cuda_version }} - - 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 }} \ - -DPL_TENSOR_METHOD=${{ matrix.pl_tensor_method }} \ - -DPL_TENSOR_BACKEND=${{ matrix.pl_tensor_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@v4 - if: always() - with: - 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 - 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: [cpptestswithMPSTNCuda] - name: Upload coverage data to codecov - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Download coverage reports - uses: actions/download-artifact@v4 - with: - name: ubuntu-codecov-results-cpp - - - name: Upload to Codecov - uses: codecov/codecov-action@v4 - 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 diff --git a/.github/workflows/tests_lmps_tncuda_python.yml b/.github/workflows/tests_lmps_tncuda_python.yml deleted file mode 100644 index 3fa212d5e5..0000000000 --- a/.github/workflows/tests_lmps_tncuda_python.yml +++ /dev/null @@ -1,213 +0,0 @@ -name: Testing::Linux::x86_64::MPSTNCuda::Python -# TODO remove MPS from the workflow name and the workflow filename once exact is in. -# TODO remove the `pl_tensor_method` once exact TN is added. -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: - - .github/** - - '!.github/workflows/tests_lmps_tncuda_python.yml' - - pennylane_lightning/core/src/simulators/lightning_kokkos/** - - pennylane_lightning/core/src/simulators/lightning_qubit/** - - pennylane_lightning/core/src/simulators/lightning_gpu/** - - pennylane_lightning/core/_version.py - - pennylane_lightning/lightning_gpu/** - - pennylane_lightning/lightning_qubit/** - - pennylane_lightning/lightning_kokkos/** - 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 - -concurrency: - group: tests_lmps_tncuda_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 - runs-on: - - self-hosted - - ubuntu-22.04 - - gpu - - strategy: - max-parallel: 1 - matrix: - os: [ubuntu-22.04] - pl_backend: ["lightning_tensor"] - cuda_version: ["12"] - - steps: - - name: Validate GPU version and installed compiler - run: | - source /etc/profile.d/modules.sh - module use /opt/modules - module load cuda/${{ matrix.cuda_version }} - echo "${PATH}" >> $GITHUB_PATH - echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV - nvcc --version - nvidia-smi - - pythontestswithMPSTNCuda: - if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }} - needs: [builddeps] - strategy: - matrix: - os: [ubuntu-22.04] - pl_backend: ["lightning_tensor"] - pl_tensor_method: ["mps"] - pl_tensor_backend: ["cutensornet"] - cuda_version: ["12"] - - name: Python Tests (${{ matrix.pl_backend }}, method-${{ matrix.pl_tensor_method }}, backend-${{ matrix.pl_tensor_backend }}, cuda-${{ matrix.cuda_version }}) - runs-on: - - ${{ matrix.os }} - - self-hosted - - gpu - - steps: - - name: Validate GPU version and installed compiler - run: | - source /etc/profile.d/modules.sh - module use /opt/modules - module load cuda/${{ matrix.cuda_version }} - echo "${PATH}" >> $GITHUB_PATH - echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV - nvcc --version - nvidia-smi - - - name: Checkout PennyLane-Lightning-Tensor-MPS-TNCuda - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - name: Install Python - with: - python-version: '3.10' - - # 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 - 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 - echo "site_packages_dir=$(${{ env.VENV_NAME }}/bin/python -c 'import sysconfig; print(sysconfig.get_path("platlib"))')" >> $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 - - echo "PIP Path => $py_path" - echo "pip=$py_path" >> $GITHUB_OUTPUT - - - name: Install required packages - run: | - python -m pip install -r requirements-dev.txt - python -m pip install ninja cmake scipy custatevec-cu${{ matrix.cuda_version }} cutensornet-cu${{ matrix.cuda_version }} openfermionpyscf - - - 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: Configure and install required backends - run: | - rm -rf build - PL_BACKEND=lightning_qubit python scripts/configure_pyproject_toml.py - CMAKE_ARGS="-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" python -m pip install . -vv - - rm -rf build - PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py - CMAKE_ARGS="-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" python -m pip install . -vv - - - name: Run PennyLane-Lightning-Tensor unit tests - if: ${{ matrix.pl_backend != 'all'}} - run: | - DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"` - PL_DEVICE=${DEVICENAME} python -m pytest tests $COVERAGE_FLAGS - 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 - 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: [pythontestswithMPSTNCuda] - name: Upload coverage data to codecov - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Download coverage reports - uses: actions/download-artifact@v4 - with: - name: ubuntu-codecov-results-python - - - name: Upload to Codecov - uses: codecov/codecov-action@v4 - with: - fail_ci_if_error: true - verbose: true - token: ${{ secrets.CODECOV_TOKEN }} diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index ebebbc9f97..bb3de8f43b 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.39.0-dev26" +__version__ = "0.39.0-dev27"