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
xhostbyxhost +xif 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 upwhich will read all the content ofdocker-compose.ymlfile - At the moment we are using
nvidia-dockerwhich has anvidia-docker-composelibrary, but it is not updated tonvidia-docker version–> 2.0.3 - If you try to run
docker-composeon annvidia-dockerproject, you will get an error.import tensorflow as tfwont work
- use
Issues #
- have to use the alias
tfto launch to keep the command line typing to a min- eventually, this can be run using
nvidia-docker-composefor this version ofnvidia-dockeris supported
- eventually, this can be run using