问题
Im trying to get GPU up and running using:
- OpenCv 2.4.10
- Visual Studio 2013
- Cuda toolkit 7.5 (cuda samples tested and running)
- Windows 10 x64
- Lenovo Y50 with NVIDIA GEFORCE GTX 860M
I have compiled OpenCv using CMake with WITH_CUDA=ON, and then installed the libraries by opening OpenCv.sln and built ALLBUILD and INSTALL projects.
Set my Project configuration as:
VC++ Directories
- include Directories:
- C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\include
- C:\OpenCv\opencv\build\install\include (Contains the compiled libraries)
- C:\OpenCv\opencv\build\include
- include Directories:
Linker-general-Additional libraries
- C:\OpenCv\opencv\build\x64\vc12\lib
- C:\OpenCv\opencv\build\install\x64\vc12\lib
Linker-input-Additional Depencies
- opencv_calib3d2410d.lib
- opencv_contrib2410d.lib
- opencv_core2410d.lib
- opencv_features2d2410d.lib
- opencv_flann2410d.lib
- opencv_gpu2410d.lib
- opencv_highgui2410d.lib
- opencv_imgproc2410d.lib
- opencv_legacy2410d.lib
- opencv_ml2410d.lib
- opencv_nonfree2410d.lib
- opencv_objdetect2410d.lib
- opencv_ocl2410d.lib
- opencv_photo2410d.lib
- opencv_stitching2410d.lib
- opencv_superres2410d.lib
- opencv_ts2410d.lib
- opencv_video2410d.lib
- opencv_videostab2410d.lib
My environment variables: Path= C:\Program Files\NVIDIA GPU Computing;Toolkit\CUDA\v7.5;C:\OpenCv\opencv\build\install\x64\vc12\bin;C:\OpenCv\opencv\build\x64\vc12\bin
Testing code:
#include "opencv2\opencv.hpp"
#include "opencv2\gpu\gpu.hpp"
using namespace cv::gpu;
using namespace std;
int main() {
{
setDevice(0);
int gpu = getCudaEnabledDeviceCount();
cout << gpu ;
system("pause");
return 0;
}
}in
But setDevice throws
no GPU support (The library is compiled without CUDA support) in EmptyDeviceInfoFuncTable::setDevice, file c:\builds\2_4_PackSlave-win64-vc12-shared\opencv\dynamicuda\include\opencv2/dynamiccuda/dynamicuda.hpp. line 84
and if i comment setDevice(0) the gpu is still not detected, getCudaEnabledDeviceCount returns 0.
回答1:
The problem is that Opencv 2.4.10 supports CUDA 4.2 and my video card is compatible only with CUDA 6.5 and 7.5 , I solved by installing OpenCV 3.0.0
来源:https://stackoverflow.com/questions/32774673/no-gpu-support-using-opencv-2-4-10-cuda-7-5-w10