Skip to content

Commit 0ee5f71

Browse files
author
Chris Maunder
committed
Better handling of cuDNN during installation in Ubuntu
1 parent 1371b8a commit 0ee5f71

File tree

4 files changed

+43
-31
lines changed

4 files changed

+43
-31
lines changed

devops/install/install_cuDNN.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,23 @@ writeLine "Setting up CUDA ${cuda_version} and cuDNN" $color_info
104104
cuda_GPGpublicKey="3bf863cc"
105105

106106
case "$cuda_version" in
107-
"12.6") cuda_version_full="12.6.1"; cuda_GPGpublicKey="3bf863cc" ;;
108-
"12.5") cuda_version_full="12.5.1"; cuda_GPGpublicKey="3bf863cc" ;;
109-
"12.5") cuda_version_full="12.4.1"; cuda_GPGpublicKey="3bf863cc" ;;
110-
"12.3") cuda_version_full="12.3.2"; cuda_GPGpublicKey="3bf863cc" ;;
111-
"12.2") cuda_version_full="12.2.2"; cuda_GPGpublicKey="3bf863cc" ;;
112-
"12.1") cuda_version_full="12.1.1"; cuda_GPGpublicKey="3bf863cc" ;;
113-
"12.0") cuda_version_full="12.0.1"; cuda_GPGpublicKey="3bf863cc" ;;
114-
"11.8") cuda_version_full="11.8.0"; cuda_GPGpublicKey="3bf863cc" ;;
115-
"11.7") cuda_version_full="11.7.1"; cuda_GPGpublicKey="3bf863cc" ;;
116-
"11.6") cuda_version_full="11.6.2"; cuda_GPGpublicKey="3bf863cc" ;;
117-
"11.5") cuda_version_full="11.5.2"; cuda_GPGpublicKey="3bf863cc" ;;
118-
"11.4") cuda_version_full="11.4.4"; cuda_GPGpublicKey="7fa2af80" ;;
119-
"11.3") cuda_version_full="11.3.1"; cuda_GPGpublicKey="7fa2af80" ;;
120-
"11.2") cuda_version_full="11.2.2"; cuda_GPGpublicKey="7fa2af80" ;;
121-
"11.1") cuda_version_full="11.1.1"; cuda_GPGpublicKey="7fa2af80" ;;
122-
"11.0") cuda_version_full="11.0.1"; cuda_GPGpublicKey="7fa2af80" ;;
123-
"10.2") cuda_version_full="10.2.89"; cuda_GPGpublicKey="7fa2af80" ;;
107+
"12.6") cuda_version_full="12.6.1"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
108+
"12.5") cuda_version_full="12.5.1"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
109+
"12.5") cuda_version_full="12.4.1"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
110+
"12.3") cuda_version_full="12.3.2"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
111+
"12.2") cuda_version_full="12.2.2"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
112+
"12.1") cuda_version_full="12.1.1"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
113+
"12.0") cuda_version_full="12.0.1"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
114+
"11.8") cuda_version_full="11.8.0"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
115+
"11.7") cuda_version_full="11.7.1"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
116+
"11.6") cuda_version_full="11.6.2"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
117+
"11.5") cuda_version_full="11.5.2"; cuda_GPGpublicKey="3bf863cc" cudnn_version="8.9.5.*" ;;
118+
"11.4") cuda_version_full="11.4.4"; cuda_GPGpublicKey="7fa2af80" cudnn_version="8.9.5.*" ;;
119+
"11.3") cuda_version_full="11.3.1"; cuda_GPGpublicKey="7fa2af80" cudnn_version="8.9.5.*" ;;
120+
"11.2") cuda_version_full="11.2.2"; cuda_GPGpublicKey="7fa2af80" cudnn_version="8.9.5.*" ;;
121+
"11.1") cuda_version_full="11.1.1"; cuda_GPGpublicKey="7fa2af80" cudnn_version="8.9.5.*" ;;
122+
"11.0") cuda_version_full="11.0.1"; cuda_GPGpublicKey="7fa2af80" cudnn_version="8.9.5.*" ;;
123+
"10.2") cuda_version_full="10.2.89"; cuda_GPGpublicKey="7fa2af80" cudnn_version="8.9.5.*" ;;
124124
*) cuda_version_full="${cuda_version}.0" ;;
125125
esac
126126

src/SDK/NET/Utils/SystemInfo.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,28 +1701,24 @@ private async static Task CheckOSVersionNameAsync()
17011701
if (results is not null)
17021702
_osName = results["output"]?.Trim(); // eg "ubuntu", "debian"
17031703

