44
55set -ex
66
7- NCCL_VERSION=v2.25.1-1
8- CUDNN_VERSION=9.5.1.17
9-
10- # Include Hopper support if using CUDA11.8 or above
11- NVCC_GENCODE=" -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90 -gencode=arch=compute_90,code=compute_90"
12-
13- function install_cusparselt_040 {
14- # cuSparseLt license: https://docs.nvidia.com/cuda/cusparselt/license.html
15- mkdir tmp_cusparselt && pushd tmp_cusparselt
16- wget -q https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-x86_64/libcusparse_lt-linux-x86_64-0.4.0.7-archive.tar.xz
17- tar xf libcusparse_lt-linux-x86_64-0.4.0.7-archive.tar.xz
18- cp -a libcusparse_lt-linux-x86_64-0.4.0.7-archive/include/* /usr/local/cuda/include/
19- cp -a libcusparse_lt-linux-x86_64-0.4.0.7-archive/lib/* /usr/local/cuda/lib64/
20- popd
21- rm -rf tmp_cusparselt
22- }
23-
24- function install_cusparselt_062 {
25- # cuSparseLt license: https://docs.nvidia.com/cuda/cusparselt/license.html
26- mkdir tmp_cusparselt && pushd tmp_cusparselt
27- wget -q https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-x86_64/libcusparse_lt-linux-x86_64-0.6.2.3-archive.tar.xz
28- tar xf libcusparse_lt-linux-x86_64-0.6.2.3-archive.tar.xz
29- cp -a libcusparse_lt-linux-x86_64-0.6.2.3-archive/include/* /usr/local/cuda/include/
30- cp -a libcusparse_lt-linux-x86_64-0.6.2.3-archive/lib/* /usr/local/cuda/lib64/
31- popd
32- rm -rf tmp_cusparselt
33- }
34-
35- function install_cusparselt_063 {
36- # cuSparseLt license: https://docs.nvidia.com/cuda/cusparselt/license.html
37- mkdir tmp_cusparselt && pushd tmp_cusparselt
38- wget -q https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-x86_64/libcusparse_lt-linux-x86_64-0.6.3.2-archive.tar.xz
39- tar xf libcusparse_lt-linux-x86_64-0.6.3.2-archive.tar.xz
40- cp -a libcusparse_lt-linux-x86_64-0.6.3.2-archive/include/* /usr/local/cuda/include/
41- cp -a libcusparse_lt-linux-x86_64-0.6.3.2-archive/lib/* /usr/local/cuda/lib64/
42- popd
43- rm -rf tmp_cusparselt
44- }
45-
46- function install_118 {
47- CUDNN_VERSION=9.1.0.70
48- NCCL_VERSION=v2.21.5-1
49- echo " Installing CUDA 11.8 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.4.0"
50- rm -rf /usr/local/cuda-11.8 /usr/local/cuda
51- # install CUDA 11.8.0 in the same container
52- wget -q https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run
53- chmod +x cuda_11.8.0_520.61.05_linux.run
54- ./cuda_11.8.0_520.61.05_linux.run --toolkit --silent
55- rm -f cuda_11.8.0_520.61.05_linux.run
56- rm -f /usr/local/cuda && ln -s /usr/local/cuda-11.8 /usr/local/cuda
57-
58- # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
59- mkdir tmp_cudnn && cd tmp_cudnn
60- wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION} _cuda11-archive.tar.xz -O cudnn-linux-x86_64-${CUDNN_VERSION} _cuda11-archive.tar.xz
61- tar xf cudnn-linux-x86_64-${CUDNN_VERSION} _cuda11-archive.tar.xz
62- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda11-archive/include/* /usr/local/cuda/include/
63- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda11-archive/lib/* /usr/local/cuda/lib64/
64- cd ..
65- rm -rf tmp_cudnn
66-
67- # NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
68- # Follow build: https://github.com/NVIDIA/nccl/tree/master?tab=readme-ov-file#build
69- git clone -b $NCCL_VERSION --depth 1 https://github.com/NVIDIA/nccl.git
70- cd nccl && make -j src.build NVCC_GENCODE=" ${NVCC_GENCODE} "
71- cp -a build/include/* /usr/local/cuda/include/
72- cp -a build/lib/* /usr/local/cuda/lib64/
73- cd ..
74- rm -rf nccl
75-
76- install_cusparselt_040
77-
78- ldconfig
7+ arch_path=' '
8+ targetarch=${TARGETARCH:- $(uname -m)}
9+ if [ ${targetarch} = ' amd64' ] || [ " ${targetarch} " = ' x86_64' ]; then
10+ arch_path=' x86_64'
11+ else
12+ arch_path=' sbsa'
13+ fi
14+
15+ function install_cuda {
16+ version=$1
17+ runfile=$2
18+ major_minor=${version% .* }
19+ rm -rf /usr/local/cuda-${major_minor} /usr/local/cuda
20+ if [[ ${arch_path} == ' sbsa' ]]; then
21+ runfile=" ${runfile} _sbsa"
22+ fi
23+ runfile=" ${runfile} .run"
24+ wget -q https://developer.download.nvidia.com/compute/cuda/${version} /local_installers/${runfile} -O ${runfile}
25+ chmod +x ${runfile}
26+ ./${runfile} --toolkit --silent
27+ rm -f ${runfile}
28+ rm -f /usr/local/cuda && ln -s /usr/local/cuda-${major_minor} /usr/local/cuda
7929}
8030
81- function install_124 {
82- CUDNN_VERSION=9.1.0.70
83- echo " Installing CUDA 12.4.1 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.6.2"
84- rm -rf /usr/local/cuda-12.4 /usr/local/cuda
85- # install CUDA 12.4.1 in the same container
86- wget -q https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run
87- chmod +x cuda_12.4.1_550.54.15_linux.run
88- ./cuda_12.4.1_550.54.15_linux.run --toolkit --silent
89- rm -f cuda_12.4.1_550.54.15_linux.run
90- rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.4 /usr/local/cuda
91-
92- # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
31+ function install_cudnn {
32+ cuda_major_version=$1
33+ cudnn_version=$2
9334 mkdir tmp_cudnn && cd tmp_cudnn
94- wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz -O cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz
95- tar xf cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz
96- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive/include/* /usr/local/cuda/include/
97- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive/lib/* /usr/local/cuda/lib64/
35+ # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
36+ filepath=" cudnn-linux-${arch_path} -${cudnn_version} _cuda${cuda_major_version} -archive"
37+ wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-${arch_path} /${filepath} .tar.xz
38+ tar xf ${filepath} .tar.xz
39+ cp -a ${filepath} /include/* /usr/local/cuda/include/
40+ cp -a ${filepath} /lib/* /usr/local/cuda/lib64/
9841 cd ..
9942 rm -rf tmp_cudnn
43+ }
10044
45+ function install_nccl {
46+ nccl_version=$1
47+ nvcc_gencode=$2
10148 # NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
10249 # Follow build: https://github.com/NVIDIA/nccl/tree/master?tab=readme-ov-file#build
103- git clone -b $NCCL_VERSION --depth 1 https://github.com/NVIDIA/nccl.git
104- cd nccl && make -j src.build NVCC_GENCODE=" ${NVCC_GENCODE} "
50+ git clone -b ${nccl_version} --depth 1 https://github.com/NVIDIA/nccl.git
51+ cd nccl
52+ make -j src.build NVCC_GENCODE=" ${nvcc_gencode} "
10553 cp -a build/include/* /usr/local/cuda/include/
10654 cp -a build/lib/* /usr/local/cuda/lib64/
10755 cd ..
10856 rm -rf nccl
57+ }
10958
110- install_cusparselt_062
59+ function install_cusparselt {
60+ cusparselt_version=$1
61+ # cuSPARSELt license: https://docs.nvidia.com/cuda/cusparselt/license.html
62+ mkdir tmp_cusparselt && cd tmp_cusparselt
63+ cusparselt_name=" libcusparse_lt-linux-${arch_path} -${cusparselt_version} -archive"
64+ curl --retry 3 -OLs https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-${arch_path} /${cusparselt_name} .tar.xz
11165
112- ldconfig
66+ tar xf ${cusparselt_name} .tar.xz
67+ cp -a ${cusparselt_name} /include/* /usr/local/cuda/include/
68+ cp -a ${cusparselt_name} /lib/* /usr/local/cuda/lib64/
69+ cd ..
70+ rm -rf tmp_cusparselt
11371}
11472
11573function install_126 {
116- echo " Installing CUDA 12.6.3 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.6.3"
117- rm -rf /usr/local/cuda-12.6 /usr/local/cuda
118- # install CUDA 12.6.3 in the same container
119- wget -q https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda_12.6.3_560.35.05_linux.run
120- chmod +x cuda_12.6.3_560.35.05_linux.run
121- ./cuda_12.6.3_560.35.05_linux.run --toolkit --silent
122- rm -f cuda_12.6.3_560.35.05_linux.run
123- rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.6 /usr/local/cuda
74+ CUDNN_VERSION=9.10.2.21
75+ NCCL_VERSION=v2.27.3-1
76+ NVCC_GENCODE=" -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90"
77+ CUSPARSELT_VERSION=0.7.1.0
12478
125- # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
126- mkdir tmp_cudnn && cd tmp_cudnn
127- wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz -O cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz
128- tar xf cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz
129- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive/include/* /usr/local/cuda/include/
130- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive/lib/* /usr/local/cuda/lib64/
131- cd ..
132- rm -rf tmp_cudnn
79+ echo " Installing CUDA 12.6.3 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt ${CUSPARSELT_VERSION} "
80+ install_cuda 12.6.3 cuda_12.6.3_560.35.05_linux
13381
134- # NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
135- # Follow build: https://github.com/NVIDIA/nccl/tree/master?tab=readme-ov-file#build
136- git clone -b $NCCL_VERSION --depth 1 https://github.com/NVIDIA/nccl.git
137- cd nccl && make -j src.build NVCC_GENCODE=" ${NVCC_GENCODE} "
138- cp -a build/include/* /usr/local/cuda/include/
139- cp -a build/lib/* /usr/local/cuda/lib64/
140- cd ..
141- rm -rf nccl
82+ install_cudnn 12 $CUDNN_VERSION
83+
84+ install_nccl $NCCL_VERSION $NVCC_GENCODE
14285
143- install_cusparselt_063
86+ install_cusparselt $CUSPARSELT_VERSION
14487
14588 ldconfig
14689}
14790
148- function prune_118 {
149- echo " Pruning CUDA 11.8 and cuDNN"
150- # ####################################################################################
151- # CUDA 11.8 prune static libs
152- # ####################################################################################
153- export NVPRUNE=" /usr/local/cuda-11.8/bin/nvprune"
154- export CUDA_LIB_DIR=" /usr/local/cuda-11.8/lib64"
91+ function install_128 {
92+ CUDNN_VERSION=9.8.0.87
93+ NCCL_VERSION=v2.27.3-1
94+ NVCC_GENCODE=" -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90 -gencode=arch=compute_100,code=sm_100 -gencode=arch=compute_120,code=sm_120 -gencode=arch=compute_120,code=compute_120"
95+ CUSPARSELT_VERSION=0.7.1.0
15596
156- export GENCODE=" -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
157- export GENCODE_CUDNN=" -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
97+ echo " Installing CUDA 12.8.1 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt ${CUSPARSELT_VERSION} "
98+ # install CUDA 12.8.1 in the same container
99+ install_cuda 12.8.1 cuda_12.8.1_570.124.06_linux
158100
159- if [[ -n " $OVERRIDE_GENCODE " ]]; then
160- export GENCODE=$OVERRIDE_GENCODE
161- fi
101+ install_cudnn 12 $CUDNN_VERSION
162102
163- # all CUDA libs except CuDNN and CuBLAS (cudnn and cublas need arch 3.7 included)
164- ls $CUDA_LIB_DIR / | grep " \.a" | grep -v " culibos" | grep -v " cudart" | grep -v " cudnn" | grep -v " cublas" | grep -v " metis" \
165- | xargs -I {} bash -c \
166- " echo {} && $NVPRUNE $GENCODE $CUDA_LIB_DIR /{} -o $CUDA_LIB_DIR /{}"
103+ install_nccl $NCCL_VERSION $NVCC_GENCODE
167104
168- # prune CuDNN and CuBLAS
169- $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublas_static.a -o $CUDA_LIB_DIR /libcublas_static.a
170- $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublasLt_static.a -o $CUDA_LIB_DIR /libcublasLt_static.a
105+ install_cusparselt $CUSPARSELT_VERSION
171106
172- # ####################################################################################
173- # CUDA 11.8 prune visual tools
174- # ####################################################################################
175- export CUDA_BASE=" /usr/local/cuda-11.8/"
176- rm -rf $CUDA_BASE /libnvvp $CUDA_BASE /nsightee_plugins $CUDA_BASE /nsight-compute-2022.3.0 $CUDA_BASE /nsight-systems-2022.4.2/
107+ ldconfig
177108}
178109
179- function prune_124 {
180- echo " Pruning CUDA 12.4"
181- # ####################################################################################
182- # CUDA 12.4 prune static libs
183- # ####################################################################################
184- export NVPRUNE=" /usr/local/cuda-12.4/bin/nvprune"
185- export CUDA_LIB_DIR=" /usr/local/cuda-12.4/lib64"
110+ function install_129 {
111+ CUDNN_VERSION=9.10.2.21
112+ NCCL_VERSION=v2.27.3-1
113+ NVCC_GENCODE=" -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90 -gencode=arch=compute_100,code=sm_100 -gencode=arch=compute_120,code=sm_120 -gencode=arch=compute_120,code=compute_120"
114+ CUSPARSELT_VERSION=0.7.1.0
186115
187- export GENCODE=" -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
188- export GENCODE_CUDNN=" -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
116+ echo " Installing CUDA 12.9.1 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt ${CUSPARSELT_VERSION} "
117+ # install CUDA 12.9.1 in the same container
118+ install_cuda 12.9.1 cuda_12.9.1_575.57.08_linux
189119
190- if [[ -n " $OVERRIDE_GENCODE " ]]; then
191- export GENCODE=$OVERRIDE_GENCODE
192- fi
193- if [[ -n " $OVERRIDE_GENCODE_CUDNN " ]]; then
194- export GENCODE_CUDNN=$OVERRIDE_GENCODE_CUDNN
195- fi
120+ install_cudnn 12 $CUDNN_VERSION
196121
197- # all CUDA libs except CuDNN and CuBLAS
198- ls $CUDA_LIB_DIR / | grep " \.a" | grep -v " culibos" | grep -v " cudart" | grep -v " cudnn" | grep -v " cublas" | grep -v " metis" \
199- | xargs -I {} bash -c \
200- " echo {} && $NVPRUNE $GENCODE $CUDA_LIB_DIR /{} -o $CUDA_LIB_DIR /{}"
122+ install_nccl $NCCL_VERSION $NVCC_GENCODE
201123
202- # prune CuDNN and CuBLAS
203- $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublas_static.a -o $CUDA_LIB_DIR /libcublas_static.a
204- $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublasLt_static.a -o $CUDA_LIB_DIR /libcublasLt_static.a
124+ install_cusparselt $CUSPARSELT_VERSION
205125
206- # ####################################################################################
207- # CUDA 12.4 prune visual tools
208- # ####################################################################################
209- export CUDA_BASE=" /usr/local/cuda-12.4/"
210- rm -rf $CUDA_BASE /libnvvp $CUDA_BASE /nsightee_plugins $CUDA_BASE /nsight-compute-2024.1.0 $CUDA_BASE /nsight-systems-2023.4.4/
126+ ldconfig
211127}
212128
213129function prune_126 {
@@ -244,56 +160,18 @@ function prune_126 {
244160 rm -rf $CUDA_BASE /libnvvp $CUDA_BASE /nsightee_plugins $CUDA_BASE /nsight-compute-2024.3.2 $CUDA_BASE /nsight-systems-2024.5.1/
245161}
246162
247- function install_128 {
248- CUDNN_VERSION=9.7.1.26
249- # Include Blackwell support if using CUDA12.8 or above
250- NVCC_GENCODE=" -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_90,code=sm_90 -gencode=arch=compute_100,code=sm_100 -gencode=arch=compute_120,code=sm_120 -gencode=arch=compute_120,code=compute_120"
251- echo " Installing CUDA 12.8.0 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.6.3"
252- rm -rf /usr/local/cuda-12.8 /usr/local/cuda
253- # install CUDA 12.8.0 in the same container
254- wget -q https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_570.86.10_linux.run
255- chmod +x cuda_12.8.0_570.86.10_linux.run
256- ./cuda_12.8.0_570.86.10_linux.run --toolkit --silent
257- rm -f cuda_12.8.0_570.86.10_linux.run
258- rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.8 /usr/local/cuda
259-
260- # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
261- mkdir tmp_cudnn && cd tmp_cudnn
262- wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz -O cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz
263- tar xf cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive.tar.xz
264- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive/include/* /usr/local/cuda/include/
265- cp -a cudnn-linux-x86_64-${CUDNN_VERSION} _cuda12-archive/lib/* /usr/local/cuda/lib64/
266- cd ..
267- rm -rf tmp_cudnn
268-
269- # NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
270- # Follow build: https://github.com/NVIDIA/nccl/tree/master?tab=readme-ov-file#build
271- git clone -b $NCCL_VERSION --depth 1 https://github.com/NVIDIA/nccl.git
272- cd nccl && make -j src.build NVCC_GENCODE=" ${NVCC_GENCODE} "
273- cp -a build/include/* /usr/local/cuda/include/
274- cp -a build/lib/* /usr/local/cuda/lib64/
275- cd ..
276- rm -rf nccl
277-
278- install_cusparselt_063
279-
280- ldconfig
281- }
282-
283163# idiomatic parameter and option handling in sh
284164while test $# -gt 0
285165do
286166 case " $1 " in
287- 11.8) install_118; prune_118
288- ;;
289- 12.4) install_124; prune_124
167+ 12.6|12.6.* ) install_126; prune_126
290168 ;;
291- 12.6) install_126 ; prune_126
169+ 12.8|12.8. * ) install_128 ;
292170 ;;
293- 12.8) install_128 ;
171+ 12.9|12.9. * ) install_129 ;
294172 ;;
295173 * ) echo " bad argument $1 " ; exit 1
296174 ;;
297175 esac
298176 shift
299- done
177+ done
0 commit comments