Ask Your Question

Running DNN on GPU (Problems with OpenCL and Halide)

asked 2018-08-08 09:06:28 -0500

Mary-Ann gravatar image


I am running a Caffe based network, called DetectNet (, using the Python-OpenCV dnn module. It has one special layer which I needed to register manually.

Now I would like to improve the performance, and switch to the GPU. I have already done some research and found these threads: and .

So I tried to use OpenCL and Halide. But apparently OpenCL is not supported on my machine (I am using NVidia), since I get this warning: [ WARN:0] DNN: OpenCL target is not supported with current OpenCL device (tested with Intel GPUs only), switching to CPU.

In case of Halide, I get an error: (-215:Assertion failed) haveHalide() in function 'wrapMat' The problem is the additional non-Caffe layer. If I delete this layer, no error occurs, and the application speeds up a bit (even though it is still pretty slow, and I actually need even higher performance). Unfortunately, the deleted layer sums up the calculations and produces the output of the network, so I can not simply delete it.

So my question is, if/how it is possible to run DetectNet with the Halide Interface. In the second thread it was mentioned, that a general GPU support is planned for the future. Are there any information available, when this feature could be possibly released?

Thank you for any answers!


edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2018-11-21 01:09:12 -0500

Try setting the environment variable OPENCV_DNN_OPENCL_ALLOW_ALL_DEVICES=1 E.g. on linux shell: OPENCV_DNN_OPENCL_ALLOW_ALL_DEVICES=1 ./your_program

edit flag offensive delete link more

answered 2018-08-29 01:52:08 -0500

tyzeroy gravatar image

@Mary-Ann, my opencv version is 3.4.2 and I got the same waring "[ WARN:0] DNN: OpenCL target is not supported with current OpenCL device (tested with Intel GPUs only), switching to CPU." After googling, i found the reason. because of those issues, it seems to force switching CPU if GPU is not Intel and the InteGPU is only supported now.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-08-08 09:06:28 -0500

Seen: 944 times

Last updated: Aug 08 '18