-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall_cuda.sh
More file actions
executable file
·64 lines (53 loc) · 1.6 KB
/
install_cuda.sh
File metadata and controls
executable file
·64 lines (53 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -euo pipefail
CUDA_VERSION=12-3
CUDA_MAJOR=12.3
# ----------------------------
# Add NVIDIA CUDA RHEL8 repo
# ----------------------------
curl -fsSL \
https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo \
-o /etc/yum.repos.d/cuda.repo
yum clean all
yum makecache
# ----------------------------
# Install minimal CUDA 12.3 toolkit
# (no drivers inside container)
# ----------------------------
yum -y install \
cuda-nvcc-${CUDA_VERSION} \
cuda-cudart-devel-${CUDA_VERSION} \
cuda-libraries-devel-${CUDA_VERSION} \
cuda-toolkit-${CUDA_VERSION} \
--exclude=cuda-drivers
# ----------------------------
# Install cuDNN 9.x for CUDA 12.3
# (TensorFlow 2.17 requirement)
# ----------------------------
yum -y install \
libcudnn9-cuda-12 \
libcudnn9-devel-cuda-12
# ----------------------------
# Cleanup yum cache
# ----------------------------
yum clean all
rm -rf /var/cache/yum /var/cache/dnf
# ----------------------------
# Environment setup
# ----------------------------
export CUDA_HOME=/usr/local/cuda-${CUDA_MAJOR}
export PATH=${CUDA_HOME}/bin:${PATH}
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
# Optional: symlink for compatibility
ln -sfn /usr/local/cuda-${CUDA_MAJOR} /usr/local/cuda
# ----------------------------
# Verify installation
# ----------------------------
echo "=== NVCC ==="
nvcc --version
echo "=== cuDNN ==="
ldconfig -p | grep cudnn || echo "cuDNN not visible in linker cache"
# ----------------------------
# Final cleanup to reduce image size
# ----------------------------
rm -rf /root/.cache /tmp/* /var/tmp/*