aladin
aladin

Reputation: 41

How to install CUDA 11.2 and cuDNN 8.1 on WSL2 for TensorFLow 2?

I am very much struggling to get NVIDIA's CUDA 11.2 and cuDNN 8.1 for TensorFlow 2 on my WSL2 machine.

Can anybody give me the commands to get CUDA 11.2 and cuDNN 8.1 on my WSL2 machine so that I can finally get back to coding in TensorFlow 2? I am thinking about something like this :

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

My specs :

Upvotes: 3

Views: 9511

Answers (3)

Sriram Munagala
Sriram Munagala

Reputation: 11

You could check out Nvidia's download installer for WSL-Ubuntu from its download archives.

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.2.0/local_installers/cuda-repo-wsl-ubuntu-11-2-local_11.2.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-2-local_11.2.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

Upvotes: 1

Sukram
Sukram

Reputation: 381

Here is how I did it:

Follow the instructions from NVIDIA's CUDA Toolkit Downloads page to setup their package repository with the versions specifically for WSL2

> wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
> sudo dpkg -i cuda-keyring_1.1-1_all.deb
> sudo apt-get update

And now the fun part, since the repo contains all previous CUDA versions too:

> sudo apt install cuda-toolkit-11-7

I hope this helps some fellow traveler ^^

Upvotes: -1

Jirayu Kaewprateep
Jirayu Kaewprateep

Reputation: 766

I just read your question please follow.

  1. Do you installed compatible Cuda versions with your target GPU device? Example: I use CuDa 11.6 and for the NVIDIA GeForce RTX 3070 Laptop GPU, 5120 compatible since 8.6, read from CuDA Nvidia GPU developer
  2. Install Tensorflow then Tensorflow GPU, if it still does not recover your GPU you need to build it on your machine that is not a complex task but finding one existing on websites is a more convenient way Test build configuration
  3. If you try to build it on Linux you need to install a compatibility version of Cuda and CuDNN Compatibility Matrix
  4. Last I read this question multiple of times, you still can download target versions of CuDA archived CuDA and CuDNN archive link

That is because they question then screenshot added see TF2.11 and WSL2.0 related to my answers

Sample

Upvotes: -4

Related Questions