Cuda availability returns true but run-time error when trying to move data to GPU

Hello,

I have a fresh installation of cuda 8.0 and pytorch. I ran the following simple code:
import torch
a = torch.rand(4)
a.cuda()

When I try to use the GPU from pytorch I get the error:

THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1524577177097/work/aten/src/THC/THCTensorRandom.cu line=25 error=30 : unknown error
Traceback (most recent call last):
File “”, line 1, in
RuntimeError: cuda runtime error (30) : unknown error at /opt/conda/conda-bld/pytorch_1524577177097/work/aten/src/THC/THCTensorRandom.cu:25

Upon installation I checked whether cuda installation is successful using deviceQuery test and I got a PASS. torch.cuda.is_available() returnsTrue.
nvidia-smi returns:
±----------------------------------------------------------------------------+
| NVIDIA-SMI 390.48 Driver Version: 390.48 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX TIT… Off | 00000000:03:00.0 On | N/A |
| 22% 41C P8 16W / 250W | 423MiB / 12211MiB | 1% Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1458 G /usr/bin/X 120MiB |
| 0 2974 G compiz 44MiB |
| 0 3691 C python 242MiB |
±----------------------------------------------------------------------------+

nvcc -V returns

nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61

Can someone point out what is potentially wrong with my system? I tried reinstalling both Cuda and pytorch multiple times and restarting. Thanks!

2 Likes

Hi! Have you solved the problem? I met the same mistake and failed to solve it after various attempts. Could you help? Thanks very much.

I couldn’t troubleshoot the problem. I ended up formatting my computer.