Notifications
Clear all
BugOverflow
3
Posty
1
Users
0
Reactions
705
Widok
0
05/06/2024 10:05 am
Topic starter
how to install cuda and ai tools for ubuntu wsl?
3 Answers
0
05/06/2024 10:06 am
Topic starter
one of many solutions, below is the working version as of 05/06/2024
wget 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/12.1.0/local_installers/cuda-repo-wsl-ubuntu-12-1-local_12.1.0-1_amd64.deb sudo dpkg -i cuda-repo-wsl-ubuntu-12-1-local_12.1.0-1_amd64.deb sudo cp /var/cuda-repo-wsl-ubuntu-12-1-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda sudo apt-get -y install nvidia-cuda-toolkit sudo add-apt-repository ppa:graphics-drivers/ppa wget https://developer.download.nvidia.com/compute/cudnn/9.1.1/local_installers/cudnn-local-repo-ubuntu2204-9.1.1_1.0-1_amd64.deb sudo dpkg -i cudnn-local-repo-ubuntu2204-9.1.1_1.0-1_amd64.deb sudo cp /var/cudnn-local-repo-ubuntu2204-9.1.1/cudnn-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cudnn-cuda-12 pip install --upgrade pip pip install tensorflow[and-cuda] sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get -y install python3.9-venv sudo apt-get -y install python3-pip pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 apt-get -y install python-is-python3 apt-get -y install python3-tk python -m pip install tensorflow[and-cuda]
This post was modified 7 miesięcy temu 2 times by mrmucha
0
05/06/2024 1:35 pm
Topic starter
another solution
sudo add-apt-repository ppa:graphics-drivers/ppa wget 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.8.0/local_installers/cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb sudo dpkg -i cuda-repo-wsl-ubuntu-11-8-local_11.8.0-1_amd64.deb sudo cp /var/cuda-repo-wsl-ubuntu-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda apt install nvidia-cuda-toolkit apt-get -y install python-is-python3 apt-get -y install python3-tk python3-pip apt-get -y install x11-apps
0
05/06/2024 2:03 pm
Topic starter
this could fix GPU detection by tensorflow
# Store original LD_LIBRARY_PATH export ORIGINAL_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" # Get the CUDNN directory CUDNN_DIR=$(dirname $(dirname $(python -c "import nvidia.cudnn; print(nvidia.cudnn.__file__)"))) # Set LD_LIBRARY_PATH to include CUDNN directory export LD_LIBRARY_PATH=$(find ${CUDNN_DIR}/*/lib/ -type d -printf "%p:")${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} # Get the ptxas directory PTXAS_DIR=$(dirname $(dirname $(python -c "import nvidia.cuda_nvcc; print(nvidia.cuda_nvcc.__file__)"))) # Set PATH to include the directory containing ptxas export PATH=$(find ${PTXAS_DIR}/*/bin/ -type d -printf "%p:")${PATH:+:${PATH}}