[resolved] Cuda Runtime Error(30)

Same here. ubuntu 16.04 cuda9, pytorch 0.2

Have anyone solved this problem? Thanks.

This also happens on my system

  • Ubuntu 16.04
  • Nvidia GeForce 940MX
  • PyTorch 0.3.1 running on Python 3.6
  • Cuda 8.0
  • CUDNN 7

Any clues? I don’t see why this thread is marked as resolved, if the solution is to restart the laptop every time.

1 Like

Same problem for me too

Ubuntu 16.04 running on Dell desktop
Nvidia GeForce 1050ti
PyTorch 0.3.1.post2 running on Python 3.6
Cuda 9.1
CUDNN 7.1

Run into the same problem

Ubuntu 16.04
TitanXp
Cuda 9.1
pytorch 0.3.1 running python 2.7

reboot fixes the problem.

1 Like

Same problem some strange stuff after wake up (desktop ubuntu 16.04 cuda 8 1080 gtx)

maybe use sudo can solve this problem.
i reinstall my driver and cuda after my linux system updated, and same problem happened

Same problem here. After laptop goes to sleep and wake up, I get this error after calling torch.cuda.current_device():

RuntimeError: cuda runtime error (30) : unknown error at 
/opt/conda/conda-bld/pytorch_1524590031827/work/aten/src/THC/THCGeneral.cpp:70

Ubuntu 18.04, Pytorch 0.4.1, cuda 9.2

2 Likes

I have hp-1000 laptop without GPU. Now how it is possible to handle this error.
"THCudaCheck FAIL file=torch/csrc/cuda/Module.cpp line=32 error=30 : unknown error
Traceback (most recent call last): File “train_nli.py”, line 62, in
torch.cuda.set_device(params.gpu_id)
File “/home/farhatullah/anaconda3/lib/python3.6/site-packages/torch/cuda/init.py”, line 262, in set_device torch._C._cuda_setDevice(device)
RuntimeError: cuda runtime error (30) : unknown error at torch/csrc/cuda/Module.cpp:32
"
actually I am training InferSent sentence embedding model. There is any availability of https://github.com/facebookresearch/InferSent/blob/master/train_nli.py this code for CPU??

The solution can be found here. Basically, run the following commands in the terminal:

sudo rmmod nvidia_uvm
sudo rmmod nvidia
sudo modprobe nvidia
sudo modprobe nvidia_uvm
4 Likes

Go to NVIDIA Nsight Options and set ‘Enable Crash Detection And Handling = True’.

Did the trick for me.

This always works for me (Win10, Cuda 10.1, Python 3.7.2, PyTorch 1.0.1, NVIDIA GTX 1050 Ti):

import torch
torch.cuda.current_device()

but this always fails for me:

import torch
torch.cuda.is_available()
torch.cuda.current_device()  # fails here

@Mohamed_Ghadban, how can I access the NVIDIA Nsight Options? Thanks in advance :slight_smile:

Win10, NVIDIA GTX 1050 Ti, Cuda toolkit 9.2, Python 3.6, Torch 1.0.1
RuntimeError (cuda runtime error (30) ) for the Cuda driver version 10.1 (419.67). I reinstalled an old NVIDIA driver 397.93 (i.e. Cuda driver verison 9.2). OK!. Tried twice.

Same problem here with Win10, NVIDIA GTX 1050 Ti, Cuda 10.0, Python 3.6, Torch 1.1.0

~\Anaconda3\lib\site-packages\torch\cuda\__init__.py in _lazy_init()
    161             "Cannot re-initialize CUDA in forked subprocess. " + msg)
    162     _check_driver()
--> 163     torch._C._cuda_init()
    164     _cudart = _load_cudart()
    165     _cudart.cudaGetErrorName.restype = ctypes.c_char_p

RuntimeError: CUDA error: unknown error

Can someone help me fix this. I’m stuck with this issue for a while.

Are you using multiprocessing and try to initialize the CUDA context multiple times?
Could you post a small code snippet to reproduce this issue?

Hi @ptrblck
Thanks for the response.
I’m trying to follow along this notebook from Udacity’s github repository and I’m getting the error on the code cell 19.
https://github.com/udacity/deep-learning-v2-pytorch/blob/master/sentiment-rnn/Sentiment_RNN_Solution.ipynb

Ubuntu 16.04.6
Cuda 10.1
Driver Version: 418.87.00
Pytorch 1.1.0
Python 3.6

Updated driver to listed version and got following:

RuntimeError: cuda runtime error (30) : unknown error at /pytorch/aten/src/THC/THCGeneral.cpp:51

Resolved after reboot.

Yeah, same thing was happened to me. So i think after reboot your PC the problem will solved.

The same here. The error and the location of error occur in the file are all the same.