I wanted to try the upcoming version of tensorflow 2.5
But the challenge is to try it on my wsl2 machine on top on windows.
Here is the recipe !
This Nvidia documentation is to follow along, i just updated the parts for my specific install:
Unfortunately this is only available with windows insider
I recommend having a safe windows environnement to play with, i don’t recommend using this in a work or personal computer for instance, as it can be broken sometimes.
Use the DEV channel.
After installing and done a few updates, you should be on a version 20145+ (recommended 21332+)
after installation type WIN+R and type this command to check your windows version
Next you have to install wsl2
Install WSL on Windows 10
There are two options available for installing Windows Subsystem for Linux (WSL): Simplified install (preview release)…
wsl — install
You have to make sure that you have the right version of the linux kernel
You may have to change your preferences in advanced option of windows updates and check
receive updates of other Microsoft products
After updating your system you should have an update on this specific item
“Windows Subsystem for Linux Update — 5.10.16”
I recommend uninstall / install a new distro installation to make sure you have the right version
# install ubuntu 18.04 version
wsl — install -d Ubuntu-18.04#launch wsl
Then inside Ubuntu check your kernel version
# return 184.108.40.206-microsoft-standard-WSL2
First you have to update for nvidia driver from WINDOWS.
Do not install nvidia driver inside wsl !
Here is a guide:
GPU in Windows Subsystem for Linux (WSL)
CUDA on Windows Subsystem for Linux (WSL) - Public Preview Microsoft Windows is a ubiquitous platform for enterprise…
Install it according to your product.
CUDA on WSL2
You should install a specific version of cuda, the cuda toolkit with the right version
Build from source | TensorFlow
Build a TensorFlow pip package from source and install it on Ubuntu Linux and macOS. While the instructions might work…
The version 2.5 is in release candidate so no information on this page yet.
Release TensorFlow 2.5.0-rc1 · tensorflow/tensorflow
Support for Python3.9 has been added. TPU embedding support Added profile_data_directory to EmbeddingConfigSpec in…
TensorFlow pip packages are now built with CUDA11.2 and cuDNN 8.1.0
Inside WSL install CUDA Toolkit
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pubsudo sh -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'sudo apt-get updatesudo apt-get install -y cuda-toolkit-11–2cd /usr/local/cuda-11.2/samples/4_Finance/BlackScholes
## result shoud be Test passed
CUDNN on WSL2
Next we need to install manually cudnn
I choose “Download cuDNN v8.1.0 (January 26th, 2021), for CUDA 11.0,11.1 and 11.2” , here are the 2 links to download on windows:
Download, copy the files to you home inside wsl, install them in this order
cp /mnt/c/Users/<username>/Downloads/libcudnn8* .sudo dpkg -i libcudnn8_220.127.116.11–1+cuda11.2_amd64.deb
sudo dpkg -i libcudnn8-dev_18.104.22.168–1+cuda11.2_amd64.deb
TensorRT is optionnal, here is the install procedure
Installation Guide :: NVIDIA Deep Learning TensorRT Documentation
This TensorRT 7.2.3 Installation Guide provides the installation requirements, a list of what is included in the…
sudo sh -c 'echo “deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /” > /etc/apt/sources.list.d/nvidia-machine-learning.list'sudo apt-get updatesudo apt-get install -y — no-install-recommends libnvinfer7=7.1.3–1+cuda11.0 \
I recommend using miniconda for creating specific python virtual env,
conda activate tf25
pip3 install tensorflow-gpu==2.5.0-rc1
Check that the gpu is detected by tensorflow
import tensorflow as tf
physical_devices = tf.config.list_physical_devices('GPU')
print(“Num GPUs:”, len(physical_devices))
#Num GPUs: 1