CUDA Runtime Error 30

I’m receiving the same error as in this post except the specified solution (rebooting) isn’t resolving the issue in my case.

To diagnose the issue I followed the directions here to see if Pytorch is using the GPU at all and received the error again at the below code:

Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True
>>> torch.cuda.device_count()
4
>>> torch.cuda.device(0)
<torch.cuda.device object at 0x7f49ef3623c8>
>>> torch.cuda.get_device_name(0)
THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1524584710464/work/aten/src/THC/THCTensorRandom.cu line=25 error=30 : unknown error
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/philippe/miniconda3/envs/cv-dl/lib/python3.6/site-packages/torch/cuda/__init__.py", line 272, in get_device_name
    return get_device_properties(device).name
  File "/home/philippe/miniconda3/envs/cv-dl/lib/python3.6/site-packages/torch/cuda/__init__.py", line 290, in get_device_properties
    init()  # will define _get_device_properties and _CudaDeviceProperties
  File "/home/philippe/miniconda3/envs/cv-dl/lib/python3.6/site-packages/torch/cuda/__init__.py", line 143, in init
    _lazy_init()
  File "/home/philippe/miniconda3/envs/cv-dl/lib/python3.6/site-packages/torch/cuda/__init__.py", line 161, in _lazy_init
    torch._C._cuda_init()
RuntimeError: cuda runtime error (30) : unknown error at /opt/conda/conda-bld/pytorch_1524584710464/work/aten/src/THC/THCTensorRandom.cu:25
>>> torch.cuda.current_device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/philippe/miniconda3/envs/cv-dl/lib/python3.6/site-packages/torch/cuda/__init__.py", line 332, in current_device
    _lazy_init()
  File "/home/philippe/miniconda3/envs/cv-dl/lib/python3.6/site-packages/torch/cuda/__init__.py", line 161, in _lazy_init
    torch._C._cuda_init()
RuntimeError: cuda runtime error (30) : unknown error at /opt/conda/conda-bld/pytorch_1524584710464/work/aten/src/THC/THCGeneral.cpp:844
>>>

I’ve tried rebooting, uninstalling and reinstalling CUDA 8 and the corresponding drivers, uninstalling and reinstalling torch, and verifying that my torch version for built for CUDA 8 but nothing seems to resolve the issue.

Hi,

Can you properly run the CUDA 8 samples that come with the cuda install? Your GPU crash during the cuda initialization itself.

I had a similar issue today on Ubuntu Server 14.04, and I think it’s maybe related to the user’s permission.I solved this problem by add sudo when I running python.

sudo ~/anaconda3/bin/python

Maybe you have no cudnn.Remeber to install the right Version!
Secondly,the version of CUDA may be different from the one needed by pytorch.
I got the same Error, now it goes right. I have no cudnn before.
Good luck!

I am still experiencing this error on my laptop. Rebooting solves it, but I don’t want to reboot every time this error comes up, which is a lot.

Hi,I have the same problem.
I have cudnn of the right version,and I can run the cuda 10.1 samples properly.
but when I run
‘’‘torch.cuda.current_device()
‘’’
it will be wrong.
I am really confused now.

Have you solved this problem? I ran into the same problem…