Skip to content

Commit 56ffaef

Browse files
committed
CI: Remove fetch_ctk component hardcoding and add hash to filename
1 parent f0cb721 commit 56ffaef

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

.github/actions/fetch_ctk/action.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@ inputs:
99
cuda-version:
1010
required: true
1111
type: string
12+
cuda-components:
13+
description: "A list of the CTK components to install as a comma-separated list. e.g. 'cuda_nvcc,cuda_nvrtc,cuda_cudart'"
14+
required: false
15+
type: string
16+
default: "cuda_nvcc,cuda_cudart,cuda_nvrtc,cuda_profiler_api,cuda_cccl,cuda_sanitizer_api,libnvjitlink"
1217

1318
runs:
1419
using: composite
1520
steps:
1621
- name: Set up CTK cache variable
1722
shell: bash --noprofile --norc -xeuo pipefail {0}
1823
run: |
19-
echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}" >> $GITHUB_ENV
20-
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}.tar.gz" >> $GITHUB_ENV
24+
HASH=$(echo -n "${{ inputs.cuda-components }}" | sha256sum | awk '{print $1}')
25+
echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH" >> $GITHUB_ENV
26+
echo "CTK_CACHE_FILENAME=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH.tar.gz" >> $GITHUB_ENV
27+
echo "CTK_CACHE_COMPONENTS=${{ inputs.cuda-components }}" >> $GITHUB_ENV
2128
2229
- name: Install dependencies
2330
uses: ./.github/actions/install_unix_deps
@@ -78,18 +85,16 @@ runs:
7885
rm $CTK_COMPONENT_COMPONENT_FILENAME
7986
}
8087
81-
# Get headers and shared libraries in place
82-
# Note: the existing artifact would need to be manually deleted (ex: through web UI)
83-
# if this list is changed, as the artifact actions do not offer any option for us to
84-
# invalidate the artifact.
85-
populate_cuda_path cuda_nvcc
86-
populate_cuda_path cuda_cudart
87-
populate_cuda_path cuda_nvrtc
88-
populate_cuda_path cuda_profiler_api
89-
populate_cuda_path cuda_cccl
90-
if [[ "$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})" -ge 12 ]]; then
91-
populate_cuda_path libnvjitlink
88+
# Conditionally strip out libnvjitlink for CUDA versions < 12
89+
if [[ "$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})" -lt 12 ]]; then
90+
CTK_CACHE_COMPONENTS="${CTK_CACHE_COMPONENTS//libnvjitlink/}"
9291
fi
92+
# Cleanup stray commas after removing components
93+
CTK_CACHE_COMPONENTS="${CTK_CACHE_COMPONENTS//,,/,}"
94+
# Get headers and shared libraries in place
95+
for item in $(echo $CTK_CACHE_COMPONENTS | tr ',' ' '); do
96+
populate_cuda_path "$item"
97+
done
9398
ls -l $CUDA_PATH
9499
95100
# Prepare the cache

0 commit comments

Comments
 (0)