简体   繁体   English

OpenCV GPU 垫挂

[英]OpenCV GPU Mat Hanging

I think I have an interesting issue here and would love to get some help.我想我在这里有一个有趣的问题,很想得到一些帮助。

Hardware硬件

2x Identical Machines 2x 相同的机器

  • i-7 4770 i-7 4770
  • Asus Mobo华硕主板
  • 8GB of ram 8GB 内存
  • GTX 750 (Maxwell) (driver version 335.23) GTX 750 (Maxwell)(驱动程序版本 335.23)

Software软件

  • VS2010 VS2010
  • VS2012 VS2012
  • OpenCV 2.4.5 (compiled on Kepler hardware) OpenCV 2.4.5(在 Kepler 硬件上编译)
  • Cuda 5.0 CUDA 5.0

As the title says, when I try to create an OpenCV GpuMat ( cv::gpu::Gpumat ), the program will "hang."正如标题所说,当我尝试创建 OpenCV GpuMat ( cv::gpu::Gpumat ) 时,程序将“挂起”。 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.有趣的是,CUDA 安装成功,OpenCV 头文件是使用 CMake 编译的,并且已经在其他计算机上验证过(并且gpu::setDevice()在当前机器上没有返回错误),并且程序偶尔会运行。 The code below is what I am testing with.下面的代码是我正在测试的代码。

In the below implementation, the code will hang at gpuMat_1.upload(cpuMat_1) .在下面的实现中,代码将挂在gpuMat_1.upload(cpuMat_1) Previously (when tested as a benchmark to make sure that certain parts were working), gpuMat.upload would complete.以前(当作为基准测试以确保某些部分正常工作时), gpuMat.upload会完成。 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.在确认在两台相同的机器上(每台都有 GTX 750)后,两者都被提升到有 2 个上传和一个添加(当前显示)并且不会完成第一次上传。 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;
}

Update: I recently re-compiled OpenCV on one of these units (to account for hardware changes) and am getting the same issues.更新:我最近在这些单元之一上重新编译了 OpenCV(以考虑硬件更改)并且遇到了同样的问题。

The issue turned out to be an incompatibility with OpenCV 2.4.5 and the new Maxwell architecture.结果证明该问题与 OpenCV 2.4.5 和新的 Maxwell 架构不兼容。 I was able to get my hands onto a Quadro 600 and installed that to test it, and it worked fine.我能够拿到 Quadro 600 并安装它进行测试,它运行良好。 I then tested it with a GTX 650, which also worked.然后我用 GTX 650 对其进行了测试,它也能正常工作。 I then tested it using the mog2 motion detection libraries on the 650, which also work.然后我在 650 上使用 mog2 运动检测库对其进行了测试,该库也可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM