main
sh 23 lines 649 Bytes
Raw
1 #!/bin/bash
2
3 # Replace '.' with '-' ex: 11.8 -> 11-8
4 cuda_version=$(echo "$1" | tr "." "-")
5 # Removes '-' and '.' ex: ubuntu-20.04 -> ubuntu2004
6 OS=$(echo "$2" | tr -d ".\-")
7
8 # Installs CUDA
9 wget -nv "https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-keyring_1.1-1_all.deb"
10 sudo dpkg -i cuda-keyring_1.1-1_all.deb
11 rm cuda-keyring_1.1-1_all.deb
12 sudo apt -qq update
13 sudo apt -y install "cuda-${cuda_version}" "cuda-nvcc-${cuda_version}" "cuda-libraries-dev-${cuda_version}"
14 sudo apt clean
15
16 # Test nvcc
17 PATH=/usr/local/cuda-$1/bin:${PATH}
18 nvcc --version
19
20 # Log gcc, g++, c++ versions
21 gcc --version
22 g++ --version
23 c++ --version