Cannot get Cuda to work

264 views
Skip to first unread message

Shreekant Gayaka

unread,
Jul 13, 2016, 6:25:18 AM7/13/16
to Chainer User Group
I cannot seem to get the Cuda to work with Chainer. I get the following error:

---------------------------------------------------------------------------
CUDARuntimeError                          Traceback (most recent call last)
<ipython-input-2-9926154164f8> in <module>()
----> 1 x1 = Variable(cuda.to_gpu(x1_data, 1))
      2 x2 = Variable(cuda.to_gpu(x2_data, 2))

/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



My system details: Ubuntu 14.04 + chainer 1.8.2 + anaconda3 + cuda 7.5 + cudnn v4

I have no issues using Cuda with Caffe.


Shreekant Gayaka

unread,
Jul 14, 2016, 3:52:05 AM7/14/16
to Chainer User Group
Ok, I needed to specify gpu 0 instead of 1. cuda.to_gpu(data, 0) works as expected
Reply all
Reply to author
Forward
0 new messages