diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index a527fb4a8..c526d307d 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -35,6 +35,9 @@ ### Improvements +* Updated concurrency labels for tests ensuring different workflows do not run under the same concurrency group label + [(#778)](https://github.com/PennyLaneAI/pennylane-lightning/pull/778) + * Release candidate branches are automatically switched over to using the new large GitHub runner pool. [(#769)](https://github.com/PennyLaneAI/pennylane-lightning/pull/769) diff --git a/.github/workflows/tests_lgpu_cpp.yml b/.github/workflows/tests_lgpu_cpp.yml index 49e95a490..75c18a276 100644 --- a/.github/workflows/tests_lgpu_cpp.yml +++ b/.github/workflows/tests_lgpu_cpp.yml @@ -30,7 +30,7 @@ env: TORCH_VERSION: 1.11.0+cpu concurrency: - group: tests_lgpu_cpp-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lgpu_cpp-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: @@ -108,6 +108,11 @@ jobs: # 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 @@ -116,14 +121,14 @@ jobs: echo "Python Interpreter Path => $py_path" echo "python=$py_path" >> $GITHUB_OUTPUT - pip_path=$(which python) + pip_path=$(which pip) echo "PIP Path => $pip_path" echo "pip=$pip_path" >> $GITHUB_OUTPUT - name: Install required packages run: | - python -m pip install ninja cmake custatevec-cu${{ matrix.cuda_version }} - sudo apt-get -y -q install liblapack-dev + python -m pip install ninja cmake custatevec-cu${{ matrix.cuda_version }} scipy + sudo apt-get -y -q install liblapack-dev black - name: Build and run unit tests run: | diff --git a/.github/workflows/tests_lgpu_python.yml b/.github/workflows/tests_lgpu_python.yml index a5f3a8ea8..f80672740 100644 --- a/.github/workflows/tests_lgpu_python.yml +++ b/.github/workflows/tests_lgpu_python.yml @@ -34,7 +34,7 @@ env: TORCH_VERSION: 1.11.0+cpu concurrency: - group: tests_lgpu_python-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lgpu_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: @@ -128,6 +128,13 @@ jobs: # 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 diff --git a/.github/workflows/tests_lgpumpi_cpp.yml b/.github/workflows/tests_lgpumpi_cpp.yml index 9bc959ea7..78254ae34 100644 --- a/.github/workflows/tests_lgpumpi_cpp.yml +++ b/.github/workflows/tests_lgpumpi_cpp.yml @@ -29,7 +29,7 @@ env: CI_CUDA_ARCH: 86 concurrency: - group: tests_lgpumpi_cpp-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lgpumpi_cpp-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: @@ -85,6 +85,8 @@ jobs: # 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 - name: Display Python-Path id: python_path diff --git a/.github/workflows/tests_lgpumpi_python.yml b/.github/workflows/tests_lgpumpi_python.yml index dc518de0e..8b97de972 100644 --- a/.github/workflows/tests_lgpumpi_python.yml +++ b/.github/workflows/tests_lgpumpi_python.yml @@ -30,7 +30,7 @@ env: CI_CUDA_ARCH: 86 concurrency: - group: tests_lgpumpi_python-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lgpumpi_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: @@ -90,6 +90,8 @@ jobs: # 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 - name: Display Python-Path diff --git a/.github/workflows/tests_linux_cpp.yml b/.github/workflows/tests_linux_cpp.yml index d0392d6e5..34d1184d1 100644 --- a/.github/workflows/tests_linux_cpp.yml +++ b/.github/workflows/tests_linux_cpp.yml @@ -30,7 +30,7 @@ env: OMP_PROC_BIND: "false" concurrency: - group: tests_linux_cpp-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_linux_cpp-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: diff --git a/.github/workflows/tests_lkcpu_python.yml b/.github/workflows/tests_lkcpu_python.yml index 0db813853..7efc1df00 100644 --- a/.github/workflows/tests_lkcpu_python.yml +++ b/.github/workflows/tests_lkcpu_python.yml @@ -34,7 +34,7 @@ env: OMP_PROC_BIND: "false" concurrency: - group: tests_lkcpu_python-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lkcpu_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: diff --git a/.github/workflows/tests_lkcuda_cpp.yml b/.github/workflows/tests_lkcuda_cpp.yml index fe1bf5b4f..eb95afa76 100644 --- a/.github/workflows/tests_lkcuda_cpp.yml +++ b/.github/workflows/tests_lkcuda_cpp.yml @@ -29,7 +29,7 @@ env: TORCH_VERSION: 1.11.0+cpu concurrency: - group: tests_lkcuda_cpp-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lkcuda_cpp-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: @@ -153,6 +153,33 @@ jobs: 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 + 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: Install dependencies run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION ninja-build gcovr lcov diff --git a/.github/workflows/tests_lkcuda_python.yml b/.github/workflows/tests_lkcuda_python.yml index f8aa87416..1ca076c16 100644 --- a/.github/workflows/tests_lkcuda_python.yml +++ b/.github/workflows/tests_lkcuda_python.yml @@ -33,7 +33,7 @@ env: TORCH_VERSION: 1.11.0+cpu concurrency: - group: tests_lkcuda_python-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lkcuda_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: @@ -173,6 +173,33 @@ jobs: 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 + 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: Install dependencies run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION diff --git a/.github/workflows/tests_lmps_tncuda_cpp.yml b/.github/workflows/tests_lmps_tncuda_cpp.yml index d65f43f3f..583272a53 100644 --- a/.github/workflows/tests_lmps_tncuda_cpp.yml +++ b/.github/workflows/tests_lmps_tncuda_cpp.yml @@ -31,7 +31,8 @@ env: GCC_VERSION: 11 concurrency: - group: tests_lmps_tncuda_cpp-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + # 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: @@ -115,6 +116,13 @@ jobs: # 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 diff --git a/.github/workflows/tests_lmps_tncuda_python.yml b/.github/workflows/tests_lmps_tncuda_python.yml index c45a26676..3e9f6a1d9 100644 --- a/.github/workflows/tests_lmps_tncuda_python.yml +++ b/.github/workflows/tests_lmps_tncuda_python.yml @@ -34,7 +34,7 @@ env: GCC_VERSION: 11 concurrency: - group: tests_lmps_tncuda_python-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lmps_tncuda_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: @@ -121,6 +121,12 @@ jobs: # 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 diff --git a/.github/workflows/tests_lqcpu_python.yml b/.github/workflows/tests_lqcpu_python.yml index 6216fdc23..33eefa04d 100644 --- a/.github/workflows/tests_lqcpu_python.yml +++ b/.github/workflows/tests_lqcpu_python.yml @@ -24,7 +24,7 @@ env: OMP_PROC_BIND: "false" concurrency: - group: tests_lqcpu_python-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_lqcpu_python-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: diff --git a/.github/workflows/tests_windows_cpp.yml b/.github/workflows/tests_windows_cpp.yml index eea4b25e0..2faccc083 100644 --- a/.github/workflows/tests_windows_cpp.yml +++ b/.github/workflows/tests_windows_cpp.yml @@ -20,7 +20,7 @@ on: - '!pennylane_lightning/core/src/simulators/lightning_gpu/**' concurrency: - group: tests_windows_cpp-${{ github.ref }}-${{ github.event }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_windows_cpp-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: diff --git a/.github/workflows/tests_without_binary.yml b/.github/workflows/tests_without_binary.yml index 65aae6dea..919e162a4 100644 --- a/.github/workflows/tests_without_binary.yml +++ b/.github/workflows/tests_without_binary.yml @@ -21,7 +21,7 @@ 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 }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} + group: tests_without_binary-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }} cancel-in-progress: true jobs: diff --git a/.github/workflows/update_dev_version.yml b/.github/workflows/update_dev_version.yml index a7c08fb40..eba14db6e 100644 --- a/.github/workflows/update_dev_version.yml +++ b/.github/workflows/update_dev_version.yml @@ -4,6 +4,11 @@ on: branches: - master +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + + jobs: update-dev-version: name: Update version for development branches diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 9a871e864..3d439e251 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.37.0-dev50" +__version__ = "0.37.0-dev51"