diff --git a/install_cuda.py b/install_cuda.py deleted file mode 100644 index 0122be04b..000000000 --- a/install_cuda.py +++ /dev/null @@ -1,100 +0,0 @@ -import os -import subprocess -import sys -from urllib.request import urlretrieve - -cuda_versions = { - "118": "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run", - "120": "https://developer.download.nvidia.com/compute/cuda/12.0.1/local_installers/cuda_12.0.1_525.85.12_linux.run", - "121": "https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run", - "122": "https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run", - "123": "https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/cuda_12.3.2_545.23.08_linux.run", - "124": "https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run", - "125": "https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda_12.5.1_555.42.06_linux.run", - "126": "https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda_12.6.2_560.35.03_linux.run", -} - - -def install_cuda(version, base_path, download_path): - formatted_version = f"{version[:-1]}.{version[-1]}" - folder = f"cuda-{formatted_version}" - install_path = os.path.join(base_path, folder) - - if os.path.exists(install_path): - print(f"Removing existing CUDA version {version} at {install_path}...") - subprocess.run(["rm", "-rf", install_path], check=True) - - url = cuda_versions[version] - filename = url.split("/")[-1] - filepath = os.path.join(download_path, filename) - - if not os.path.exists(filepath): - print(f"Downloading CUDA version {version} from {url}...") - urlretrieve(url, filepath) - else: - print(f"Installer for CUDA version {version} already downloaded.") - - # Make the installer executable - subprocess.run(["chmod", "+x", filepath], check=True) - - # Install CUDA - print(f"Installing CUDA version {version}...") - install_command = [ - "bash", - filepath, - "--no-drm", - "--no-man-page", - "--override", - "--toolkitpath=" + install_path, - "--toolkit", - "--silent", - ] - - print(f"Running command: {' '.join(install_command)}") - - try: - subprocess.run(install_command, check=True) - except subprocess.CalledProcessError as e: - print(f"Installation failed for CUDA version {version}: {e}") - return - finally: - # Delete the installer file - os.remove(filepath) - - print(f"CUDA version {version} installed at {install_path}") - - -def main(): - user_base_path = os.path.expanduser("~/cuda") - system_base_path = "/usr/local/cuda" - base_path = user_base_path # default to user-specific installation - download_path = "/tmp" # default download path - - if len(sys.argv) < 2: - print("Usage: python install_cuda.py [user/system] [download_path]") - sys.exit(1) - - version = sys.argv[1] - if len(sys.argv) > 2: - base_path = system_base_path if sys.argv[2] == "system" else user_base_path - if len(sys.argv) > 3: - download_path = sys.argv[3] - - if not os.path.exists(base_path): - os.makedirs(base_path) - if not os.path.exists(download_path): - os.makedirs(download_path) - - # Install CUDA version(s) - if version == "all": - for ver in cuda_versions: - install_cuda(ver, base_path, download_path) - elif version in cuda_versions: - install_cuda(version, base_path, download_path) - else: - print(f"Invalid CUDA version: {version}. Available versions are: {', '.join(cuda_versions.keys())}") - sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/install_cuda.sh b/install_cuda.sh deleted file mode 100644 index 51a00eefd..000000000 --- a/install_cuda.sh +++ /dev/null @@ -1,60 +0,0 @@ -URL118=https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run -URL120=https://developer.download.nvidia.com/compute/cuda/12.0.1/local_installers/cuda_12.0.1_525.85.12_linux.run -URL121=https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run -URL122=https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run -URL123=https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/cuda_12.3.2_545.23.08_linux.run -URL124=https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run -URL125=https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda_12.5.1_555.42.06_linux.run -URL126=https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda_12.6.2_560.35.03_linux.run - -CUDA_VERSION=$1 -BASE_PATH=$2 -EXPORT_BASHRC=$3 - -if [[ -n "$CUDA_VERSION" ]]; then - if [[ "$CUDA_VERSION" -eq "118" ]]; then - URL=$URL118 - FOLDER=cuda-11.8 - elif [[ "$CUDA_VERSION" -eq "120" ]]; then - URL=$URL120 - FOLDER=cuda-12.0 - elif [[ "$CUDA_VERSION" -eq "121" ]]; then - URL=$URL121 - FOLDER=cuda-12.1 - elif [[ "$CUDA_VERSION" -eq "122" ]]; then - URL=$URL122 - FOLDER=cuda-12.2 - elif [[ "$CUDA_VERSION" -eq "123" ]]; then - URL=$URL123 - FOLDER=cuda-12.3 - elif [[ "$CUDA_VERSION" -eq "124" ]]; then - URL=$URL124 - FOLDER=cuda-12.4 - elif [[ "$CUDA_VERSION" -eq "125" ]]; then - URL=$URL125 - FOLDER=cuda-12.5 - elif [[ "$CUDA_VERSION" -eq "126" ]]; then - URL=$URL126 - FOLDER=cuda-12.6 - else - echo "argument error: No cuda version passed as input. Choose among versions 118 to 126" - fi -else - echo "argument error: No cuda version passed as input. Choose among versions 118 to 126" -fi - -FILE=$(basename $URL) - -if [[ -n "$CUDA_VERSION" ]]; then - echo $URL - echo $FILE - wget $URL - bash $FILE --no-drm --no-man-page --override --toolkitpath=$BASE_PATH/$FOLDER/ --toolkit --silent - if [ "$EXPORT_BASHRC" -eq "1" ]; then - echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$BASE_PATH/$FOLDER/lib64" >> ~/.bashrc - echo "export PATH=\$PATH:$BASE_PATH/$FOLDER/bin" >> ~/.bashrc - source ~/.bashrc - fi -else - echo "" -fi