Skip to content

Commit 9579678

Browse files
authored
Ensure fetch_ctk action can be used everywhere (#600)
* test installing git for windows * shrink CI * also install 7z... * skip cuda.bindings for now * fix * fix * fix * skip * skip * more skip * add quotes * try this * try this * try this * don't escape? * try this * --version does not exist * switch to fetch_ctk * try not to hang * try not to hang * try not to hang; composite action does not support setting default shell... * self extracting + run post install * block extraction to ensure file visibility * clean up * ensure cuda related paths are set correctly on windows * fix normpath (again) to escape slash * DEBUG * perhaps git-bash is not the right exe... * install zstd for win local ctk test * fix copy pasta * forward-port fetch_ctk fix * ready for full test!
1 parent 90f9269 commit 9579678

File tree

3 files changed

+49
-26
lines changed

3 files changed

+49
-26
lines changed

.github/actions/fetch_ctk/action.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ runs:
7575
unzip $1 -d $_TEMP_DIR_
7676
cp -r $_TEMP_DIR_/*/* $CACHE_TMP_DIR
7777
rm -rf $_TEMP_DIR_
78+
# see commit NVIDIA/cuda-python@69410f1d9228e775845ef6c8b4a9c7f37ffc68a5
79+
chmod 644 $CACHE_TMP_DIR/LICENSE
7880
}
7981
fi
8082
function populate_cuda_path() {
@@ -146,8 +148,17 @@ runs:
146148
- name: Set output environment variables
147149
shell: bash --noprofile --norc -xeuo pipefail {0}
148150
run: |
149-
CUDA_PATH=$(realpath "./cuda_toolkit")
151+
# mimics actual CTK installation
152+
if [[ "${{ inputs.host-platform }}" == linux* ]]; then
153+
CUDA_PATH=$(realpath "./cuda_toolkit")
154+
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:${CUDA_PATH}/lib:${CUDA_PATH}/nvvm/lib64" >> $GITHUB_ENV
155+
elif [[ "${{ inputs.host-platform }}" == win* ]]; then
156+
function normpath() {
157+
echo "$(echo $(cygpath -w $1) | sed 's/\\/\\\\/g')"
158+
}
159+
CUDA_PATH=$(normpath $(realpath "./cuda_toolkit"))
160+
echo "$(normpath ${CUDA_PATH}/bin)" >> $GITHUB_PATH
161+
echo "$(normpath $CUDA_PATH/nvvm/bin)" >> $GITHUB_PATH
162+
fi
150163
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
151164
echo "CUDA_HOME=${CUDA_PATH}" >> $GITHUB_ENV
152-
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
153-
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:${CUDA_PATH}/lib:${CUDA_PATH}/nvvm/lib64" >> $GITHUB_ENV

.github/workflows/build-and-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
LIBRARY_PATH=/host/${{ env.CUDA_PATH }}/lib
147147
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
148148
CIBW_ENVIRONMENT_WINDOWS: >
149-
CUDA_HOME="$(cygpath -w ${{ env.CUDA_PATH }})"
149+
CUDA_HOME=${{ env.CUDA_PATH }}
150150
LIB="${CUDA_HOME}\\lib\\x64;${LIB}"
151151
CUDA_BINDINGS_PARALLEL_LEVEL=${{ env.CUDA_BINDINGS_PARALLEL_LEVEL }}
152152
with:

.github/workflows/test-wheel-windows.yml

+34-22
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ jobs:
5757
$SKIP_CUDA_BINDINGS_TEST = 0
5858
}
5959
60-
if ('${{ inputs.local-ctk }}' -eq '1') {
61-
if ($TEST_CUDA_MAJOR -eq '12') {
62-
$MINI_CTK_DEPS = '["nvcc", "nvrtc", "nvjitlink", "thrust"]'
63-
} else {
64-
$MINI_CTK_DEPS = '["nvcc", "nvrtc", "thrust"]'
65-
}
66-
}
67-
6860
# Make outputs from the previous job as env vars
6961
$CUDA_CORE_ARTIFACT_BASENAME = "cuda-core-python${PYTHON_VERSION_FORMATTED}-${{ inputs.host-platform }}"
7062
"PYTHON_VERSION_FORMATTED=${PYTHON_VERSION_FORMATTED}" >> $env:GITHUB_ENV
@@ -76,7 +68,6 @@ jobs:
7668
"CUDA_BINDINGS_ARTIFACT_NAME=${CUDA_BINDINGS_ARTIFACT_BASENAME}-${{ github.sha }}" >> $env:GITHUB_ENV
7769
"CUDA_BINDINGS_ARTIFACTS_DIR=$($ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$REPO_DIR\cuda_bindings\dist"))" >> $env:GITHUB_ENV
7870
"SKIP_CUDA_BINDINGS_TEST=${SKIP_CUDA_BINDINGS_TEST}" >> $env:GITHUB_ENV
79-
"MINI_CTK_DEPS=${MINI_CTK_DEPS}" >> $env:GITHUB_ENV
8071
8172
- name: Download cuda-python build artifacts
8273
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0'}}
@@ -107,6 +98,36 @@ jobs:
10798
}
10899
gh --version
109100
101+
- name: Install Git for Windows
102+
# the GPU runner image does not have Git Bash pre-installed...
103+
if: ${{ inputs.local-ctk == '1' }}
104+
env:
105+
# doesn't seem there's an easy way to avoid hard-coding it?
106+
GFW_EXE_URL: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/PortableGit-2.49.0-64-bit.7z.exe
107+
run: |
108+
Invoke-WebRequest -Uri "$env:GFW_EXE_URL" -OutFile "PortableGit.7z.exe"
109+
# Self-extracting, see https://gitforwindows.org/zip-archives-extracting-the-released-archives.html
110+
Start-Process .\PortableGit.7z.exe -Wait -Verbose -ArgumentList '-y -gm2'
111+
ls -l PortableGit
112+
echo "$((Get-Location).Path)\\PortableGit\\bin" >> $env:GITHUB_PATH
113+
$env:Path += ";$((Get-Location).Path)\\PortableGit\\bin"
114+
bash --version
115+
116+
- name: Install zstd
117+
# the GPU runner image does not have zstd pre-installed... and it's needed by actions/cache
118+
if: ${{ inputs.local-ctk == '1' }}
119+
env:
120+
# doesn't seem there's an easy way to avoid hard-coding it?
121+
ZSTD_URL: https://github.com/facebook/zstd/releases/download/v1.5.7/zstd-v1.5.7-win64.zip
122+
ZSTD_DIR: zstd-v1.5.7-win64
123+
run: |
124+
Invoke-WebRequest -Uri "$env:ZSTD_URL" -OutFile "zstd-win64.zip"
125+
Expand-Archive -Path "zstd-win64.zip" -DestinationPath .
126+
ls -l $env:ZSTD_DIR
127+
echo "$((Get-Location).Path)\\$env:ZSTD_DIR" >> $env:GITHUB_PATH
128+
$env:Path += ";$((Get-Location).Path)\\$env:ZSTD_DIR"
129+
zstd --version
130+
110131
- name: Download cuda-python & cuda.bindings build artifacts from the prior branch
111132
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '1'}}
112133
env:
@@ -160,20 +181,11 @@ jobs:
160181

161182
- name: Set up mini CTK
162183
if: ${{ inputs.local-ctk == '1' }}
163-
# Note: The GH-hosted Windows GPU runner does not have Git for Windows pre-installed,
164-
# so we cannot use our own fetch_ctk action unfortunately...
165-
uses: Jimver/cuda-toolkit@v0.2.21
184+
uses: ./.github/actions/fetch_ctk
185+
continue-on-error: false
166186
with:
167-
cuda: ${{ inputs.cuda-version }}
168-
method: 'network'
169-
sub-packages: ${{ env.MINI_CTK_DEPS }}
170-
171-
- name: Update PATH
172-
if: ${{ inputs.local-ctk == '1' }}
173-
run: |
174-
# mimics actual CTK installation
175-
echo $PATH
176-
echo "$env:CUDA_PATH\nvvm\bin" >> $env:GITHUB_PATH
187+
host-platform: ${{ inputs.host-platform }}
188+
cuda-version: ${{ inputs.cuda-version }}
177189

178190
- name: Run cuda.bindings tests
179191
if: ${{ env.SKIP_CUDA_BINDINGS_TEST == '0' }}

0 commit comments

Comments
 (0)