2017-08-01 141 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

這很有幫助,謝謝! –