@@ -85,6 +85,37 @@ function install_118 {
85
85
ldconfig
86
86
}
87
87
88
+ function install_121 {
89
+ echo " Installing CUDA 12.1 and cuDNN 8.8 and NCCL 2.17.1"
90
+ rm -rf /usr/local/cuda-12.1 /usr/local/cuda
91
+ # install CUDA 12.1.0 in the same container
92
+ wget -q https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run
93
+ chmod +x cuda_12.1.0_530.30.02_linux.run
94
+ ./cuda_12.1.0_530.30.02_linux.run --toolkit --silent
95
+ rm -f cuda_12.1.0_530.30.02_linux.run
96
+ rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.1 /usr/local/cuda
97
+
98
+ # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
99
+ mkdir tmp_cudnn && cd tmp_cudnn
100
+ wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.8.1.3_cuda12-archive.tar.xz -O cudnn-linux-x86_64-8.8.1.3_cuda12-archive.tar.xz
101
+ tar xf cudnn-linux-x86_64-8.8.1.3_cuda12-archive.tar.xz
102
+ cp -a cudnn-linux-x86_64-8.8.1.3_cuda12-archive/include/* /usr/local/cuda/include/
103
+ cp -a cudnn-linux-x86_64-8.8.1.3_cuda12-archive/lib/* /usr/local/cuda/lib64/
104
+ cd ..
105
+ rm -rf tmp_cudnn
106
+ ldconfig
107
+
108
+ # NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
109
+ mkdir tmp_nccl && cd tmp_nccl
110
+ wget -q https://developer.download.nvidia.com/compute/redist/nccl/v2.17.1/nccl_2.17.1-1+cuda12.1_x86_64.txz
111
+ tar xf nccl_2.17.1-1+cuda12.1_x86_64.txz
112
+ cp -a nccl_2.17.1-1+cuda12.1_x86_64/include/* /usr/local/cuda/include/
113
+ cp -a nccl_2.17.1-1+cuda12.1_x86_64/lib/* /usr/local/cuda/lib64/
114
+ cd ..
115
+ rm -rf tmp_nccl
116
+ ldconfig
117
+ }
118
+
88
119
function prune_116 {
89
120
echo " Pruning CUDA 11.6 and CuDNN"
90
121
# ####################################################################################
@@ -178,6 +209,37 @@ function prune_118 {
178
209
rm -rf $CUDA_BASE /libnvvp $CUDA_BASE /nsightee_plugins $CUDA_BASE /nsight-compute-2022.3.0 $CUDA_BASE /nsight-systems-2022.4.2/
179
210
}
180
211
212
+ function prune_121 {
213
+ echo " Pruning CUDA 12.1"
214
+ # ####################################################################################
215
+ # CUDA 12.1 prune static libs
216
+ # ####################################################################################
217
+ export NVPRUNE=" /usr/local/cuda-12.1/bin/nvprune"
218
+ export CUDA_LIB_DIR=" /usr/local/cuda-12.1/lib64"
219
+
220
+ 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"
221
+ 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"
222
+
223
+ if [[ -n " $OVERRIDE_GENCODE " ]]; then
224
+ export GENCODE=$OVERRIDE_GENCODE
225
+ fi
226
+
227
+ # all CUDA libs except CuDNN and CuBLAS
228
+ ls $CUDA_LIB_DIR / | grep " \.a" | grep -v " culibos" | grep -v " cudart" | grep -v " cudnn" | grep -v " cublas" | grep -v " metis" \
229
+ | xargs -I {} bash -c \
230
+ " echo {} && $NVPRUNE $GENCODE $CUDA_LIB_DIR /{} -o $CUDA_LIB_DIR /{}"
231
+
232
+ # prune CuDNN and CuBLAS
233
+ $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublas_static.a -o $CUDA_LIB_DIR /libcublas_static.a
234
+ $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublasLt_static.a -o $CUDA_LIB_DIR /libcublasLt_static.a
235
+
236
+ # ####################################################################################
237
+ # CUDA 12.1 prune visual tools
238
+ # ####################################################################################
239
+ export CUDA_BASE=" /usr/local/cuda-12.1/"
240
+ rm -rf $CUDA_BASE /libnvvp $CUDA_BASE /nsightee_plugins $CUDA_BASE /nsight-compute-2023.1.0 $CUDA_BASE /nsight-systems-2023.1.2/
241
+ }
242
+
181
243
# idiomatic parameter and option handling in sh
182
244
while test $# -gt 0
183
245
do
188
250
;;
189
251
11.8) install_118; prune_118
190
252
;;
253
+ 12.1) install_121; prune_121
254
+ ;;
191
255
* ) echo " bad argument $1 " ; exit 1
192
256
;;
193
257
esac
0 commit comments