darknet/scripts/deploy-cuda.sh

38 lines
1.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Unable to deploy CUDA on macOS, please wait for a future script update"
2021-11-12 11:58:00 +08:00
exit 1
elif [[ $(cut -f2 <<< $(lsb_release -i)) == "Ubuntu" ]]; then
distr_name="$(cut -f2 <<< $(lsb_release -i) | tr '[:upper:]' '[:lower:]')$(cut -f2 <<< $(lsb_release -r) | tr -d '.')"
else
2021-11-12 11:58:00 +08:00
echo "Unable to deploy CUDA on this OS, please wait for a future script update"
exit 3
fi
2021-11-12 11:58:00 +08:00
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
if [ -f $script_dir/requested_cuda_version.sh ]; then
source $script_dir/requested_cuda_version.sh
else
echo "Unable to find requested_cuda_version.sh script"
exit 1
fi
sudo apt-key del 7fa2af80
2023-08-26 07:41:27 +08:00
wget https://developer.download.nvidia.com/compute/cuda/repos/$distr_name/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
2021-11-12 11:58:00 +08:00
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential g++
sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates gnupg software-properties-common wget
sudo apt-get install -y --no-install-recommends zlib1g
2021-11-12 11:58:00 +08:00
sudo apt-get dist-upgrade -y
sudo apt-get install -y --no-install-recommends cuda-${CUDA_VERSION_DASHED}
sudo apt-get install -y --no-install-recommends libcudnn8
sudo apt-get install -y --no-install-recommends libcudnn8-dev
2021-11-12 11:58:00 +08:00
sudo rm -rf /usr/local/cuda
sudo ln -s /usr/local/cuda-${CUDA_VERSION} /usr/local/cuda
sudo apt-get clean