@@ -796,7 +796,7 @@ writeLine "${formattedFreeSpace} of ${formattedTotalSpace} available on ${system
796796# Install tools that we know are available via apt-get or brew
797797if [ " $os " = " linux" ]; then
798798 checkForTool curl
799- if [ " ${os_name} " = " Debian " ]; then
799+ if [ " ${os_name} " = " debian " ]; then
800800 checkForTool psmisc
801801 else
802802 checkForTool pstree
@@ -857,7 +857,7 @@ writeLine
857857
858858if [ " $verbosity " != " quiet" ]; then
859859 writeLine
860- writeLine " os, name, arch = ${os} ${os_name} ${architecture} " $color_mute
860+ writeLine " os, name, arch = ${os} ${os_name} ( ${os_code_name} ) ${architecture} " $color_mute
861861 writeLine " systemName, platform = ${systemName} , ${platform} " $color_mute
862862 writeLine " edgeDevice = ${edgeDevice} " $color_mute
863863 writeLine " SSH = ${inSSH} " $color_mute
@@ -885,111 +885,7 @@ writeLine "GPU support" "White" "DarkGreen" $lineWidth
885885writeLine
886886
887887# Test for CUDA
888-
889- hasCUDA= false
890-
891- # =====================================================================
892- # MOVE ALL OF THIS INTO utils.sh
893-
894- cuDNN_version= " "
895- cuda_major_version= " "
896- cuda_major_minor= " "
897-
898- if [ " $os " = " macos" ]; then
899- cuda_version=" "
900- elif [ " ${edgeDevice} " = " Jetson" ]; then
901- hasCUDA=true
902- cuda_version=$( getCudaVersion)
903- cuda_major_version=${cuda_version%% .* }
904- cuda_major_minor=$( echo " $cuda_version " | sed ' s/\./_/g' )
905- cuDNN_version=$( getcuDNNVersion)
906-
907- elif [ " ${edgeDevice} " = " Raspberry Pi" ] || [ " ${edgeDevice} " = " Orange Pi" ] || [ " ${edgeDevice} " = " Radxa ROCK" ]; then
908- cuda_version=" "
909- else
910- cuda_version=$( getCudaVersion)
911- cuda_major_version=${cuda_version%% .* }
912- cuda_minor_version=${cuda_version#* .}
913- cuda_major_minor=$( echo " $cuda_version " | sed ' s/\./_/g' )
914-
915- if [ " $cuda_version " != " " ]; then
916-
917- hasCUDA=true
918- cuDNN_version=$( getcuDNNVersion)
919-
920- installKeyring=false
921- if [ " $cuDNN_version " = " " ] || [ ! -x " $( command -v nvcc) " ]; then
922- writeLine " Installing NVIDIA keyring" $color_info
923- wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb > /dev/null 2>&1 &
924- spin $!
925- sudo dpkg -i cuda-keyring_1.1-1_all.deb > /dev/null &
926- spin $!
927- rm cuda-keyring_1.1-1_all.deb
928- fi
929-
930- if [ " $cuDNN_version " = " " ]; then
931- writeLine " Installing cuDNN" $color_info
932- # cuDNN
933- # https://developer.nvidia.com/cudnn-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local
934- sudo apt-get update > /dev/null 2>&1 &
935- spin $!
936- sudo apt-get install " cudnn-cuda-$cuda_major_version " -y > /dev/null 2>&1 &
937- spin $!
938- fi
939-
940- if [ ! -x " $( command -v nvcc) " ]; then
941- # CUDA toolkit
942- # https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_network
943- writeLine " Installing CUDA toolkit" $color_info
944-
945- if [ " ${os_name} " = " Debian" ]; then
946- deb http://deb.debian.org/debian $os_code_name main contrib non-free
947- deb-src http://deb.debian.org/debian $os_code_name main contrib non-free
948- fi
949-
950- sudo apt-get update > /dev/null 2>&1 &
951- spin $!
952- sudo apt-get install cuda-toolkit-${cuda_major_version} -${cuda_minor_version} -y > /dev/null 2>&1 &
953- spin $!
954- fi
955-
956- # disable this
957- if [ " ${systemName} " = " WSL-but-we're-ignoring-this-for-now" ]; then # we're disabling this on purpose
958- checkForAdminRights
959- if [ " $isAdmin " = false ]; then
960- writeLine " insufficient permission to install CUDA toolkit. Rerun under sudo" $color_error
961- else
962- # https://stackoverflow.com/a/66486390
963- cp /usr/lib/wsl/lib/nvidia-smi /usr/bin/nvidia-smi > /dev/null 2>&1
964- chmod a+x /usr/bin/nvidia-smi > /dev/null 2>&1
965-
966- # Out of the box, WSL might come with CUDA 11.5, and no toolkit,
967- # meaning we rely on nvidia-smi for version info, which is wrong.
968- # We also should be thinking about CUDA 11.8 as a minimum, so let's
969- # upgrade.
970- cuda_comparison=$( versionCompare $cuda_version " 11.8" )
971- if [ " $cuda_comparison " = " -1" ]; then
972- writeLine " Upgrading WSL's CUDA install to 11.8" $color_info
973-
974- saveState
975- correctLineEndings " ${installScriptsDirPath} /install_cuDNN.sh"
976- source " ${installScriptsDirPath} /install_cuDNN.sh" 11.8
977- restoreState
978- fi
979- fi
980- fi
981-
982- # We may have nvidia-smi, but not nvcc (eg in WSL). Fix this.
983- if [ -x " $( command -v nvidia-smi) " ] && [ ! -x " $( command -v nvcc) " ]; then
984-
985- installAptPackages " nvidia-cuda-toolkit"
986-
987- # The initial version we got would have been from nvidia-smi, which
988- # is wrong. Redo.
989- cuda_version=$( getCudaVersion)
990- fi
991- fi
992- fi
888+ CheckAndSetupCUDA
993889
994890write " CUDA (NVIDIA) Present: "
995891if [ " $hasCUDA " = true ]; then
0 commit comments