Error Printing OpenCL Device Information

asked 2015-06-29 19:59:03 -0500

drewski gravatar image

So I have compiled OpenCV3.0 for windows 8.1 using Visual Studios 13 with OpenCL and CUDA support, the CUDA and core ocl tests seem to work fine. I would now like to print out the OpenCL capable devices and the information pertaining to them.

So here is the code that I have.

std::vector<cv::ocl::PlatformInfo> plt_info;
cv::ocl::getPlatfomsInfo(plt_info);                  <- Problem >:(

I then iterate through the vector and print all the relevant information. The code compiles but crashes when it tries to populate the plt_info with the platform information. I don't understand why it crashes... I had compiled the same code on my mac book using the same version of OpenCV I had built.

So I decided to look a bit further, and began debugging the application. So when the application crashed I get this error.

First-chance exception at 0x00007FF9164B8B9C in XXXX.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x000000D8812FF680.
Unhandled exception at 0x00007FF9164B8B9C in XXXX.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x000000D8812FF680.

Stepping through getPlatformInfo() I find that some vectors inside the function are allocated to very very long. Not sure why or how this happens, but I imagine that is the reason for failure.

I actually looked up the the source for opencv_test_core.exe, which prints the opencl device information in the beginning, and it is doing exactly what I am doing... so I am not sure why or how this failing.

edit retag flag offensive close merge delete