Build OpenCV with OpenCL support
in CMake, I built OpenCV with OpenCL Enable ON(It automatically detected the OPENCL_INCLUDE_DIR
path but the OPENCL_LIBRARY
was empty, even after clicking config. for OPENCL_LIBRARY
i don't see browse button either .. after generating opencv binaries then i run the below code
#include <iostream>
#include <fstream>
#include <string>
#include <iterator>
#include <opencv2/opencv.hpp>
#include <opencv2/core/ocl.hpp>
int main()
{
if (!cv::ocl::haveOpenCL())
cout << "OpenCL is not avaiable..." << endl;
else cout << "OpenCL is AVAILABLE! :) " << endl; //this is the output
cv::ocl::setUseOpenCL(true);
cout << context.ndevices() << " GPU devices are detected." << endl;
for (int i = 0; i < context.ndevices(); i++)
{
cv::ocl::Device device = context.device(i);
cout << "name: " << device.name() << endl;
cout << "available: " << device.available() << endl;
cout << "imageSupport: " << device.imageSupport() << endl;
cout << "OpenCL_C_Version: " << device.OpenCL_C_Version() << endl;
cout << endl;
} //this works & i can see my video card name & opencl version
cv::ocl::Device(context.device(0));
}
When i make use of UMat
to measure the performance, the performance with(UMat) or without(Mat) OpenCL did not make any difference.
I downloaded AMD-APP-SDK from this link and tried to build but there was no OpenCL binaries (instead i saw opengl dll files[glew32.dll & glut32.dll]. How do i build OpenCV with OpenCL by linking the OPENCL_LIBRARY?
No idea where is your problem. Can you give system and opencv version?
First what is your code test?
I have check my configuration with an nvidia card. I have set a break point at line https://github.com/opencv/opencv/blob... and line https://github.com/opencv/opencv/blob... (amd device). For my nvidia card nvcompiler.dll is loaded at line https://github.com/opencv/opencv/blob.... If dll is not found retval!=CL_SUCESS program go to https://github.com/opencv/opencv/blob.... May be you can check your program behaviour.
Thanks for your reply. I am using the latest version of OpenCV from github. I am using face_detection sample code and replaced Mat with UMat.The breakpoint at this line is triggered. but retval is 0.
I tried on both AMD processor + Carrizo also on Intel processor + Nvidea Graphics in windows 10 and windows 7. No performance improvement anywhere. How did you get nvcompiler.dll ? I installed AMD-APP-SDK like said in question above, but that didn't help me. also tried installing Intel OpenCL SDK & INtel OpenCL Runtimes..No luck with that as well.
I use nvidia card with nsigh and vs 2015. To test opencl you can use this program
Thank you. I tried test opencl code and it gave excellent results. Can you please explain this line in testOCL_OCV32.cpp. I understood that m is the average time taken, but sqrt(v) has +/- what does the value indicate and why v is required?
v2 is variance and sqrt(v2) standard deviation.It means that times to execute process is in interval [m-v m+v] with a probability of 66% if it is a gaussian distribution (it is not a gaussian distribution!) with 100 trial times consumming to execute algorithm is not a constant
Hi All, when I try to compile OpenCV 3.4.3 with OpenCL support it gives me compilation error around 35% saying:
I also get the following warnings while generating makefile:
Does it make sense that OpenCL from Intel and from Cuda conflicts with each other ?
@Zari, please don't post answers here, if you have a question or comment, thank you.