@@ -146,6 +146,28 @@ function install_111 {
146
146
ldconfig
147
147
}
148
148
149
+ function install_112 {
150
+ echo " Installing CUDA 11.2 and CuDNN"
151
+ rm -rf /usr/local/cuda-11.2 /usr/local/cuda
152
+ # install CUDA 11.2 in the same container
153
+ wget -q https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.27.04_linux.run
154
+ chmod +x cuda_11.2.0_460.27.04_linux.run
155
+ ./cuda_11.2.0_460.27.04_linux.run --toolkit --silent
156
+ rm -f cuda_11.2.0_460.27.04_linux.run
157
+ rm -f /usr/local/cuda && ln -s /usr/local/cuda-11.2 /usr/local/cuda
158
+
159
+ # TODO: install CUDA 11.2 CuDNN 8.0.5, currently it's the 11.1 version
160
+ # cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
161
+ mkdir tmp_cudnn && cd tmp_cudnn
162
+ wget -q https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-11.1-linux-x64-v8.0.5.39.tgz -O cudnn-8.0.tgz
163
+ tar xf cudnn-8.0.tgz
164
+ cp -a cuda/include/* /usr/local/cuda/include/
165
+ cp -a cuda/lib64/* /usr/local/cuda/lib64/
166
+ cd ..
167
+ rm -rf tmp_cudnn
168
+ ldconfig
169
+ }
170
+
149
171
function prune_92 {
150
172
echo " Pruning CUDA 9.2 and CuDNN"
151
173
# ####################################################################################
@@ -307,6 +329,37 @@ function prune_111 {
307
329
rm -rf $CUDA_BASE /libnvvp $CUDA_BASE /nsightee_plugins $CUDA_BASE /nsight-compute-2020.2.1 $CUDA_BASE /nsight-systems-2020.3.4
308
330
}
309
331
332
+ function prune_112 {
333
+ echo " Pruning CUDA 11.2 and CuDNN"
334
+ # ####################################################################################
335
+ # CUDA 11.2 prune static libs
336
+ # ####################################################################################
337
+ export NVPRUNE=" /usr/local/cuda-11.2/bin/nvprune"
338
+ export CUDA_LIB_DIR=" /usr/local/cuda-11.2/lib64"
339
+
340
+ 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"
341
+ 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"
342
+
343
+ if [[ -n " $OVERRIDE_GENCODE " ]]; then
344
+ export GENCODE=$OVERRIDE_GENCODE
345
+ fi
346
+
347
+ # all CUDA libs except CuDNN and CuBLAS (cudnn and cublas need arch 3.7 included)
348
+ ls $CUDA_LIB_DIR / | grep " \.a" | grep -v " culibos" | grep -v " cudart" | grep -v " cudnn" | grep -v " cublas" | grep -v " metis" \
349
+ | xargs -I {} bash -c \
350
+ " echo {} && $NVPRUNE $GENCODE $CUDA_LIB_DIR /{} -o $CUDA_LIB_DIR /{}"
351
+
352
+ # prune CuDNN and CuBLAS
353
+ $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcudnn_static.a -o $CUDA_LIB_DIR /libcudnn_static.a
354
+ $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublas_static.a -o $CUDA_LIB_DIR /libcublas_static.a
355
+ $NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR /libcublasLt_static.a -o $CUDA_LIB_DIR /libcublasLt_static.a
356
+
357
+ # ####################################################################################
358
+ # CUDA 11.2 prune visual tools
359
+ # ####################################################################################
360
+ export CUDA_BASE=" /usr/local/cuda-11.2/"
361
+ rm -rf $CUDA_BASE /libnvvp $CUDA_BASE /nsightee_plugins $CUDA_BASE /nsight-compute-2020.3.0 $CUDA_BASE /nsight-systems-2020.4.3
362
+ }
310
363
311
364
# idiomatic parameter and option handling in sh
312
365
while test $# -gt 0
322
375
;;
323
376
11.1) install_111; prune_111
324
377
;;
378
+ 11.2) install_112; prune_112
379
+ ;;
325
380
* ) echo " bad argument $1 " ; exit 1
326
381
;;
327
382
esac
0 commit comments