我对安装了 NVIDIA GPU 和 CUDA 7.5 的机器具有非 sudo 访问权限。我安装了支持 CUDA 7.5 的 PyTorch,这似乎奏效了:
>>> import torch
>>> torch.cuda.is_available()
True
为了得到一些练习,我遵循了使用 RNN 进行机器翻译的教程。当我设置USE_CUDA = False
并使用 CPU 时,一切正常。但是,当想要使用 GPU 时,USE_CUDA = True
会出现以下错误:
Traceback (most recent call last):
...
File "seq2seq.py", line 229, in train
encoder_output, encoder_hidden = encoder(input_variable[ei], encoder_hidden)
File "/.../python2.7/site-packages/torch/nn/modules/module.py", line 206, in __call__
result = self.forward(*input, **kwargs)
File "seq2seq.py", line 144, in forward
output, hidden = self.gru(embedded, hidden)
File "/.../python2.7/site-packages/torch/nn/modules/module.py", line 206, in __call__
result = self.forward(*input, **kwargs)
File "/.../python2.7/site-packages/torch/nn/modules/rnn.py", line 91, in forward
output, hidden = func(input, self.all_weights, hx)
...
File "/.../python2.7/site-packages/torch/backends/cudnn/rnn.py", line 42, in init_rnn_descriptor
cudnn.DropoutDescriptor(handle, dropout_p, fn.dropout_seed)
File "/usr/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: cudnnCreateDropoutDescriptor
Exception AttributeError: 'python: undefined symbol: cudnnDestroyDropoutDescriptor' in <bound method DropoutDescriptor.__del__ of <torch.backends.cudnn.DropoutDescriptor object at 0x7fe540efec10>> ignored
我尝试使用 Google 搜索该错误,但没有得到有意义的结果。由于我是 PyTorch 和 CUDA 的新手,我不知道如何从这里继续。完整设置是 Ubuntu 14.04、Python 2.7、CUDA 7.5。