1
0

cuda-install.sh 636 B

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