OpenCV Error: Gpu API call (invalid device ordinal) in allocate when running on AWS GPU Instance

asked 2015-06-06 04:21:29 -0600

abhiguru gravatar image

Trying to run gpu-example-video_reader example on and AWS GPU instance Quad GPU running Ubuntu server 14.04, OpenCV 3.0, CUDA 7.0. I get the following message

ubuntu@ip-10-51-184-206:~/cv/build/bin$ ./gpu-example-video_reader def.mp4 
libdc1394 error: Failed to initialize libdc1394
init done 
opengl support available 
OpenCV Error: Gpu API call (invalid device ordinal) in allocate, file /home/ubuntu/cv/modules/core/src/cuda/gpu_mat.cu, line 76
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/ubuntu/cv/modules/core/src/cuda/gpu_mat.cu:76: error: (-217) invalid device ordinal in function allocate

The example works fine on my local machine. Any suggestions ?

edit retag flag offensive close merge delete

Comments

I am guessing that the AWS system has multiple GPU instances compared to your system locally. So you need to specify and select the device like explained in this SO topic.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-07 04:07:23 -0600 )edit

I am seem to be having issues with the setGlDevice instead of setDevice. I think it might be somehow related to the fact that I am running the code on a Ubuntu server edition and trying to view the GL display window over X11 on my ubuntu desktop. any other suggestions welcome.

abhiguru gravatar imageabhiguru ( 2015-06-09 15:50:45 -0600 )edit

As far as my experience goes, piping OpenCV output through X11 has caused problems before. I have seen problems with that. How about not piping anything. Does your code work then?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-10 04:02:23 -0600 )edit