Created
July 7, 2023 12:20
-
-
Save ocramz/9061c1649a8d506aa833225a20589180 to your computer and use it in GitHub Desktop.
Setup CUDA 11.8 drivers, miniconda and pytorch on Ubuntu 22.04 on AWS EC2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt update | |
apt -y install build-essential # install GCC | |
apt -y install --reinstall software-properties-common # enable add-apt-repository | |
apt-get -y install lshw | |
apt-get clean | |
export DISTRO_UBUNTU=ubuntu2204/x86_64 | |
# # Ubuntu 22 - : install CUDA 11.8 (for Pytorch support) | |
wget https://developer.download.nvidia.com/compute/cuda/repos/${DISTRO_UBUNTU}/cuda-ubuntu2204.pin | |
mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb | |
dpkg -i cuda-repo-ubuntu2204-11-8-local_11.8.0-520.61.05-1_amd64.deb | |
cp /var/cuda-repo-ubuntu2204-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/ | |
apt-get update | |
apt-get -y install cuda | |
# ensure cuda binaries are on path | |
export PATH=/usr/local/cuda-11.8/bin${PATH:+:${PATH}} | |
nvcc --version | |
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh | |
bash Miniconda3-latest-Linux-x86_64.sh -b -f | |
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment