3

I'm trying to run this simple line of code in a docker container that comes with Pytorch.

import torch
torch.cuda.set_device(0)

I get this error:

RuntimeError: cuda runtime error (35) : CUDA driver version is insufficient for CUDA runtime version at torch/csrc/cuda/Module.cpp:32

Running torch.cuda.is_available() returns False.

The host machine has the most up-to-date Nvidia drivers. Pytorch ships with Cuda, so there should be no incompatibility issues.

What could cause this problem?

Edit: @Patel Sunil's answer to this question answers my question, but I didn't come across this question in my search because their question is broad, while my question is specific to the cuda runtime/driver error. I posted this as a separate question for those who come across this error but don't know what it is a symptom of (namely, forgetting to use nvidia-docker).

Jacob Stern
  • 3,758
  • 3
  • 32
  • 54
  • I'm happy that you found a solution to your problem! But isn't this a [duplicate of this question](https://stackoverflow.com/q/25185405/7968757)? Well, `nvidia-docker` is only the last answer. Probably mainly because the answer was written way after the question was asked. – BlameTheBits Apr 11 '19 at 21:59
  • Edited my post to clarify - thanks! – Jacob Stern Apr 12 '19 at 12:13

1 Answers1

2

The problem was that I was running the container with docker, not nvidia-docker. Running the docker container with nvidia-docker fixed the problem.

Jacob Stern
  • 3,758
  • 3
  • 32
  • 54