@@ -22,51 +22,121 @@ inputs:
22
22
python-version :
23
23
required : true
24
24
type : string
25
+ cuda-version :
26
+ required : true
27
+ type : string
25
28
26
29
runs :
27
30
using : composite
28
31
steps :
29
- - name : Set REPO_DIR and Dump environment
32
+ # WAR: setup-python is not relocatable...
33
+ # see https://github.com/actions/setup-python/issues/871
34
+ - name : Set up Python ${{ inputs.python-version }}
35
+ if : ${{ startsWith(inputs.host-platform, 'linux') }}
36
+ id : setup-python
37
+ uses : actions/setup-python@v5
38
+ with :
39
+ python-version : " 3.12"
40
+
41
+ - name : Set up MSVC
42
+ if : ${{ startsWith(inputs.host-platform, 'win') }}
43
+ uses : ilammy/msvc-dev-cmd@v1
44
+
45
+ - name : Dump environment
30
46
shell : bash --noprofile --norc -xeuo pipefail {0}
31
47
run : |
32
- echo "REPO_DIR=$(pwd)" >> $GITHUB_ENV
33
48
env
34
49
35
- - name : Set environment variables
50
+ - name : Get CUDA components
36
51
shell : bash --noprofile --norc -xeuo pipefail {0}
37
52
run : |
53
+ CUDA_PATH="./cuda_toolkit"
54
+ mkdir $CUDA_PATH
38
55
39
- WITH_TESTS_STR=''
40
- if [[ ("${{ inputs.upload-enabled }}" == "false") && ("${{ inputs.build-type }}" != "ci") ]]; then
41
- WITH_TESTS_STR='-with_tests'
56
+ # The binary archives (redist) are guaranteed to be updated as part of the release posting.
57
+ CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/"
58
+ CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json"
59
+ if [[ "${{ inputs.host-platform }}" == linux* ]]; then
60
+ if [[ "${{ inputs.host-platform }}" == "linux-x64" ]]; then
61
+ CTK_SUBDIR="linux-x86_64"
62
+ elif [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then
63
+ CTK_SUBDIR="linux-sbsa"
64
+ fi
65
+ function extract() {
66
+ tar -xvf $1 -C $CUDA_PATH --strip-components=1
67
+ }
68
+ elif [[ "${{ inputs.host-platform }}" == "win-x64" ]]; then
69
+ CTK_SUBDIR="windows-x86_64"
70
+ function extract() {
71
+ _TEMP_DIR_=$(mktemp -d)
72
+ unzip $1 -d $_TEMP_DIR_
73
+ cp -r $_TEMP_DIR_/*/* $CUDA_PATH
74
+ rm -rf $_TEMP_DIR_
75
+ }
42
76
fi
77
+ function populate_cuda_path() {
78
+ # take the component name as a argument
79
+ function download() {
80
+ curl -kLSs $1 -o $2
81
+ }
82
+ CTK_COMPONENT=$1
83
+ CTK_COMPONENT_REL_PATH="$(curl -s $CTK_JSON_URL |
84
+ python -c "import sys, json; print(json.load(sys.stdin)['${CTK_COMPONENT}']['${CTK_SUBDIR}']['relative_path'])")"
85
+ CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}"
86
+ CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)"
87
+ download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME
88
+ extract $CTK_COMPONENT_COMPONENT_FILENAME
89
+ rm $CTK_COMPONENT_COMPONENT_FILENAME
90
+ }
43
91
44
- TARGET_PLATFORM='linux-64'
45
- if [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then
92
+ # Get headers and shared libraries in place
93
+ populate_cuda_path cuda_nvcc
94
+ populate_cuda_path cuda_cudart
95
+ populate_cuda_path cuda_nvrtc
96
+ populate_cuda_path cuda_profiler_api
97
+ ls -l $CUDA_PATH
98
+
99
+ # Note: the headers will be copied into the cibuildwheel manylinux container,
100
+ # so setting the CUDA_PATH env var here is meaningless.
101
+
102
+ - name : Set environment variables
103
+ shell : bash --noprofile --norc -xeuo pipefail {0}
104
+ run : |
105
+ # TODO: just align host-platform names with TARGET_PLATFORM...
106
+ if [[ "${{ inputs.host-platform }}" == "linux-x64" ]]; then
107
+ TARGET_PLATFORM='linux-64'
108
+ elif [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then
46
109
TARGET_PLATFORM='linux-aarch64'
110
+ elif [[ "${{ inputs.host-platform }}" == "win-x64" ]]; then
111
+ TARGET_PLATFORM='win-64'
47
112
fi
48
113
49
- BUILD_MODE="${{ inputs.build-mode }}"
50
- BUILD_MODE_STR=""
51
- [ -n "${BUILD_MODE}" ] && BUILD_MODE_STR="-${BUILD_MODE}"
114
+ PYTHON_VERSION_FORMATTED=$(echo '${{ inputs.python-version }}' | tr -d '.')
115
+ if [[ "${{ inputs.host-platform }}" == linux* ]]; then
116
+ CIBW_BUILD="cp${PYTHON_VERSION_FORMATTED}-manylinux*"
117
+ REPO_DIR=$(pwd)
118
+ elif [[ "${{ inputs.host-platform }}" == win* ]]; then
119
+ CIBW_BUILD="cp${PYTHON_VERSION_FORMATTED}-win_amd64"
120
+ PWD=$(pwd)
121
+ REPO_DIR=$(cygpath -w $PWD)
122
+ fi
52
123
124
+ BUILD_MODE="${{ inputs.build-mode }}"
53
125
if [[ ("${BUILD_MODE}" == "") || ("${BUILD_MODE}" == "release") ]]; then
54
126
# We upload release versions in the default folder.
55
127
PKG_DIR="${TARGET_PLATFORM}"
56
128
else
57
129
PKG_DIR="${BUILD_MODE}/${TARGET_PLATFORM}"
58
130
fi
59
131
60
- PYTHON_VERSION_FORMATTED =$(echo '${{ inputs.python-version }}' | tr -d '.')
61
-
62
- 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
63
- echo "BINDINGS_ARTIFACTS_DIR=$(realpath "$(pwd)/cuda_bindings/dist") " >> $GITHUB_ENV
64
- 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
65
- echo "CORE_ARTIFACTS_DIR=$(realpath "$(pwd)/cuda_core/dist") " >> $GITHUB_ENV
66
- echo "USE_CUDA=${{ (inputs.target-device == 'cpu' && 'OFF') || 'ON' }} " >> $GITHUB_ENV
132
+ echo "PARALLEL_LEVEL =$(nproc)" >> $GITHUB_ENV
133
+ echo "REPO_DIR=$REPO_DIR" >> $GITHUB_ENV
134
+ echo "PKG_DIR =${PKG_DIR }" >> $GITHUB_ENV
135
+ echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ inputs.host-platform }}-${{ inputs.build-type }}-${{ github.sha }} " >> $GITHUB_ENV
136
+ echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/ cuda_core/dist") " >> $GITHUB_ENV
137
+ echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.cuda-version }}-${{ inputs.host-platform }}-${{ inputs.build-type }}-${{ github.sha }} " >> $GITHUB_ENV
138
+ echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist") " >> $GITHUB_ENV
67
139
echo "UPLOAD_ENABLED=${{ (inputs.upload-enabled == 'true' && 'ON') || 'OFF' }}" >> $GITHUB_ENV
68
- echo "LEGATE_CORE_BUILD_MODE=${BUILD_MODE}" >> $GITHUB_ENV
69
140
echo "BUILD_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
70
141
echo "TARGET_PLATFORM=${TARGET_PLATFORM}" >> $GITHUB_ENV
71
- echo "PKG_DIR=${PKG_DIR}" >> $GITHUB_ENV
72
- echo "PYTHON_VERSION=${{ inputs.python-version }}" >> $GITHUB_ENV
142
+ echo "CIBW_BUILD=${CIBW_BUILD}" >> $GITHUB_ENV
0 commit comments