ScaViSLAM icon indicating copy to clipboard operation
ScaViSLAM copied to clipboard

OpenCV Error: Gpu Api call (invalid device function)

Open svebk opened this issue 12 years ago • 4 comments

Hi, I have an issue when launching stereo_slam. I have the following Gpu Api call error whenever I click the "next" or "play" button:

$ ./stereo_slam ../data/newcollege.cfg Multiprocessors: 4 Filegrabber initializing.... Filegrabber initialized. OpenCV Error: Gpu Api call (invalid device function ) in call, file ScaViSLAM/EXTERNAL/opencv2/modules/gpu/src/opencv2/gpu/device/detail/transform.hpp, line 326 terminate called after throwing an instance of 'cv::Exception' what(): ScaViSLAM/EXTERNAL/opencv2/modules/gpu/src/opencv2/gpu/device/detail/transform.hpp:326: error: (-217) invalid device function in function call Aborted

However, the opencv_test_gpu runs fine. Has anyone encountered the same issue or have an idea of how to solve it?

Cheers

svebk avatar Mar 19 '12 11:03 svebk

I actually get the same error on my laptop.

My guess is: ScaViSLAM might not work with GPUs which do not support Compute capability 2.0 or higher. My laptop GPU only support 1.1. Could you double check the compute capability of your GPU?

(If I am right, of course it would be nice to patch ScaViSLAM so it works with older GPUs too!)

strasdat avatar Mar 19 '12 20:03 strasdat

Hi, My graphic card is a Quadro FX-580, which (according to NVIDIA website: http://developer.nvidia.com/cuda-gpus) only supports Compute Capability 1.1. So this confirms your guess. Do you think patching ScaViSLAM to make it works with older GPUs too is difficult?

svebk avatar Mar 20 '12 10:03 svebk

I am also getting this on a GeForce GT 220 (Compute Capability 1.2). At first I thought it was my OpenCV w/ CUDA installation. This link (http://tech.groups.yahoo.com/group/OpenCV/message/86385) talks about the CUDA_ARCH_PTX compile option, so I ended up changing it to 1.2 (from 2.0). Unfortunately, it still did not work.

I did notice one interesting thing. For me, I first get this message because of the frame_data.cur_left().gpu_uint8.convertTo(frame_data.cur_left().gpu_pyr_float32[0], CV_32F,1./255.); call in preprocessing (in frame_grabber.cpp). Somehow, it gets through this twice during initialization, but doesn't crash until it's getting called (indirectly) in the main loop, which I find very odd.

As for work-arounds, since I don't know much about CUDA and don't want to touch the OpenCV stuff, one thing that came to mind was doing the conversion as a uint8 (like normal with CPU) and then maybe filling in the gpu_uint8 afterwards, meaning that we'd loose some speed on the pre-processing step. I don't know how feasible this is yet (I have to look into the gpu version of cv::Mat), but I might get around to trying it. My only worry is that this is only the tip of the iceberg and, if we fix this issue, something similar would pop up in other GPU-based function calls.

StanislawAntol avatar Jul 27 '12 13:07 StanislawAntol

Cards with Compute capability above 2.0 have more than 1000 CUDA cores. As far as I know ScaviSLAM does not require these many cores. It would be a waste to buy an expensive card such as Geforce TITAN just to run ScaviSlam.

When running I get 14 microprocesors used, then it crashes. What does this exactly mean? It works fine with CUDA off.

Any advice on which part of the code must be modified, will be really helpful.

Thank you

aswinthomas avatar May 15 '13 03:05 aswinthomas