1
+ #! /bin/bash
2
+ #
3
+ # /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ # =======================================================================
17
+ # */
18
+ #
19
+
20
+
21
+
22
+
23
+
24
+ echo " JAVA home is $( dirname $( dirname $( readlink $( readlink $( which javac) ) ) ) ) "
25
+
26
+ if [ " $GPU " = " true" ]; then
27
+ echo Installing CUDA
28
+ curl -L https://developer.download.nvidia.com/compute/cuda/11.2.2/local_installers/cuda-repo-rhel7-11-2-local-11.2.2_460.32.03-1.x86_64.rpm -o $HOME /cuda.rpm
29
+ curl -L https://developer.download.nvidia.com/compute/redist/cudnn/v8.1.1/cudnn-11.2-linux-x64-v8.1.1.33.tgz -o $HOME /cudnn.tgz
30
+ curl -L https://developer.download.nvidia.com/compute/redist/nccl/v2.8/nccl_2.8.4-1+cuda11.2_x86_64.txz -o $HOME /nccl.txz
31
+ rpm -i $HOME /cuda.rpm
32
+ pushd /var/cuda-repo-rhel7-11-2-local/; rpm -i --nodeps cuda* .rpm libc* .rpm libn* .rpm; rm * .rpm; popd
33
+ ln -sf /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/libcuda.so
34
+ ln -sf /usr/local/cuda/lib64/stubs/libnvidia-ml.so /usr/local/cuda/lib64/libnvidia-ml.so
35
+ tar hxvf $HOME /cudnn.tgz -C /usr/local/
36
+ tar hxvf $HOME /nccl.txz --strip-components=1 -C /usr/local/cuda/
37
+ mv /usr/local/cuda/lib/* /usr/local/cuda/lib64/
38
+ echo Removing downloaded archives and unused libraries to avoid running out of disk space
39
+ rm -f $HOME /* .rpm $HOME /* .tgz $HOME /* .txz $HOME /* .tar.*
40
+ rm -f $( find /usr/local/cuda/ -name ' *.a' -and -not -name libcudart_static.a -and -not -name libcudadevrt.a)
41
+ rm -rf /usr/local/cuda/doc* /usr/local/cuda/libnvvp* /usr/local/cuda/nsight* /usr/local/cuda/samples*
42
+ else
43
+ echo " Skipping CUDA install"
44
+ fi
0 commit comments