Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Archive LGPU repo #1085

Archive LGPU repo

Archive LGPU repo #1085

name: Wheel::Linux::x86_64
# **What it does**: Builds python wheels for Linux (ubuntu-latest) architecture x86_64 and store it as artifacts.
# Python versions: 3.9, 3.10, 3.11.
# **Why we have it**: To build wheels for pennylane-lightning-gpu installation.
# **Who does it impact**: Wheels to be uploaded to PyPI.
on:
pull_request:
push:
branches:
- main
release:
jobs:
set_wheel_build_matrix:
name: "Set wheel build matrix"
uses: ./.github/workflows/set_wheel_build_matrix.yml
with:
event_name: ${{ github.event_name }}
linux-wheels-x86-64:
needs: [set_wheel_build_matrix]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64]
cibw_build: ${{ fromJson(needs.set_wheel_build_matrix.outputs.python_version) }}
name: ${{ matrix.os }} (Python ${{ fromJson('{ "cp39-*":"3.9","cp310-*":"3.10","cp311-*":"3.11" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- name: Checkout PennyLane-Lightning-GPU
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel~=2.11.0
- name: Build wheels
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_BUILD_FRONTEND: "pip"
CIBW_SKIP: "*-musllinux*"
CIBW_CONFIG_SETTINGS: --global-option=build_ext --global-option=--define="CMAKE_CXX_COMPILER=$(which g++-11);CMAKE_C_COMPILER=$(which gcc-11);LIGHTNING_RELEASE_TAG=master"
# Python build settings
CIBW_BEFORE_BUILD: |
python -m pip install ninja cmake~=3.24.3 auditwheel
python -m pip install custatevec-cu11
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo -y
yum clean all
yum -y install cuda-11-5 git openssh wget
# ensure nvcc is available
CIBW_ENVIRONMENT: PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')")
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "./docker/auditwheel repair -w {dest_dir} {wheel}"
run: python -m cibuildwheel --output-dir wheelhouse
- name: Validate wheels
run: |
python -m pip install twine
python -m twine check ./wheelhouse/*.whl
- uses: actions-ecosystem/action-regex-match@v2.0.2
id: rc_build
with:
text: ${{ github.event.pull_request.head.ref }}
regex: '.*[0-9]+.[0-9]+.[0-9]+[-_]?rc[0-9]+'
- uses: actions/upload-artifact@v2
if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' || steps.rc_build.outputs.match != ''}}
with:
name: ${{ runner.os }}-wheels
path: ./wheelhouse/*.whl
upload-pypi:
needs: linux-wheels-x86-64
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main'}}
steps:
- uses: actions/download-artifact@v2
with:
name: Linux-wheels
path: dist
- name: Upload wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/