Ask Your Question
0

Is it possible to create an OpenCL Kernel that uses OpenCV?

asked 2016-04-13 04:55:42 -0500

mark92m gravatar image

I have an OpenCV application which I would like to speed up using several GPUs (located in a linux machine cluster).

My approach was to create an OpenCL kernel to execute on a single GPU, and then extend this performance by using VirtualCL to use the network-attached devices.

My question is, is it possible to run an OpenCL kernel that somehow calls the OpenCV Library ?

clBuildProgram() allows you to specify compiler options which include the include file directories. The header file includes, should look something like: -I myincludedir1 -I myincludedir2

similar to:

g++ -I/usr/local/include/opencv -I/usr/local/include/opencv2 -L/usr/local/lib/ -g -o binary  main.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_stitching

Has anyone ever managed to create an OpenCL kernel that uses OpenCV ? Or is there any simpler way ? (without using UMat )

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-04-13 07:02:26 -0500

Tetragramm gravatar image

I don't think it's possible. Perhaps in the very simplest cases, but even then...

Both the Mat structure and almost every OpenCV function use parts of the language that are either not supported by OpenCL, or bad ideas from a performance standpoint. For example, the arithmetic functions call SSE and AVX code that would horribly break if you tried to use it on OpenCL devices.

If it were possible, it would be enough work you it would probably be easier to just write your own OpenCL kernels, then contribute them back so others can benefit too.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-04-13 04:55:42 -0500

Seen: 110 times

Last updated: Apr 13 '16