Skip to content

Build wheels

Build wheels #62

Workflow file for this run

name: Build wheels
on:
workflow_dispatch:
inputs:
build_type:
type: choice
required: true
description: 'Build Type'
default: 'Release'
options:
- 'Release'
- 'Debug'
artifacts_from_run:
type: string
description: Optional argument to take artifacts from a prior run of this workflow; facilitates rerunning a failed workflow without re-building the artifacts.
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-cudaqx-wheels:
name: Build CUDA-QX wheels
runs-on: linux-${{ matrix.platform }}-cpu8
# CUDAQ requires a highly specialized environment to build. Thus, it is much
# easier to rely on their's devdeps images to do the building.
# FIXME: there is no guarantee that this CUDA-Q image aligns with the CUDA-Q
# commit that we are trying to align with.
container: ${{ inputs.artifacts_from_run && 'ubuntu:22.04' || format('ghcr.io/nvidia/cuda-quantum-devdeps:manylinux-{0}-{1}-main', matrix.platform, matrix.toolchain.id) }}
permissions:
actions: write
contents: read
strategy:
fail-fast: false
matrix:
python: ['3.10', '3.11', '3.12']
platform: ['amd64', 'arm64']
toolchain:
- id: cu12.0-gcc11
cc: gcc-11
cxx: g++-11
build-type: Release
steps:
- name: Get code
if: ${{ !inputs.artifacts_from_run }}
uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Get required CUDAQ version
if: ${{ !inputs.artifacts_from_run }}
id: get-cudaq-version
uses: ./.github/actions/get-cudaq-version
- name: Get CUDAQ code
if: ${{ !inputs.artifacts_from_run }}
uses: actions/checkout@v4
with:
repository: ${{ steps.get-cudaq-version.outputs.repo }}
ref: ${{ steps.get-cudaq-version.outputs.ref }}
path: cudaq
set-safe-directory: true
- name: Build CUDAQ toolchain
if: ${{ !inputs.artifacts_from_run }}
run: |
.github/workflows/scripts/build_cudaq.sh ${{ matrix.python }}
- name: Build wheels
if: ${{ !inputs.artifacts_from_run }}
run: |
.github/workflows/scripts/build_wheels.sh \
--cudaq-prefix $HOME/.cudaq \
--build-type ${{ inputs.build_type }} \
--python-version ${{ matrix.python }}
- name: Upload artifact
if: ${{ !inputs.artifacts_from_run }}
uses: actions/upload-artifact@v4
with:
name: wheels-py${{ matrix.python }}-${{ matrix.platform }}
path: /wheels/**
# Building the CUDA-Q wheels must be done outside of a container context, so
# this is a separate job.
build-cudaq-wheels:
name: Build CUDA-Q wheels
strategy:
fail-fast: false
matrix:
platform: ['amd64', 'arm64']
runs-on: ${{ startsWith(github.repository, 'NVIDIA/cudaqx') && format('linux-{0}-cpu32', matrix.platform) || 'ubuntu-latest' }}
permissions:
actions: write
contents: read
pull-requests: read
steps:
- name: Get code
if: ${{ !inputs.artifacts_from_run }}
uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Get required CUDAQ version
if: ${{ !inputs.artifacts_from_run }}
id: get-cudaq-version
uses: ./.github/actions/get-cudaq-version
- name: Get CUDAQ wheels
if: ${{ !inputs.artifacts_from_run }}
uses: ./.github/actions/get-cudaq-wheels
with:
repo: ${{ steps.get-cudaq-version.outputs.repo }}
ref: ${{ steps.get-cudaq-version.outputs.ref }}
token: ${{ secrets.CUDAQ_ACCESS_TOKEN }}
save-build: true
platform: ${{ matrix.platform }}
- name: Upload CUDAQ wheels
if: ${{ !inputs.artifacts_from_run }}
uses: actions/upload-artifact@v4
with:
name: cudaq-wheels-${{ matrix.platform }}
path: /cudaq-wheels
retention-days: 10
if-no-files-found: error
test-cudaqx-wheels:
name: Test CUDA-QX wheels (CPU)
needs: [build-cudaqx-wheels, build-cudaq-wheels]
runs-on: linux-${{ matrix.platform }}-cpu4
container: ubuntu:22.04
permissions:
actions: write
contents: read
strategy:
fail-fast: false
matrix:
python: ['3.10', '3.11', '3.12']
platform: ['amd64', 'arm64']
steps:
- name: Get code
uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install requirements
run: |
bash .github/workflows/scripts/install_git_cli.sh
apt install -y --no-install-recommends libgfortran5 unzip
- name: Download CUDA-Q wheels
uses: actions/download-artifact@v4
with:
name: cudaq-wheels-${{ matrix.platform }}
path: /cudaq-wheels
run-id: ${{ inputs.artifacts_from_run || github.run_id }}
github-token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Download CUDA-QX wheels
uses: actions/download-artifact@v4
with:
name: wheels-py${{ matrix.python }}-${{ matrix.platform }}
path: /wheels
run-id: ${{ inputs.artifacts_from_run || github.run_id }}
github-token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Test wheels
run: |
ls /wheels
bash scripts/ci/test_wheels.sh ${{ matrix.python }}
test-wheels-gpu:
name: Test CUDA-QX wheels (GPU)
needs: [build-cudaqx-wheels, build-cudaq-wheels]
runs-on: linux-${{ matrix.runner.arch }}-gpu-${{ matrix.runner.gpu }}-latest-1
container:
image: nvidia/cuda:12.0.0-base-ubuntu22.04
# Enable this if you want to collect core files. (You may might to enable
# Debug builds if you're doing this.)
#options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
permissions:
actions: write
contents: read
strategy:
fail-fast: false
matrix:
runner: [
{ arch: arm64, gpu: a100 },
{ arch: amd64, gpu: v100 },
]
python: ['3.10', '3.11', '3.12']
steps:
- name: Get code
uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install requirements
run: |
bash .github/workflows/scripts/install_git_cli.sh
apt install -y --no-install-recommends libgfortran5 unzip
#echo 'core.%p' | tee /proc/sys/kernel/core_pattern
#echo "Running cat /proc/sys/kernel/core_pattern"
#cat /proc/sys/kernel/core_pattern
- name: Download CUDA-Q wheels
uses: actions/download-artifact@v4
with:
name: cudaq-wheels-${{ matrix.platform }}
path: /cudaq-wheels
run-id: ${{ inputs.artifacts_from_run || github.run_id }}
github-token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Download CUDA-QX wheels
uses: actions/download-artifact@v4
with:
name: wheels-py${{ matrix.python }}-${{ matrix.runner.arch }}
path: /wheels
run-id: ${{ inputs.artifacts_from_run || github.run_id }}
github-token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Test wheels
run: |
ls /wheels
bash scripts/ci/test_wheels.sh ${{ matrix.python }}
# - name: Upload any core files
# if: success() || failure()
# uses: actions/upload-artifact@v4
# with:
# name: core-files-${{ matrix.python }}-arm64
# path: core.*