File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ if ! command -v nvidia-smi & > /dev/null; then
4+ echo " Error: 'nvidia-smi' command not found."
5+ exit 1
6+ fi
7+
38# GKE injects /usr/local/nvidia from the host but does not add it to PATH or
49# run ldconfig for it, unlike the nvidia-container-runtime on AWS which does both.
510if [ -d /usr/local/nvidia/bin ]; then
611 export PATH=" ${PATH} :/usr/local/nvidia/bin"
712fi
813if [ -d /usr/local/nvidia/lib64 ]; then
9- echo /usr/local/nvidia/lib64 > /etc/ld.so.conf.d/nvidia-host.conf
14+ echo /usr/local/nvidia/lib64 > /etc/ld.so.conf.d/nvidia-host.conf
1015 ldconfig
1116fi
1217
13- if ! command -v nvidia-smi & > /dev/null; then
14- echo " Error: 'nvidia-smi' command not found."
15- exit 1
16- fi
17-
1818# NOTE: Given that we need to support CUDA versions earlier than CUDA 12.9.1, we
1919# need to include the `cuda-compat-12-9` in `LD_LIBRARY_PATH` when the host CUDA
2020# version is lower than that; whilst we shouldn't include that when CUDA is 13.0+
2121# as otherwise it will fail due to it.
2222if [ -d /usr/local/cuda/compat ]; then
23- DRIVER_CUDA=$( nvidia-smi 2> /dev/null | awk ' /CUDA Version/ {print $3; exit}' )
23+ # Match both "CUDA Version" and "CUDA UMD Version" (on `driver-6xx` onwards)
24+ DRIVER_CUDA=$( nvidia-smi 2> /dev/null | grep -oE ' CUDA[[:space:]]+([A-Za-z]+[[:space:]])?Version:[[:space:]]*[0-9]+(\.[0-9]+)+' | grep -oE ' [0-9]+(\.[0-9]+)+' | head -n1)
2425
2526 IFS=' .' read -r MAJ MIN PATCH << EOF
2627${DRIVER_CUDA:- 0.0.0}
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ if ! command -v nvidia-smi & > /dev/null; then
4+ echo " Error: 'nvidia-smi' command not found."
5+ exit 1
6+ fi
7+
38# GKE injects /usr/local/nvidia from the host but does not add it to PATH or
49# run ldconfig for it, unlike the nvidia-container-runtime on AWS which does both.
510if [ -d /usr/local/nvidia/bin ]; then
611 export PATH=" ${PATH} :/usr/local/nvidia/bin"
712fi
813if [ -d /usr/local/nvidia/lib64 ]; then
9- echo /usr/local/nvidia/lib64 > /etc/ld.so.conf.d/nvidia-host.conf
14+ echo /usr/local/nvidia/lib64 > /etc/ld.so.conf.d/nvidia-host.conf
1015 ldconfig
1116fi
1217
13- if ! command -v nvidia-smi & > /dev/null; then
14- echo " Error: 'nvidia-smi' command not found."
15- exit 1
16- fi
17-
1818# NOTE: Given that we need to support CUDA versions earlier than CUDA 12.9.1, we
1919# need to include the `cuda-compat-12-9` in `LD_LIBRARY_PATH` when the host CUDA
2020# version is lower than that; whilst we shouldn't include that when CUDA is 13.0+
You can’t perform that action at this time.
0 commit comments