From ca273828f1140a32721bf19e91dc3f2877067287 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Wed, 1 Jun 2022 17:59:08 +0800 Subject: [PATCH] Update scripts to install cuda/cudnn/torch. --- scripts/github_actions/install_cuda.sh | 7 +++++ scripts/github_actions/install_cudnn.sh | 35 ++++++++++++------------ scripts/github_actions/install_torch.sh | 36 ++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/scripts/github_actions/install_cuda.sh b/scripts/github_actions/install_cuda.sh index 7d023b9..b84de89 100755 --- a/scripts/github_actions/install_cuda.sh +++ b/scripts/github_actions/install_cuda.sh @@ -36,6 +36,13 @@ case "$cuda" in # url=https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run url=https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda_11.1.1_455.32.00_linux.run ;; + 11.3) + # url=https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda_11.3.0_465.19.01_linux.run + url=https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux.run + ;; + 11.5) + url=https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda_11.5.2_495.29.05_linux.run + ;; *) echo "Unknown cuda version: $cuda" exit 1 diff --git a/scripts/github_actions/install_cudnn.sh b/scripts/github_actions/install_cudnn.sh index 853eba5..8feafbe 100755 --- a/scripts/github_actions/install_cudnn.sh +++ b/scripts/github_actions/install_cudnn.sh @@ -17,42 +17,43 @@ case $cuda in 10.0) filename=cudnn-10.0-linux-x64-v7.6.5.32.tgz - url=http://www.mediafire.com/file/1037lb1vmj9qdtq/cudnn-10.0-linux-x64-v7.6.5.32.tgz/file ;; 10.1) filename=cudnn-10.1-linux-x64-v8.0.2.39.tgz - url=http://www.mediafire.com/file/fnl2wg0h757qhd7/cudnn-10.1-linux-x64-v8.0.2.39.tgz/file ;; 10.2) filename=cudnn-10.2-linux-x64-v8.0.2.39.tgz - url=http://www.mediafire.com/file/sc2nvbtyg0f7ien/cudnn-10.2-linux-x64-v8.0.2.39.tgz/file ;; 11.0) filename=cudnn-11.0-linux-x64-v8.0.5.39.tgz - url=https://www.mediafire.com/file/abyhnls106ko9kp/cudnn-11.0-linux-x64-v8.0.5.39.tgz/file ;; 11.1) - filename=cudnn-11.1-linux-x64-v8.0.5.39.tgz - url=https://www.mediafire.com/file/qx55zd65773xonv/cudnn-11.1-linux-x64-v8.0.5.39.tgz/file + filename=cudnn-11.1-linux-x64-v8.0.4.30.tgz ;; + 11.3) + filename=cudnn-11.3-linux-x64-v8.2.0.53.tgz + ;; + 11.5) + filename=cudnn-11.3-linux-x64-v8.2.0.53.tgz + ;; + # 11.5) + # filename=cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive.tar.xz + # ;; *) echo "Unsupported cuda version: $cuda" exit 1 ;; esac -function retry() { - $* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*) -} +command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nPlease install 'git-lfs' first."; exit 2; } -# It is forked from https://github.com/Juvenal-Yescas/mediafire-dl -# https://github.com/Juvenal-Yescas/mediafire-dl/pull/2 changes the filename and breaks the CI. -# We use a separate fork to keep the link fixed. -retry wget https://raw.githubusercontent.com/csukuangfj/mediafire-dl/master/mediafire_dl.py +git clone https://huggingface.co/csukuangfj/cudnn +cd cudnn +git lfs pull --include="$filename" -sed -i 's/quiet=False/quiet=True/' mediafire_dl.py -retry python3 mediafire_dl.py "$url" -sudo tar xf ./$filename -C /usr/local -rm -v ./$filename +sudo tar xf ./$filename --strip-components=1 -C /usr/local/cuda + +# save disk space +git lfs prune && cd .. && rm -rf cudnn sudo sed -i '59i#define CUDNN_MAJOR 8' /usr/local/cuda/include/cudnn.h diff --git a/scripts/github_actions/install_torch.sh b/scripts/github_actions/install_torch.sh index 3ad1717..ed813c5 100755 --- a/scripts/github_actions/install_torch.sh +++ b/scripts/github_actions/install_torch.sh @@ -78,7 +78,7 @@ case ${torch} in ;; esac ;; - 1.9.0) + 1.9.*) case ${cuda} in 10.2) package="torch==${torch}" @@ -91,6 +91,40 @@ case ${torch} in ;; esac ;; + 1.10.*) + case ${cuda} in + 10.2) + package="torch==${torch}" + # Leave it empty to use PyPI. + url= + ;; + 11.1) + package="torch==${torch}+cu111" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + 11.3) + package="torch==${torch}+cu113" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + esac + ;; + 1.11.*) + case ${cuda} in + 10.2) + package="torch==${torch}" + # Leave it empty to use PyPI. + url= + ;; + 11.3) + package="torch==${torch}+cu113" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + 11.5) + package="torch==${torch}+cu115" + url=https://download.pytorch.org/whl/torch_stable.html + ;; + esac + ;; *) echo "Unsupported PyTorch version: ${torch}" exit 1