From 55210c89e29508285ee81267b410f9d67b9d04b3 Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 7 Jul 2023 18:57:51 +0800 Subject: [PATCH] improve wsl dependencies installation --- finetune/install-wsl-dep-and-train.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/finetune/install-wsl-dep-and-train.sh b/finetune/install-wsl-dep-and-train.sh index 88c4c9b..4bbcda8 100644 --- a/finetune/install-wsl-dep-and-train.sh +++ b/finetune/install-wsl-dep-and-train.sh @@ -8,6 +8,12 @@ if [[ ${cnMirror} == 1 ]]; then fi fi +if dpkg -s "gcc" >/dev/null 2>&1; then + echo "gcc installed" +else + sudo apt -y install gcc +fi + if dpkg -s "python3-pip" >/dev/null 2>&1; then echo "pip installed" else @@ -20,14 +26,14 @@ else sudo apt -y install ninja-build fi -if dpkg -s "cuda" >/dev/null 2>&1; then - echo "cuda installed" +if dpkg -s "cuda" >/dev/null 2>&1 && dpkg -s "cuda" | grep Version | awk '{print $2}' | grep -q "12"; then + echo "cuda 12 installed" else - wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin + wget -N https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 - wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb - sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb - sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/ + wget -N https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb + sudo dpkg -i cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb + sudo cp /var/cuda-repo-wsl-ubuntu-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda fi