OpenCV GPU席 [英] OpenCV GPU Mat Hanging

查看:159
本文介绍了OpenCV GPU席的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我在这里有一个有趣的问题,很想得到一些帮助。

I think I have an interesting issue here and would love to get some help.

硬件

两个相同的机器


  • i-7 4770

  • Asus Mobo

  • 8GB of ram

  • GTX 750(Maxwell)(驱动程序版本为335.23)

  • i-7 4770
  • Asus Mobo
  • 8GB of ram
  • GTX 750 (Maxwell) (driver version 335.23)

软件


  • VS2010

  • VS2012

  • OpenCV 2.4.5(在Kepler硬件上编译)

  • Cuda 5.0

  • VS2010
  • VS2012
  • OpenCV 2.4.5 (compiled on Kepler hardware)
  • Cuda 5.0

如标题所示,当我尝试创建一个OpenCV GpuMat cv :: gpu :: Gpumat ),程序将挂起。我的意思是,不会进一步执行。这使得这个有趣的是CUDA安装成功,OpenCV头使用CMake编译并且在其他计算机上验证过(并且 gpu :: setDevice()不返回错误在当前机器上),并且程序会偶尔运行。下面的代码是我正在测试的。

As the title says, when I try to create an OpenCV GpuMat (cv::gpu::Gpumat), the program will "hang." What I mean by this is that no further executions will occur. What makes this interesting is that CUDA installed successfully, the OpenCV headers were compiled using CMake and have been verified on other computers (and gpu::setDevice() does not return an error on the current machine), and the program will occasionally run. The code below is what I am testing with.

在下面的实现中,代码将挂在 gpuMat_1.upload(cpuMat_1)。以前(当测试作为基准,以确保某些部分是工作), gpuMat.upload 将完成。在确认两台相同的机器(每台都有GTX 750)后,两台机器都有2个上传和一个添加(当前显示),并且不会完成第一次上传。当第二次上传删除,并添加它,它仍然在第一次上传时挂起。

In the below implementation, the code will hang at gpuMat_1.upload(cpuMat_1). Previously (when tested as a benchmark to make sure that certain parts were working), gpuMat.upload would complete. After confirming that on two identical machines (each with a GTX 750) both were brought up to having 2 uploads and one add (currently displayed) and will not finish the first upload. When the second upload is removed, and the add with it, it still hangs during the first upload.

感谢您的帮助。如果还有其他问题需要补充,或者有助于澄清问题,请问。

Thank you for your help. If there is anything else that I should add, or would help clarify the problem, please ask.

#include <iostream>
#include <opencv2\gpu\gpu.hpp>

int main()
{
    std::cout << "Number of gpu devices: " << cv::gpu::getCudaEnabledDeviceCount() << std::endl;

    cv::Mat cpuMat_1, cpuMat_2;
    cv::gpu::GpuMat gpuMat_1, gpuMat_2, gpuMat_3;

    cpuMat_1 = cv::Mat::ones(4, 4, CV_8SC1);
    cpuMat_2 = cv::Mat::ones(4, 4, CV_8SC1);

    gpuMat_1.upload(cpuMat_1);
    std::cout << "Help." << std::endl;
    gpuMat_2.upload(cpuMat_2);
    std::cout << "Please, help." << std::endl;

    cv::gpu::add(gpuMat_1, gpuMat_2, gpuMat_3);

    std::cout << "Help has come." << std::endl;

    system("PAUSE");
    return 0;
}



更新:我最近在其中一个单元上重新编译OpenCV

Update: I recently re-compiled OpenCV on one of these units (to account for hardware changes) and am getting the same issues.

推荐答案

这个问题最终与OpenCV 2.4.5不兼容,新的麦克斯韦架构。我能够把我的手放到一个Quadro 600上,并安装了测试它,它工作正常。然后我用GTX 650测试它,这也工作。然后我使用mog2运动检测库在650上测试它,这也工作。

The issue turned out to be an incompatibility with OpenCV 2.4.5 and the new Maxwell architecture. I was able to get my hands onto a Quadro 600 and installed that to test it, and it worked fine. I then tested it with a GTX 650, which also worked. I then tested it using the mog2 motion detection libraries on the 650, which also work.

这篇关于OpenCV GPU席的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