Hello,
My board is i.MX6Q.
I used Yocto 4.9.88(rock 2.4) BSP and updated its OpenCV to v4.0.1(from imx-yocto-L4.14.98_2.3.0), then I enabled python3, OpenCL, dnn and text.
Finally, I built it successfully.
But I tested the source code as below
import cv2
img = cv2.UMat(cv2.imread("image.jpg", cv2.IMREAD_COLOR))
imgUMat = cv2.UMat(img)
gray = cv2.cvtColor(imgUMat, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (7, 7), 1.5)
gray = cv2.Canny(gray, 0, 50)cv2.imwrite('test.jpg',img)
cv2.imwrite('test_UMat.jpg' , imgUMat)
it reported an error from OpenCL
[ WARN:0] Using world accessible cache directory. This may be not secure: /var/tmp/
OpenCL error CL_INVALID_WORK_GROUP_SIZE (-54) during call: clEnqueueNDRangeKernel('row_filter_C1_D0', dims=2, globalsize=128x528x1, localsize=16x16x1) sync=false
[ 1] 25: FMA_MUL temp(322).dp.x, 2.000000, temp(319).dp.x
I checked the OpenCL
root@imx6qsabresd:/usr/opencv_test# opencv_version --opencl 4.0.1 OpenCL Platforms: Vivante OpenCL Platform iGPU: Vivante OpenCL Device GC2000.5108.0000 (OpenCL 1.1 ) Current OpenCL device: Type = iGPU Name = Vivante OpenCL Device GC2000.5108.0000 Version = OpenCL 1.1 Driver version = OpenCL 1.1 V6.2.4.p1.150331 Address bits = 32 Compute units = 4 Max work group size = 1024 Local memory size = 1 KB Max memory allocation size = 32 MB Double support = No Host unified memory = Yes Device extensions: cl_khr_byte_addressable_store cl_khr_gl_sharing Has AMD Blas = No Has AMD Fft = No Preferred vector width char = 4 Preferred vector width short = 4 Preferred vector width int = 4 Preferred vector width long = 0 Preferred vector width float = 4 Preferred vector width double = 0
Could anyone tell me what happened and how to fix it?
Thanks a lot.
Hi zohan
for CL_INVALID_WORK_GROUP_SIZE error one can look at
documentation:
opencl - Causes for CL_INVALID_WORK_GROUP_SIZE - Stack Overflow
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi igor,
we found some info about OpenCL in imx6q :
请问imx6q 的opencl支持opencv的ocl模块 uMat吗?
It said "imx6q supports opencl 1.1, only opencl 1.2 can support uMat, so imx6q couldn't support this"
Is that right?
Could we update iGPU OpenCL version from v1.1 to v1.2?
Thanks,
zohan
Hi zohan
right, i.MX6Q supports only OpenCL 1.1
this is described in Chapter 32 3D Graphics
i.MX 6Dual/6Quad Applications Processor Reference Manual
Best regards
igor
Hi igor,
I also found some info on the website:
OpenCL optimizations · opencv/opencv Wiki · GitHub
it said: OpenCV can utilize acceleration on devices with OpenCL 1.2 (and OpenCL 1.1 with limited functionality)
Thanks for your help,
zohan
Hi igor,
I checked my error message,
"localsize=16x16x1" is less than the "Max work group size = 1024"
"globalsize=128x528x1" is evenly divisable by the "localsize=16x16x1"
I thought I didn't use __attribute__((reqd_work_group_size(X, Y, Z))).
Do you have any idea about CL_INVALID_WORK_GROUP_SIZE?
I had posted the same question on the website
opencv - CL_INVALID_WORK_GROUP_SIZE in cv2.GaussianBlur() - Stack Overflow
Someone said "Local memory size = 1 KB" is very small,
I checked i.MX_Graphics_User's_Guide.pdf,
The OpenCL Embedded Profile specification defines the minimum requirement for local memory to be 1KB to pass conformance testing.
Is "Local memory size = 1 KB" OK for OpenCV v4.0.1 & OpenCL v1.1 in imx6q with kernel 4.9.88?
Thanks,
zohan