-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full CI support for public builds + switch to use cibuildwheel #267
Changes from 62 commits
0141cbf
79fd67a
92283dc
6666e90
c96fef3
ea77572
508a126
beff50d
a935da2
df982e5
426cd58
d167a55
9cd0803
261b1e5
9134f89
762ad76
0d3c32b
37006e8
0ab5067
d42f8dd
55c0370
f3356f4
5480f10
4b1a431
7044c8b
9fbdff2
8f77f17
29e9e2e
e2cffce
a7157b5
965b23f
8ae7bd2
2175ccb
50eb0e7
b0046ac
4932667
7cb84c3
d97fbdd
59e4e0a
2ab0877
cac9de8
a3ef630
26af84d
cdbdfb5
8a61031
35b8826
8e42dc4
1588e57
e13854d
4f73509
128ab12
6087a54
b05e95d
0c91ed8
33f35c3
4b3341a
3503dae
dc12840
c55bdc5
bdb3599
c8fd323
0d554f0
19445d5
15626a8
07b8d1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,51 +22,179 @@ inputs: | |
python-version: | ||
required: true | ||
type: string | ||
cuda-version: | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set REPO_DIR and Dump environment | ||
# WAR: setup-python is not relocatable... | ||
# see https://github.com/actions/setup-python/issues/871 | ||
- name: Set up Python ${{ inputs.python-version }} | ||
if: ${{ startsWith(inputs.host-platform, 'linux') }} | ||
id: setup-python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
Comment on lines
+32
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically we don't need this step. However, because |
||
|
||
# - name: Set up new PowerShell (pwsh) | ||
leofang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# if: ${{ startsWith(inputs.host-platform, 'win') }} | ||
# shell: powershell | ||
# env: | ||
# # doesn't seem there's an easy way to avoid hard-coding it? | ||
# PS_MSI_URL: https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x64.msi | ||
# run: | | ||
# Invoke-WebRequest -Uri "$env:PS_MSI_URL" -OutFile "ps_installer.msi" | ||
# Start-Process msiexec.exe -Wait -Verbose -ArgumentList '/i "ps_installer.msi" /qn REGISTER_MANIFEST=1' | ||
# echo "$env:ProgramFiles\\PowerShell\\7" >> $env:GITHUB_PATH | ||
leofang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# - name: Install MSVC | ||
# if: ${{ startsWith(inputs.host-platform, 'win') }} | ||
# shell: pwsh | ||
# run: | | ||
# # Download & install | ||
# .\\continuous_integration\\scripts\\install-vs.ps1 -msvcVersion 15 -clVersion 14.16 | ||
|
||
# # Verify | ||
# # Note: this assumes vs2017, e.g. see _find_vc2017(): | ||
# # https://github.com/pypa/setuptools/blob/9692cde009af4651819d18a1e839d3b6e3fcd77d/setuptools/_distutils/_msvccompiler.py#L67 | ||
# $vsPath = & "${env:ProgramFiles(x86)}\\Microsoft Visual Studio\\Installer\\vswhere.exe" ` | ||
# -latest ` | ||
# -products * ` | ||
# -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` | ||
# -property installationPath | ||
# $clPath = Join-Path $vsPath "VC\\Tools\\MSVC\\*\\bin\\Hostx64\\x64\\cl.exe" | ||
# $clPath = (Get-ChildItem $clPath).FullName | ||
# echo "found cl.exe: $clPath" | ||
# # # For some reason below just doesn't work in the CI... | ||
# # Start-Process -NoNewWindow -RedirectStandardError cl.out -FilePath "$clPath" | ||
# # $CL_VERSION_STRING = & type cl.out | ||
# # if (($CL_VERSION_STRING -join " ") -match "Version (\\d+\\.\\d+)\\.\\d+") { | ||
# # $CL_VERSION = $matches[1] | ||
# # echo "Detected cl.exe version: $CL_VERSION" | ||
# # } | ||
|
||
# # Delete temporary items created by installers and such | ||
# Remove-Item -Recurse "${env:TEMP}\\*" | ||
leofang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Set up MSVC | ||
if: ${{ startsWith(inputs.host-platform, 'win') }} | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
# with: | ||
# toolset: 14.16 | ||
# vsversion: 2017 | ||
|
||
- name: Dump environment | ||
shell: bash --noprofile --norc -xeuo pipefail {0} | ||
run: | | ||
echo "REPO_DIR=$(pwd)" >> $GITHUB_ENV | ||
env | ||
|
||
- name: Set environment variables | ||
- name: Get CUDA components | ||
shell: bash --noprofile --norc -xeuo pipefail {0} | ||
run: | | ||
CUDA_PATH="./cuda_toolkit" | ||
mkdir $CUDA_PATH | ||
|
||
WITH_TESTS_STR='' | ||
if [[ ("${{ inputs.upload-enabled }}" == "false") && ("${{ inputs.build-type }}" != "ci") ]]; then | ||
WITH_TESTS_STR='-with_tests' | ||
# The binary archives (redist) are guaranteed to be updated as part of the release posting. | ||
CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/" | ||
CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json" | ||
if [[ "${{ inputs.host-platform }}" == linux* ]]; then | ||
if [[ "${{ inputs.host-platform }}" == "linux-x64" ]]; then | ||
CTK_SUBDIR="linux-x86_64" | ||
elif [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then | ||
CTK_SUBDIR="linux-sbsa" | ||
fi | ||
function extract() { | ||
tar -xvf $1 -C $CUDA_PATH --strip-components=1 | ||
} | ||
elif [[ "${{ inputs.host-platform }}" == "win-x64" ]]; then | ||
CTK_SUBDIR="windows-x86_64" | ||
function extract() { | ||
_TEMP_DIR_=$(mktemp -d) | ||
unzip $1 -d $_TEMP_DIR_ | ||
cp -r $_TEMP_DIR_/*/* $CUDA_PATH | ||
rm -rf $_TEMP_DIR_ | ||
} | ||
fi | ||
function populate_cuda_path() { | ||
# take the component name as a argument | ||
function download() { | ||
curl -kLSs $1 -o $2 | ||
} | ||
CTK_COMPONENT=$1 | ||
CTK_COMPONENT_REL_PATH="$(curl -s $CTK_JSON_URL | | ||
python -c "import sys, json; print(json.load(sys.stdin)['${CTK_COMPONENT}']['${CTK_SUBDIR}']['relative_path'])")" | ||
CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}" | ||
CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)" | ||
download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME | ||
extract $CTK_COMPONENT_COMPONENT_FILENAME | ||
rm $CTK_COMPONENT_COMPONENT_FILENAME | ||
} | ||
|
||
# Get headers and shared libraries in place | ||
populate_cuda_path cuda_nvcc | ||
populate_cuda_path cuda_cudart | ||
populate_cuda_path cuda_nvrtc | ||
populate_cuda_path cuda_profiler_api | ||
ls -l $CUDA_PATH | ||
|
||
TARGET_PLATFORM='linux-64' | ||
if [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then | ||
# Note: the headers will be copied into the cibuildwheel manylinux container, | ||
# so setting the CUDA_PATH env var here is meaningless. | ||
|
||
- name: Set environment variables | ||
shell: bash --noprofile --norc -xeuo pipefail {0} | ||
run: | | ||
# TODO: just align host-platform names with TARGET_PLATFORM... | ||
if [[ "${{ inputs.host-platform }}" == "linux-x64" ]]; then | ||
TARGET_PLATFORM='linux-64' | ||
elif [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then | ||
TARGET_PLATFORM='linux-aarch64' | ||
elif [[ "${{ inputs.host-platform }}" == "win-x64" ]]; then | ||
TARGET_PLATFORM='win-64' | ||
fi | ||
|
||
BUILD_MODE="${{ inputs.build-mode }}" | ||
BUILD_MODE_STR="" | ||
[ -n "${BUILD_MODE}" ] && BUILD_MODE_STR="-${BUILD_MODE}" | ||
if [[ "${{ inputs.host-platform }}" == linux* ]]; then | ||
leofang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if [[ "${{ inputs.python-version }}" == "3.12" ]]; then | ||
CIBW_BUILD='cp312-manylinux*' | ||
elif [[ "${{ inputs.python-version }}" == "3.11" ]]; then | ||
CIBW_BUILD='cp311-manylinux*' | ||
elif [[ "${{ inputs.python-version }}" == "3.10" ]]; then | ||
CIBW_BUILD='cp310-manylinux*' | ||
elif [[ "${{ inputs.python-version }}" == "3.9" ]]; then | ||
CIBW_BUILD='cp39-manylinux*' | ||
fi | ||
REPO_DIR=$(pwd) | ||
elif [[ "${{ inputs.host-platform }}" == win* ]]; then | ||
if [[ "${{ inputs.python-version }}" == "3.12" ]]; then | ||
CIBW_BUILD='cp312-win_amd64' | ||
elif [[ "${{ inputs.python-version }}" == "3.11" ]]; then | ||
CIBW_BUILD='cp311-win_amd64' | ||
elif [[ "${{ inputs.python-version }}" == "3.10" ]]; then | ||
CIBW_BUILD='cp310-win_amd64' | ||
elif [[ "${{ inputs.python-version }}" == "3.9" ]]; then | ||
CIBW_BUILD='cp39-win_amd64' | ||
fi | ||
PWD=$(pwd) | ||
REPO_DIR=$(cygpath -w $PWD) | ||
fi | ||
|
||
BUILD_MODE="${{ inputs.build-mode }}" | ||
if [[ ("${BUILD_MODE}" == "") || ("${BUILD_MODE}" == "release") ]]; then | ||
# We upload release versions in the default folder. | ||
PKG_DIR="${TARGET_PLATFORM}" | ||
else | ||
PKG_DIR="${BUILD_MODE}/${TARGET_PLATFORM}" | ||
fi | ||
|
||
PYTHON_VERSION_FORMATTED=$(echo '${{ inputs.python-version }}' | tr -d '.') | ||
|
||
echo "BINDINGS_ARTIFACT_NAME=${{ inputs.host-platform }}-${{ inputs.build-type }}-cuda_bindings-python${PYTHON_VERSION_FORMATTED}-${{ inputs.target-device }}${BUILD_MODE_STR}${WITH_TESTS_STR}-${{ github.sha }}" >> $GITHUB_ENV | ||
leofang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "BINDINGS_ARTIFACTS_DIR=$(realpath "$(pwd)/cuda_bindings/dist")" >> $GITHUB_ENV | ||
echo "CORE_ARTIFACT_NAME=${{ inputs.host-platform }}-${{ inputs.build-type }}-cuda_core-python${PYTHON_VERSION_FORMATTED}-${{ inputs.target-device }}${BUILD_MODE_STR}${WITH_TESTS_STR}-${{ github.sha }}" >> $GITHUB_ENV | ||
echo "CORE_ARTIFACTS_DIR=$(realpath "$(pwd)/cuda_core/dist")" >> $GITHUB_ENV | ||
echo "USE_CUDA=${{ (inputs.target-device == 'cpu' && 'OFF') || 'ON' }}" >> $GITHUB_ENV | ||
echo "PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV | ||
echo "REPO_DIR=$REPO_DIR" >> $GITHUB_ENV | ||
echo "PKG_DIR=${PKG_DIR}" >> $GITHUB_ENV | ||
echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${{ inputs.python-version }}-${{ inputs.host-platform }}-${{ inputs.build-type }}-${{ github.sha }}" >> $GITHUB_ENV | ||
echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV | ||
echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${{ inputs.python-version }}-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ inputs.build-type }}-${{ github.sha }}" >> $GITHUB_ENV | ||
echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV | ||
echo "UPLOAD_ENABLED=${{ (inputs.upload-enabled == 'true' && 'ON') || 'OFF' }}" >> $GITHUB_ENV | ||
echo "LEGATE_CORE_BUILD_MODE=${BUILD_MODE}" >> $GITHUB_ENV | ||
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV | ||
echo "TARGET_PLATFORM=${TARGET_PLATFORM}" >> $GITHUB_ENV | ||
echo "PKG_DIR=${PKG_DIR}" >> $GITHUB_ENV | ||
echo "PYTHON_VERSION=${{ inputs.python-version }}" >> $GITHUB_ENV | ||
echo "CIBW_BUILD=${CIBW_BUILD}" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This was commented out because of #271.