Ask Your Question
0

OpenCV Error: Gpu Api Call <invalid device function>

asked Sep 16 '13

Compvis gravatar image

hi, I build OpenCV 2.4.9 from source with Visual Studio 2012 + Cuda 5.5 + Cmake 2.8 on Windows 7 32bit. My computer with Gigabyte Gefore 9800 GTX+ (Compute capability = 1.1).

If i set CUDA_ARCH_BIN = 2.0 2.1 3.0 3.5, the OpenCV build is OK. I run the sample bgfg_segm of cuda, it raises an error: "OpenCV Error: Gpu Api Call <invalid device="" function="">, file .../gpubgsegm/src/cuda/mog.cu. line 328"

But if i set CUDA_ARCH_BIN = 1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5, the OpenCV build will raises an error:__longlong_as_double" is undefined....

Could you pls tell me how to build OpenCV 2.4.9 from source with VS2012 + Cuda 5.5 + CMake 2.8 to run the samples with my card above.

Thanks,

Preview: (hide)

Comments

Check out this solution, which succesfully compiles the 2.4.9 branch with cuda 5.5 and VS2012.

StevenPuttemans gravatar imageStevenPuttemans (Sep 17 '13)edit

My card (Gigabyte Gefore 9800 GTX+) does not support Compute Capability 3.0 (CUDA_ARCH_BIN = 3.0) like him, only 1.1 so i am still not successful.

Compvis gravatar imageCompvis (Sep 17 '13)edit

Will that actually work? I got compute capability 2.1 and that works with 5.5. Why not try to use CUDA 5.0 first and see if that goes?

StevenPuttemans gravatar imageStevenPuttemans (Sep 17 '13)edit

1 answer

Sort by » oldest newest most voted
1

answered Sep 18 '13

Vladislav Vinogradov gravatar image

The bug was fixed in master branch: https://github.com/Itseez/opencv/pull/1465

Please, update your repository and rebuild OpenCV.

Preview: (hide)

Comments

I have faced the same problem with the same card ( Visual Studio 2012 + Cuda 5.5 + Cmake 2.8 on Windows 7 32bit), Opencv 3.0. A lots of errors like below:

5>cuda_compile_generated_gpu_mat.cu.obj : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in algorithm.obj 5>cuda_compile_generated_gpu_mat.cu.obj : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in algorithm.obj 5>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::locale::id::id(unsigned int)" (??0id@locale@std@@QAE@I@Z) already defined in cuda_compile_generated_gpu_mat.cu.obj 17>cuda_compile_generated_channels.cu.obj : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't

Opencver gravatar imageOpencver (Sep 20 '13)edit

and:

C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xutility(364): error C2039: 'iterator_category' : is not a member of 'cv::MatIterator_<_Tp>' 14> with 14> [ 14> _Tp=double 14> ] 14> C:\Program Files\Microsoft Visual Studio 11.0\VC\include\xutility(649) : see reference to class template instantiation 'std::iterator_traits<_Iter>' being compiled 14> with 14> [ 14> _Iter=cv::MatIterator_<double> 14> ] 14> C:\Program Files\Microsoft Visual Studio 11.0\VC\include\algorithm(1201) : see reference to function template instantiation 'void std::_Debug_range<_InIt1>(_InIt,_InIt,std::_Dbfile_t,std::_Dbline_t)' being compiled 14> with 14> [ 14> _InIt1=cv::MatIte

Opencver gravatar imageOpencver (Sep 20 '13)edit

To fix _ITERATOR_DEBUG_LEVEL & RuntimeLibrary errors, in Cmake, add extra options in CMAKE_CXX_FLAGS_DEBUG and CMAKE_C_FLAGS_DEBUG like: \D_DEBUG \D DEBUG \DEBUG

Compvis gravatar imageCompvis (Sep 23 '13)edit

Question Tools

1 follower

Stats

Asked: Sep 16 '13

Seen: 3,179 times

Last updated: Sep 18 '13