dotfiles/deeplearning/install.sh

44 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-02 04:08:18 +00:00
DIR=$(readlink -f "$(dirname "$0")")
. "$DIR/../env.sh"
2020-09-18 04:16:15 +00:00
2020-11-02 04:08:18 +00:00
"$ROOT/python/install.sh"
2020-09-18 04:16:15 +00:00
# install deep learning tools
case "$PM" in
apt)
# 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
2020-09-18 04:16:15 +00:00
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
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