Skip to content

Commit 4060cfe

Browse files
author
Chris Maunder
committed
More work on getting CUDA/cuDNN and libs in Linux setup
1 parent 0ee5f71 commit 4060cfe

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/SDK/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ if [ "$os" = "linux" ]; then
6161

6262
# - Needed for opencv-python (TODO: review these and move into module installers that actually use OpenCV)
6363
packages="ffmpeg libsm6 libxext6"
64-
# - So we can query glxinfo for GPU info (mesa) and install modules (the rest)
64+
# - So we can query glxinfo for GPU info (mesa) and install modules (the rest).
65+
# NOTE: The general setup.sh file should have already installed curl and wget
6566
packages="${packages} mesa-utils curl rsync unzip wget"
6667
installAptPackages "${packages}"
6768

src/scripts/utils.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,7 @@ function getCudaVersion () {
23302330
fi
23312331

23322332
cuda_major_version=${cuda_version%%.*}
2333+
cuda_minor_version=${cuda_version#*.}
23332334
cuda_major_minor=$(echo "$cuda_version" | sed 's/\./_/g')
23342335

23352336
echo $cuda_version

src/setup.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,21 +900,35 @@ elif [ "${edgeDevice}" = "Raspberry Pi" ] || [ "${edgeDevice}" = "Orange Pi" ] |
900900
else
901901
cuda_version=$(getCudaVersion)
902902
cuda_major_version=${cuda_version%%.*}
903+
cuda_minor_version=${cuda_version#*.}
903904
cuda_major_minor=$(echo "$cuda_version" | sed 's/\./_/g')
904905

905906
if [ "$cuda_version" != "" ]; then
906907

907908
hasCUDA=true
908909
cuDNN_version=$(getcuDNNVersion)
909910

910-
if [ "$cuDNN_version" == "" ]; then
911+
installKeyring=false
912+
if [ "$cuDNN_version" == "" ] || [ ! -x "$(command -v nvcc)" ]; then
911913
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
912914
sudo dpkg -i cuda-keyring_1.1-1_all.deb
913915
rm cuda-keyring_1.1-1_all.deb
916+
fi
917+
918+
if [ "$cuDNN_version" == "" ]; then
919+
# cuDNN
920+
# https://developer.nvidia.com/cudnn-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local
914921
sudo apt-get update
915922
sudo apt-get -y install "cudnn-cuda-$cuda_major_version"
916923
fi
917924

925+
if [ ! -x "$(command -v nvcc)" ]; then
926+
# CUDA toolkit
927+
# https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_network
928+
sudo apt-get update
929+
sudo apt-get -y install cuda-toolkit-${cuda_major_version}-${cuda_minor_version}
930+
fi
931+
918932
# disable this
919933
if [ "${systemName}" = "WSL-but-we're-ignoring-this-for-now" ]; then # we're disabling this on purpose
920934
checkForAdminRights

0 commit comments

Comments
 (0)