Python specify GPU ID

2,567 views
Skip to first unread message

Venkatesh N

unread,
Dec 16, 2014, 7:00:10 PM12/16/14
to caffe...@googlegroups.com

Is there a way we can specify the device id of the GPU in Python interface? 

I tried "net.set_device(0)" and it works seamlessly, but when I set it to use the second GPU "net.set_device(1)" it doesn't work, any help will be appreciated.

Jon

unread,
Feb 15, 2015, 8:39:12 PM2/15/15
to caffe...@googlegroups.com
"set_device(i)"  should be used before "set_mode_gpu()":
    net = Net(...)
    caffe.set_phase_test()
    caffe.set_device(1)
    caffe.set_mode_gpu()

Jon

unread,
Feb 15, 2015, 8:57:33 PM2/15/15
to caffe...@googlegroups.com
Also if you encounter this problem cudnn_conv_layer.cu:30] Check failed: status == CUDNN_STATUS_SUCCESS (8 vs. 0) CUDNN_STATUS_EXECUTION_FAILED,
use the environment variable "CUDA_VISIBLE_DEVICES" instead of "caffe.set_device()". E.g., $ CUDA_VISIBLE_DEVICES=1 python foo.py
Reply all
Reply to author
Forward
0 new messages