1704+
// VERSION_ID is in form "24.10"
1705+
results = await GetProcessInfoAsync("/bin/bash", "-c \". /etc/os-release;echo $VERSION_ID\"", null)
1706+
.ConfigureAwait(false);
1707+
if (results is not null)
1708+
_osVersion = results["output"]?.Trim(); // eg. "22.04" for Ubuntu 22.04, "12" for Debian 12
1709+
17041710
// VERSION is in form "24.10 (Oracular Oriole)"
1705-
var pattern = @"(?<version>\d+\.\d+) \((?<name>[a-z\s]+)\)";
1711+
var pattern = @"\((?<name>[a-z\s]+)\)";
17061712
var options = RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;
17071713
results = await GetProcessInfoAsync("/bin/bash", "-c \". /etc/os-release;echo $VERSION\"",
17081714
pattern, options).ConfigureAwait(false);
17091715
if (results is not null)
17101716
{
1711-
_osVersion = results["version"]?.Trim(); // eg. "22.04" for Ubuntu 22.04, "12" for Debian 12
17121717
string? name = results["name"]?.Trim(); // eg. "Oracular Oriole" for Ubuntu 24.10
17131718
if (!string.IsNullOrWhiteSpace(name))
17141719
_osName += " (" + name + ")";
17151720
}
17161721

1717-
// Just in case above failed
1718-
if (string.IsNullOrWhiteSpace(_osVersion))
1719-
{
1720-
// VERSION_ID is in form "24.10"
1721-
results = await GetProcessInfoAsync("/bin/bash", "-c \". /etc/os-release;echo $VERSION_ID\"", null)
1722-
.ConfigureAwait(false);
1723-
if (results is not null)
1724-
_osVersion = results["output"]?.Trim(); // eg. "22.04" for Ubuntu 22.04, "12" for Debian 12
1725-
}
17261722
}
17271723
else if (IsWindows)
17281724
{

src/scripts/utils.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,9 +1754,6 @@ function installRequiredPythonPackages () {
17541754
if [ "$installGPU" = "true" ]; then
17551755

17561756
if [ "$cuda_version" != "" ]; then
1757-
1758-
cuda_major_version=${cuda_version%%.*}
1759-
cuda_major_minor=$(echo "$cuda_version" | sed 's/\./_/g')
17601757

17611758
if [ "${verbosity}" != "quiet" ]; then
17621759
writeLine "CUDA version is $cuda_version (${cuda_major_minor} / ${cuda_major_version})" $color_info
@@ -2332,6 +2329,9 @@ function getCudaVersion () {
23322329
fi
23332330
fi
23342331

2332+
cuda_major_version=${cuda_version%%.*}
2333+
cuda_major_minor=$(echo "$cuda_version" | sed 's/\./_/g')
2334+
23352335
echo $cuda_version
23362336
}
23372337

src/setup.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,22 +883,38 @@ writeLine
883883
hasCUDA=false
884884

885885
cuDNN_version=""
886+
cuda_major_version=""
887+
cuda_major_minor=""
888+
886889
if [ "$os" = "macos" ]; then
887890
cuda_version=""
888891
elif [ "${edgeDevice}" = "Jetson" ]; then
889892
hasCUDA=true
890893
cuda_version=$(getCudaVersion)
894+
cuda_major_version=${cuda_version%%.*}
895+
cuda_major_minor=$(echo "$cuda_version" | sed 's/\./_/g')
891896
cuDNN_version=$(getcuDNNVersion)
897+
892898
elif [ "${edgeDevice}" = "Raspberry Pi" ] || [ "${edgeDevice}" = "Orange Pi" ] || [ "${edgeDevice}" = "Radxa ROCK" ]; then
893899
cuda_version=""
894900
else
895901
cuda_version=$(getCudaVersion)
902+
cuda_major_version=${cuda_version%%.*}
903+
cuda_major_minor=$(echo "$cuda_version" | sed 's/\./_/g')
896904

897905
if [ "$cuda_version" != "" ]; then
898906

899907
hasCUDA=true
900908
cuDNN_version=$(getcuDNNVersion)
901909

910+
if [ "$cuDNN_version" == "" ]; then
911+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
912+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
913+
rm cuda-keyring_1.1-1_all.deb
914+
sudo apt-get update
915+
sudo apt-get -y install "cudnn-cuda-$cuda_major_version"
916+
fi
917+
902918
# disable this
903919
if [ "${systemName}" = "WSL-but-we're-ignoring-this-for-now" ]; then # we're disabling this on purpose
904920
checkForAdminRights

0 commit comments

Comments
 (0)