GPU?

👉 The corresponding versions between TF and Cuda.

# check if GPU available?
import tensorflow as tf
tf.config.list_physical_devices('GPU')

# 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?
nvidia-smi

# check if tf2 working?
docker exec -it docker_thi_test bash
python
import tensorflow as tf
tf.config.list_physical_devices('GPU')

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!

</aside>

Installation