Peter
Peter

Reputation: 383

Does tensorflow image in docker use GPU?

I have question whether my docker uses GPU.

My desktop has GeForce 2060 super and Ryzen 5 3600.

I implemented CNN with tensorflow. The each image has from 20 to 50 kB.

When I use only CPU, each epoch spend 23 seconds (around 95ms/step). On the other hand, when I use tensorflor-gpu-jupyter image in docker, each epoch spend 21 seconds (around 83ms/step). My docker command is following.

docker run --gpus all --rm -p 8888:8888 -v $PWD/CNN:/tf/notebooks tensorflow/tensorflow:latest-gpu-jupyter

I heard that GPU accelerate it 5 to 10 times faster, but for me didn't.

Does my docker use GPU?

FYR. I checked nvidia working with following command.

docker run --gpus all --rm nvidia/cuda nvidia-smi

Upvotes: 2

Views: 854

Answers (1)

Marc Sances
Marc Sances

Reputation: 2614

Official TensorFlow images for Docker are GPU enabled, if the host system is properly configured (source). You should pull the images with the -gpu tag.

Easiest way to check: use nvtop or nvidia-smi -l 10 to check for GPU usage in the host system.

Notice that for enabling GPU support, you should have installed the NVIDIA Container Toolkit.

Upvotes: 2

Related Questions