1- # SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+ # SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22#
33# SPDX-License-Identifier: Apache-2.0
44
@@ -14,7 +14,7 @@ inputs:
1414 cuda-components :
1515 description : " A list of the CTK components to install as a comma-separated list. e.g. 'cuda_nvcc,cuda_nvrtc,cuda_cudart'"
1616 required : false
17- default : " cuda_nvcc,cuda_cudart,cuda_crt,libnvvm,cuda_nvrtc,cuda_profiler_api,cuda_cccl,cuda_cupti,libnvjitlink,libcufile,libnvfatbin"
17+ default : " cuda_nvcc,cuda_cudart,cuda_crt,libnvvm,cuda_nvrtc,cuda_profiler_api,cuda_cccl,cuda_cupti,libnvjitlink,libcufile,libnvfatbin,libcudla "
1818 cuda-path :
1919 description : " where the CTK components will be installed to, relative to $PWD"
2020 required : false
@@ -27,24 +27,15 @@ runs:
2727 shell : bash --noprofile --norc -xeuo pipefail {0}
2828 run : |
2929 # Pre-process the component list to ensure hash uniqueness
30+ # Use the runtime workspace mount so this also works inside container jobs.
31+ CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py"
3032 CTK_CACHE_COMPONENTS=${{ inputs.cuda-components }}
31- # Conditionally strip out libnvjitlink for CUDA versions < 12
32- CUDA_MAJOR_VER="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})"
33- if [[ "$CUDA_MAJOR_VER" -lt 12 ]]; then
34- CTK_CACHE_COMPONENTS="${CTK_CACHE_COMPONENTS//libnvjitlink/}"
35- fi
36- # Conditionally strip out cuda_crt and libnvvm for CUDA versions < 13
37- CUDA_MAJOR_VER="$(cut -d '.' -f 1 <<< ${{ inputs.cuda-version }})"
38- if [[ "$CUDA_MAJOR_VER" -lt 13 ]]; then
39- CTK_CACHE_COMPONENTS="${CTK_CACHE_COMPONENTS//cuda_crt/}"
40- CTK_CACHE_COMPONENTS="${CTK_CACHE_COMPONENTS//libnvvm/}"
41- fi
42- # Conditionally strip out libcufile since it does not support Windows
43- if [[ "${{ inputs.host-platform }}" == win-* ]]; then
44- CTK_CACHE_COMPONENTS="${CTK_CACHE_COMPONENTS//libcufile/}"
45- fi
46- # Cleanup stray commas after removing components
47- CTK_CACHE_COMPONENTS="${CTK_CACHE_COMPONENTS//,,/,}"
33+ CTK_JSON_URL="https://developer.download.nvidia.com/compute/cuda/redist/redistrib_${{ inputs.cuda-version }}.json"
34+ CTK_CACHE_COMPONENTS="$(python "$CTK_REDIST_TOOL" filter-components \
35+ --host-platform "${{ inputs.host-platform }}" \
36+ --cuda-version "${{ inputs.cuda-version }}" \
37+ --components "$CTK_CACHE_COMPONENTS" \
38+ --metadata-url "$CTK_JSON_URL")"
4839
4940 HASH=$(echo -n "${CTK_CACHE_COMPONENTS}" | sha256sum | awk '{print $1}')
5041 echo "CTK_CACHE_KEY=mini-ctk-${{ inputs.cuda-version }}-${{ inputs.host-platform }}-$HASH" >> $GITHUB_ENV
6051
6152 - name : Download CTK cache
6253 id : ctk-get-cache
63- uses : actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
54+ uses : actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
6455 continue-on-error : true
6556 with :
6657 key : ${{ env.CTK_CACHE_KEY }}
@@ -78,19 +69,17 @@ runs:
7869 mkdir $CACHE_TMP_DIR
7970
8071 # The binary archives (redist) are guaranteed to be updated as part of the release posting.
72+ # Use the runtime workspace mount so this also works inside container jobs.
73+ CTK_REDIST_TOOL="${GITHUB_WORKSPACE}/ci/tools/fetch_ctk_redistrib.py"
8174 CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/"
8275 CTK_JSON_URL="$CTK_BASE_URL/redistrib_${{ inputs.cuda-version }}.json"
76+ CTK_JSON_FILE="$CACHE_TMP_DIR/redistrib.json"
77+ curl -LSs "$CTK_JSON_URL" -o "$CTK_JSON_FILE"
8378 if [[ "${{ inputs.host-platform }}" == linux* ]]; then
84- if [[ "${{ inputs.host-platform }}" == "linux-64" ]]; then
85- CTK_SUBDIR="linux-x86_64"
86- elif [[ "${{ inputs.host-platform }}" == "linux-aarch64" ]]; then
87- CTK_SUBDIR="linux-sbsa"
88- fi
8979 function extract() {
9080 tar -xvf $1 -C $CACHE_TMP_DIR --strip-components=1
9181 }
9282 elif [[ "${{ inputs.host-platform }}" == "win-64" ]]; then
93- CTK_SUBDIR="windows-x86_64"
9483 function extract() {
9584 _TEMP_DIR_=$(mktemp -d)
9685 unzip $1 -d $_TEMP_DIR_
@@ -103,11 +92,13 @@ runs:
10392 function populate_cuda_path() {
10493 # take the component name as a argument
10594 function download() {
106- curl -kLSs $1 -o $2
95+ curl -LSs $1 -o $2
10796 }
10897 CTK_COMPONENT=$1
109- CTK_COMPONENT_REL_PATH="$(curl -s $CTK_JSON_URL |
110- python -c "import sys, json; print(json.load(sys.stdin)['${CTK_COMPONENT}']['${CTK_SUBDIR}']['relative_path'])")"
98+ CTK_COMPONENT_REL_PATH="$(python "$CTK_REDIST_TOOL" component-relative-path \
99+ --host-platform "${{ inputs.host-platform }}" \
100+ --component "$CTK_COMPONENT" \
101+ --metadata-path "$CTK_JSON_FILE")"
111102 CTK_COMPONENT_URL="${CTK_BASE_URL}/${CTK_COMPONENT_REL_PATH}"
112103 CTK_COMPONENT_COMPONENT_FILENAME="$(basename $CTK_COMPONENT_REL_PATH)"
113104 download $CTK_COMPONENT_URL $CTK_COMPONENT_COMPONENT_FILENAME
@@ -142,7 +133,7 @@ runs:
142133 - name : Upload CTK cache
143134 if : ${{ !cancelled() &&
144135 steps.ctk-get-cache.outputs.cache-hit != 'true' }}
145- uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
136+ uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
146137 with :
147138 key : ${{ env.CTK_CACHE_KEY }}
148139 path : ./${{ env.CTK_CACHE_FILENAME }}
0 commit comments