2017-08-01 142 views
1

系统信息(版本)未能在OpenCV的GPU(CUDA)

  • 的OpenCV => 3.2
  • 操作系统/平台=>视窗10 64位创建过滤器
  • 编译=>视觉工作室2015社区
  • CUDA Toolkit版本=> 8.0

d详细描述

我正在使用基于GPU的功能和操作。我自己构建了带有CUDA支持的OpenCV,并且大多数GPU功能和操作都可以正常工作。但是,当涉及到过滤相关的功能等createGaussianFiltercreateSobelFilter异常下面被捕获:

C:\的OpenCV \的OpenCV-3.2.0 \模块\ cudafilters \ SRC \ filtering.cpp:414:错误:( -215)rowFilter_在功能`匿名命名空间“:: SeparableLinearFilter :: SeparableLinearFilter!= 0

代码重现

// C++ code example 
// A very simple snnipet 
#include <opencv2/core/core.hpp> 
#include <opencv2/highgui/highgui.hpp> 
#include <opencv2/core/cuda.hpp> 
#include <opencv2/cudaimgproc.hpp> 
#include <opencv2/cudafilters.hpp> 
#include <iostream> 

using namespace cv; 
using namespace std; 

int main(int argc, char** argv) 
{ 
    try 
    { 
     Ptr<cuda::Filter> filterX = cuda::createSobelFilter(CV_64F, CV_64F, 1, 0, 3, 1, BORDER_DEFAULT); // x direction 
    } 
    catch (cv::Exception& e) 
    { 
     const char* err_msg = e.what(); 
     std::cout << "exception caught: " << err_msg << std::endl; 
    } 

    return 0; 
} 
+1

你可以尝试用:'CUDA :: createSobelFilter(CV_32F,CV_32F,1,0,3 ,1,BORDER_DEFAULT);'? – Catree

+0

@Catree它没关系!谢谢!但我不明白为什么?你想写一个答案,以便我可以接受它吗? –

回答

1

你可以找到here测试Sober过滤器的CUDA版本的代码。

在我看来,这是OpenCV开发者的选择(CUDA API允许双精度计算,因为我认为时间很长)。或者双精度浮点不被接受,因为效率不高,精度越高,不值得性能下降。计算机图形不需要这种精度,因此GPU架构具有更多单精度单位(更多信息,请参阅here,2010)。

另请参阅CUDA faq

注:这是专为游戏GPU VS专业GPU的情况下(见here,2015年):

Summary of NVIDIA GPUs

NVIDIA's GTX series are known for their great FP32 performance but are very poor in their FP64 performance. The performance generally ranges between 1:24 (Kepler) and 1:32 (Maxwell). The exceptions to this are the GTX Titan cards which blur the lines between the consumer GTX series and the professional Tesla/Quadro cards.

The Kepler architecture Quadro and Tesla series card provide full double precision performance with 1:3 FP32. However, with the Quadro M6000, NVIDIA has decided to provide only minimal FP64 performance by giving it only 1:32 of FP32 capability and touting the M6000 as the best graphics card rather than the best graphics+compute card like the Quadro K6000.

AMD GPUs

AMD GPUs perform fairly well for FP64 compared to FP32. Most AMD cards (including consumer/gaming series) will give between 1:3 and 1:8 FP32 performance for FP64. The AMD Tahiti architectures tested in these benchmarks here do not suffer from the same problems FP64 problems as NVIDIA's GTX series and give a 1:4 performance. Newer Hawaii architecture consumer grade GPUs are expected to provide 1:8 performance.

The FirePro W9100, W8100 and S9150 will give you an incredible FP64 1:2 FP32 performance.

Overall, AMD GPUs hold a reputation for good double precision performance ratios compared to their NVIDIA counterparts.

+0

这很有帮助,谢谢! –