0
chainer.cuda.available

chainer.cuda.cudnn_enabled

两者都返回“真”。

但是当我尝试

    cuda.to_gpu(data, 1)

它给出了以下错误 -

CUDARuntimeError                          Traceback (most recent call last)
<ipython-input-3-87cf96844cac> in <module>()
----> 1 cuda.to_gpu(data, 1)

/home/shreez/anaconda3/lib/python3.5/site-packages/chainer/cuda.py in to_gpu(array, device, stream)
192     check_cuda_available()
193     assert stream is None  # TODO(beam2d): FIX IT
--> 194     with get_device(device):
195         dev_id = int(get_device(array))
196         if dev_id != -1 and dev_id != cupy.cuda.device.get_device_id():

cupy/cuda/device.pyx in cupy.cuda.device.Device.__enter__ (cupy/cuda/device.cpp:1503)()

cupy/cuda/device.pyx in cupy.cuda.device.Device.use (cupy/cuda/device.cpp:1753)()

cupy/cuda/runtime.pyx in cupy.cuda.runtime.setDevice (cupy/cuda/runtime.cpp:2428)()

cupy/cuda/runtime.pyx in cupy.cuda.runtime.check_status (cupy/cuda/runtime.cpp:1821)()

CUDARuntimeError: cudaErrorInvalidDevice: invalid device ordinal

系统信息:

我正在使用带有 Ubuntu 14.04 的 nvidia 驱动程序版本 364.19。Chainer 与 Anaconda 3 一起安装,chainer 版本 = 1.8.2

nvcc --version 返回以下内容:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
4

1 回答 1

2

错误发生在我使用 gpu 1 而不是 0 时。更改

cuda.to_gpu(data, 1)

cuda.to_gpu(data, 0)

解决了这个问题。

于 2016-07-14T03:53:59.830 回答