-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUILD(cfg): Add build toolchain for CUDA variant
- Loading branch information
Showing
9 changed files
with
373 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
# Provide continuous delivery (CD) for CUDA-enabled builds. | ||
# | ||
# CD deliverables currently include: | ||
# - (natively) built Python wheel distributions (for PyPI); | ||
# - (natively) built Conda packages (for Anaconda). | ||
# | ||
name: continuous-delivery-cuda-xplatform | ||
|
||
on: [] | ||
# push: | ||
# tags: | ||
# - 'v[0-9]+.[0-9]+.[0-9]+' | ||
# - 'v[0-9]+.[0-9]+.[0-9]+.post[0-9]+' | ||
# - 'v[0-9]+.[0-9]+.[0-9]+.dev[0-9]+' | ||
# - 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+' | ||
# paths: | ||
# - deploy/pkg/conda_recipe_cuda_xp/** | ||
# - .github/workflows/cd_cuda_xp.yml | ||
# workflow_dispatch: | ||
# inputs: | ||
# run_build_bdist_cuda_xplat: | ||
# description: 'Run job build_bdist_cuda_xplat' | ||
# type: boolean | ||
# default: false | ||
# required: false | ||
# run_build_conda_cuda_xplat: | ||
# description: 'Run job build_conda_cuda_xplat' | ||
# type: boolean | ||
# default: false | ||
# required: false | ||
# version_tag: | ||
# description: 'Version tag for delivery' | ||
# type: string | ||
# required: false | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_bdist_cuda_xplat: | ||
name: Build bdist wheel (CUDA, cross-platform) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
timeout-minutes: 100 | ||
|
||
# Allow manual trigger from inputs. | ||
if: > | ||
github.event_name != 'workflow_dispatch' || | ||
github.event.inputs.run_build_bdist_cuda_xplat == 'true' | ||
steps: | ||
- name: Extract platform architecture | ||
run: | | ||
if [[ $(uname -m) == 'aarch64' ]]; then | ||
echo "TARGET_ARCH=x86_64" >> "${GITHUB_ENV}" | ||
elif [[ $(uname -m) == 'x86_64' ]]; then | ||
echo "TARGET_ARCH=aarch64" >> "${GITHUB_ENV}" | ||
echo "TARGET_ARCH_ALT=arm64" >> "${GITHUB_ENV}" | ||
fi | ||
- name: Checkout (automatic trigger) | ||
if: github.event_name != 'workflow_dispatch' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout (manual trigger) | ||
if: > | ||
github.event.inputs.run_build_bdist_cuda_xplat == 'true' && | ||
github.event.inputs.version_tag == '' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
|
||
- name: Checkout (manual trigger with tag) | ||
if: > | ||
github.event.inputs.run_build_bdist_cuda_xplat == 'true' && | ||
github.event.inputs.version_tag != '' | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: refs/tags/${{ github.event.inputs.version_tag }} | ||
|
||
# Use QEMU for non-native Linux runner. | ||
- name: Set up QEMU (Linux) | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
# Specify target architecture. | ||
platforms: linux/${{ env.TARGET_ARCH_ALT }} | ||
|
||
- name: Set up Python 3 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install packaging requirements | ||
run: python -m pip install --upgrade twine | ||
|
||
- name: Copy Python project configuration file | ||
run: cp .pyproject_cuda.toml pyproject.toml | ||
|
||
- name: Build built distribution | ||
uses: pypa/cibuildwheel@v2.20.0 | ||
with: | ||
package-dir: . | ||
output-dir: dist/ | ||
config-file: pyproject.toml | ||
env: | ||
# Specify target architecture, which is actually fixed to aarch64. | ||
CIBW_ARCHS_LINUX: ${{ env.TARGET_ARCH }} | ||
CIBW_BEFORE_ALL_LINUX: > | ||
yum install -y gsl-devel && | ||
yum install -y yum-utils && | ||
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/aarch64/cuda-rhel9.repo && | ||
yum install -y nvidia-container-toolkit | ||
- name: Verify built distribution | ||
run: python -m twine check --strict dist/* | ||
|
||
- name: Save wheel to bdist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: bdist_whl_${{ matrix.os }}_${{ env.TARGET_ARCH }}_${{ github.ref_name }}_cuda | ||
path: dist/*.whl | ||
|
||
- name: Save wheel to pypi_dist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pypi_dist_${{ runner.os }}_${{ env.TARGET_ARCH }}_${{ github.ref_name }}_cuda | ||
path: dist/*.whl | ||
|
||
build_conda_cuda: | ||
name: Build Conda package (CUDA, cross-platform) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
timeout-minutes: 120 | ||
|
||
if: > | ||
github.event_name != 'workflow_dispatch' || | ||
github.event.inputs.run_build_conda_cuda_xplat == 'true' | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
|
||
steps: | ||
- name: Extract platform architecture | ||
run: | | ||
if [[ $(uname -m) == 'aarch64' ]]; then | ||
echo "TARGET_ARCH=x86_64" >> "${GITHUB_ENV}" | ||
elif [[ $(uname -m) == 'x86_64' ]]; then | ||
echo "TARGET_ARCH=aarch64" >> "${GITHUB_ENV}" | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up (Mini)conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
activate-environment: conda_bld | ||
channels: conda-forge,nvidia | ||
channel-priority: strict | ||
architecture: ${{ env.TARGET_ARCH }} | ||
|
||
- name: Install packaging requirements | ||
run: | | ||
conda install -y conda-build conda-verify conda-package-handling | ||
# `cph` not found otherwise. | ||
conda_root=$(conda config --show root_prefix | sed 's/root_prefix: //') | ||
conda_env=${conda_root}/envs/conda_bld | ||
export PATH="$PATH:${conda_root}/bin:${conda_env}/bin" | ||
- name: Override version | ||
if: github.event_name == 'workflow_dispatch' | ||
env: | ||
recipe_file: deploy/pkg/conda_recipe_cuda_xp/meta.yaml | ||
run: | | ||
vers_tag=${{ github.event.inputs.version_tag }} | ||
if [[ ! -z ${vers_tag} ]]; then | ||
sed -i "s/# git_rev:.*/git_rev: ${vers_tag}/g" ${recipe_file} | ||
fi | ||
- name: Build Conda package | ||
env: | ||
recipe_dir: deploy/pkg/conda_recipe_cuda_xp | ||
output_dir: dist/ | ||
variants: "{'python': ['3.10', '3.11', '3.12']}" | ||
run: | | ||
# Create output directory if non-existent. | ||
if [[ ! -d ${output_dir} ]]; then mkdir -p ${output_dir}; fi | ||
# Build. | ||
conda build --strict-verify --no-anaconda-upload ${recipe_dir} \ | ||
--variants "${variants}" --output-folder ${output_dir} | ||
# Transmute. | ||
find ${output_dir} -name '*.tar.bz2' \ | ||
-exec cph transmute {} .conda --out-folder ${output_dir} \; | ||
- name: Save build to conda_bld | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: conda_bld_${{ matrix.os }}_${{ github.ref_name }}_cuda | ||
path: dist/* | ||
|
||
- name: Save build to conda_dist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: conda_dist_${{ runner.os }}_${{ runner.arch }}_${{ github.ref_name }}_cuda | ||
path: | | ||
dist/**/*.tar.bz2 | ||
dist/*.conda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
target_platform: | ||
- linux-64 # [linux] | ||
- linux-aarch64 # [linux] | ||
# - linux-aarch64 # [linux] | ||
|
||
cuda_version: | ||
- 12.0 |
Oops, something went wrong.