Getting Nvidia GPU to work on Ubuntu
THIS IS THE MOST IMPORTANT ARTICLE TO READ! - https://devblogs.nvidia.com/gpu-containers-runtime/
The basics of Dockers #
docker images
- the actual file for the container, this shows all the images that have been downloadeddocker containers
- the instance of the imagesdocker ps -a
- list all the containers, even the ones that are stoppeddocker start <container-name>
- will start a stopped containerdocker stop <container-name>
- will stop a running container- the
--rm
- argument will destroy the container as soon as it is stopped
Docker compose #
docker-compose up
- spin up a docker container usingdocker-compose.yml
Installing #
- https://www.tensorflow.org/install/install%5Flinux – starting point
- setting up nvidia to work with docker-compose
- https://devblogs.nvidia.com/gpu-containers-runtime/
- something about disabling
xhost
byxhost +x
if cannot open display?
Executing nvidia-docker #
-
remember to
workon tensorflow
–> this will activate the python virtualenv for us to use Tensorflow -
running docker in the background
nvidia-docker run -d -it -p -v .:/notebooks 8888:8888 tensorflow/tensorflow:latest-gpu
- this will run docker detached, and mount the current working
directory to
/notebooks
- this will run docker detached, and mount the current working
directory to
-
faster execution of dockers
- use
docker-compose up
which will read all the content ofdocker-compose.yml
file - At the moment we are using
nvidia-docker
which has anvidia-docker-compose
library, but it is not updated tonvidia-docker version
–> 2.0.3 - If you try to run
docker-compose
on annvidia-docker
project, you will get an error.import tensorflow as tf
wont work
- use
Issues #
- have to use the alias
tf
to launch to keep the command line typing to a min- eventually, this can be run using
nvidia-docker-compose
for this version ofnvidia-docker
is supported
- eventually, this can be run using