2021-06-04 20:02:07 +08:00
|
|
|
#!/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 '.')"
|
2021-06-04 20:02:07 +08:00
|
|
|
else
|
2021-11-12 11:58:00 +08:00
|
|
|
echo "Unable to deploy CUDA on this OS, please wait for a future script update"
|
2023-09-27 08:04:56 +08:00
|
|
|
exit 2
|
2021-06-04 20:02:07 +08:00
|
|
|
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"
|
2023-09-27 08:04:56 +08:00
|
|
|
exit 3
|
2021-11-12 11:58:00 +08:00
|
|
|
fi
|
|
|
|
|
2022-07-01 22:46:41 +08:00
|
|
|
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
|
2023-09-21 14:06:26 +08:00
|
|
|
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
|
2022-07-01 22:46:41 +08:00
|
|
|
sudo apt-get install -y --no-install-recommends cuda-${CUDA_VERSION_DASHED}
|
2023-09-21 14:06:26 +08:00
|
|
|
sudo apt-get install -y --no-install-recommends libcudnn8
|
|
|
|
sudo apt-get install -y --no-install-recommends libcudnn8-dev
|
2022-07-01 22:46:41 +08:00
|
|
|
|
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
|
2023-09-21 14:06:26 +08:00
|
|
|
|
|
|
|
sudo apt-get clean
|