👉 The corresponding versions between TF and Cuda.

# check if GPU available?
import tensorflow as tf

# prevent tf uses gpu
# add below before any tf import
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"

Installation with docker

👉 Official guide. 👉 Note: Docker & GPU .

The advantage of this method is that you only have to install GPU driver on the host machine.

Without docker-compose

👉 Different types of images for tensorflow.

# pull the image
docker pull tensorflow/tensorflow:latest-gpu-jupyter

# run a container
mkdir ~/Downloads/test/notebooks
docker run --name docker_thi_test -it --rm -v $(realpath ~/Downloads/test/notebooks):/tf/notebooks -p 8888:8888 tensorflow/tensorflow:latest-gpu-jupyter
# check if gpu available?

# check if tf2 working?
docker exec -it docker_thi_test bash
import tensorflow as tf

With docker-compose?

👉 Read Docker & GPU instead.

On Windows WSL2

Update later…

Install directly on Linux (without docker)

On my computer, Dell XPS 15 7590 - NVIDIA® GeForce® GTX 1650 Mobile.

<aside> 🚨 This section is not complete, the guide is still not working!