[resolved] <tensor>.cuda() hangs

Pushing tensors to the gpu hangs. For example:

import torch

a = torch.zeros(10)
a.cuda()  # hangs indefinitely 

I have tried reinstalling CUDA 8.0 and CUDNN 5.1 but this has not resolved the issue.
Some quick specs that may be handy:
os: Ubuntu 16.04
python distro: python 2.7 (conda)
gpu: nvidia gtx 1080ti
nvidia driver: 375

here is the resulting traceback from a keyboard interrupt (to stop the hanging):

KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-6-504fb99d952c> in <module>()
----> 1 a.cuda()

/home/jkarimi91/Apps/anaconda2/envs/torch/lib/python2.7/site-packages/torch/_utils.pyc in _cuda(self, device, async)
     64         else:
     65             new_type = getattr(torch.cuda, self.__class__.__name__)
---> 66             return new_type(self.size()).copy_(self, async)
     67 
     68 

/home/jkarimi91/Apps/anaconda2/envs/torch/lib/python2.7/site-packages/torch/cuda/__init__.pyc in _lazy_new(cls, *args, **kwargs)
    267     # We need this method only for lazy init, so we can remove it
    268     del _CudaBase.__new__
--> 269     return super(_CudaBase, cls).__new__(cls, *args, **kwargs)
    270 
    271 

Turned out I did not have cuda80 installed in my conda env. I must have accidentally deleted it or installed pytorch for cuda 7.5 originally.

1 Like