dotfiles/devel/deeplearning.sh

46 lines
1.5 KiB
Bash
Raw Normal View History

2020-11-02 04:08:18 +00:00
#!/bin/sh
2020-09-18 04:16:15 +00:00
2020-11-08 16:26:14 +00:00
DIR=$(dirname "$(readlink -f "$0")")
2020-11-02 04:08:18 +00:00
. "$DIR/../env.sh"
2020-09-18 04:16:15 +00:00
2020-11-04 06:05:09 +00:00
"$PDIR/python/install.sh"
2020-09-18 04:16:15 +00:00
# install deep learning tools
case "$PM" in
apt)
# auto install nvidia driver
sudo ubuntu-drivers autoinstall
# cuda
2020-11-02 04:08:18 +00:00
. /etc/lsb-release
2020-09-18 04:16:15 +00:00
if [ "$DISTRIB_RELEASE" = "18.04" ] && [ "$(uname -m)" = 'x86_64' ]; then
2020-11-02 04:08:18 +00:00
sudo apt install "linux-headers-$(uname -r)"
2020-09-18 04:16:15 +00:00
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
2020-09-19 15:33:13 +00:00
sudo apt-key adv --fetch-keys \
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /" -y -n
pm_update
sudo apt -y install cuda
2020-09-18 04:16:15 +00:00
elif [ "$DISTRIB_RELEASE" = "20.04" ]; then
sudo apt install nvidia-cuda-toolkit
else
echo 'Unsupported release'
2020-11-02 04:08:18 +00:00
exit 1
2020-09-18 04:16:15 +00:00
fi
# nvidia docker
2020-11-02 04:08:18 +00:00
distribution="$ID$VERSION_ID"
2020-09-19 01:23:38 +00:00
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
2020-11-02 04:08:18 +00:00
curl -s -L "https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list" | \
2020-09-19 15:33:13 +00:00
sudo tee /etc/apt/sources.list.d/nvidia-docker.list
2020-09-19 01:23:38 +00:00
sudo apt update
sudo apt install -y nvidia-docker2
2020-09-18 04:16:15 +00:00
;;
pacman)
echo TODO
2020-11-02 04:08:18 +00:00
exit 1
2020-09-18 04:16:15 +00:00
;;
esac