Reputation: 9
I am trying to get gpu support on my container without the nvidia-docker
I know with the nvidia docker, I just have to use --runtime=nvidia but my current circumstances does not allow using nvidia-docker
I tried installing the nvidia driver, cuda, cudnn on my container but it fails.
How can I use tensorflow gpu without nvidia docker on my container?
Upvotes: 0
Views: 3156
Reputation: 562
You'll be happy to know that the latest Docker version now comes with support for nvidia GPU's. You'll need to use --device flag to specify your Nvidia driver. See - How to use GPU a docker container
Earlier, you had to install nvidia-docker which was plain docker with a thin layer of abstraction for nvidia GPU's. See - Nvidia Docker
Upvotes: 1
Reputation: 845
If you can't pass --runtime=nvidia
as a command-line option (eg docker-compose
), you can set the default runtime in the Docker daemon config file /etc/docker/daemon.json
:
{
"default-runtime": "nvidia"
}
Upvotes: 0
Reputation: 562
You cannot simply install nvidia drivers in a docker container. The container must have access to the hardware. Though I'm not certain, but mounts might help you with that issue. See- https://docs.docker.com/storage/
You can use anaconda to install and use Tensorflow-gpu.
Make sure you have the latest nvidia drivers installed. Install Anaconda 2 or 3 from the official site. https://www.anaconda.com/distribution/
Create a new environment and install tensorflow-gpu and cudatoolkit.
$conda create -n tf-gpu tensorflow-gpu python cudnn cudatoolkit
You can also specify the version of application.
E.g $conda create -n tf-gpu tensorflow-gpu python=3.5 cudnn cudatoolkit=8
Please do check if your hardware has the minimum compute capability to support the version of CUDA that you are/will be using.
Upvotes: 0