Ask Your Question
0

OpenCV Error: Gpu Api Call <invalid device function>

asked 2013-09-16 11:05:05 -0600

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,

edit retag flag offensive close merge delete

Comments

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

StevenPuttemans gravatar imageStevenPuttemans ( 2013-09-17 02:19:49 -0600 )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 ( 2013-09-17 06:38:23 -0600 )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 ( 2013-09-17 07:07:51 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-09-18 01:46:02 -0600

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.

edit flag offensive delete link more

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 ( 2013-09-19 22:55:39 -0600 )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 ( 2013-09-19 22:56:49 -0600 )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 ( 2013-09-22 22:48:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-09-16 11:05:05 -0600

Seen: 3,062 times

Last updated: Sep 18 '13