<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: OpenCV 3.0 T-API (OpenCL) CL_Error</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851541#M130294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE&lt;/CODE&gt; should return a single &lt;CODE&gt;size_t&lt;/CODE&gt; value (for example 512 or 1024). This is the maximum number of work-items in a work-group, not the maximum in each dimension. So in your case you are trying to make a 2D work-group with 32*32 = 1024 work-items, and presumably &lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE&lt;/CODE&gt; is less than 1024 on your system.&lt;/P&gt;&lt;P&gt;See the OpenCL 1.1 spec, table 4.3, page 37, the definition of &lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;You can work with OpengL and OpenCV in you iMX8.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;Regards&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jan 2019 18:26:56 GMT</pubDate>
    <dc:creator>Bio_TICFSL</dc:creator>
    <dc:date>2019-01-22T18:26:56Z</dc:date>
    <item>
      <title>OpenCV 3.0 T-API (OpenCL) CL_Error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851540#M130293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;hi,&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;I am running a Yocto Disto on IMX8 SOM with OpenCV 3.0 support.&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;The Goal of this pilot is running the OpenCV function goodFeaturesToTrack() with OpenCL (using the Vivante on the IMX8).&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;The OpenCL code works well on the platform, but when I tried running the OpenCV goodFeaturesToTrack() function I get the OpenCL runtime error of CL_INVALID_WORK_GROUP_SIZE (-54)&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;At first glance, I would expect the OpenCV 3.0 to query the hardware and set the OpenCL environment&amp;nbsp;accordingly or advise the programmer how to control the workgroup parameters.&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;From googling around I understand the nature of the error but I didn't find any OpenCV 3.0 support of how to configure the OpenCL kernel or OpenCL environment being used by OpenCV.&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;Please Help&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2019 10:15:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851540#M130293</guid>
      <dc:creator>guyorfreeman</dc:creator>
      <dc:date>2019-01-22T10:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCV 3.0 T-API (OpenCL) CL_Error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851541#M130294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE&lt;/CODE&gt; should return a single &lt;CODE&gt;size_t&lt;/CODE&gt; value (for example 512 or 1024). This is the maximum number of work-items in a work-group, not the maximum in each dimension. So in your case you are trying to make a 2D work-group with 32*32 = 1024 work-items, and presumably &lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE&lt;/CODE&gt; is less than 1024 on your system.&lt;/P&gt;&lt;P&gt;See the OpenCL 1.1 spec, table 4.3, page 37, the definition of &lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;You can work with OpengL and OpenCV in you iMX8.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;Regards&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2019 18:26:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851541#M130294</guid>
      <dc:creator>Bio_TICFSL</dc:creator>
      <dc:date>2019-01-22T18:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCV 3.0 T-API (OpenCL) CL_Error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851542#M130295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Bio;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps my question was not clear enough,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running an OpenCV 3.0 code (after verifying that an OpenCL code works on my&amp;nbsp;IMX8M machine).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This OpenCV code (attached below) is using UMat instead of Mat which instructs the OpenCV layer to use T-API&lt;/P&gt;&lt;P&gt;and use OpenCL kernels for the implementation of the OpenCV function "goodFeaturesToTrack()".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The OpenCV - OpenCL implementation fires a total amount of work items in a manner that causes the OpenCl layer to violate the &lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE&lt;/CODE&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my platform I found that &lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE&lt;/CODE&gt; is 1024 in total and on each dimension,&lt;/P&gt;&lt;P&gt;clGetDeviceInfo(devices[j], CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(WorkSize), &amp;amp;WorkSize, NULL);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Now, while running the OpenCV code below, it is implementing the "goodFeaturesToTrack()" function on the OpenCL run-time, and OpenCV tries to queue the following CL kernels with wrong "globalsize" which results OpenCL errors:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OpenCL error CL_INVALID_WORK_GROUP_SIZE (-54) during call:&amp;nbsp;&lt;/P&gt;&lt;P&gt;clEnqueueNDRangeKernel('sobel3', dims=2, &lt;STRONG&gt;globalsize=512x512x1&lt;/STRONG&gt;, localsize=16x16x1)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;OpenCL error CL_INVALID_WORK_GROUP_SIZE (-54) during call:&amp;nbsp; &lt;BR /&gt;clEnqueueNDRangeKernel('MaxEigenVal', dims=1, &lt;STRONG&gt;globalsize=4096x1x1&lt;/STRONG&gt;, localsize=1024x1x1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My original question was:&lt;BR /&gt;1. Why OpenCV 3.0 which uses the T-API, is configuring the work items incorrectly so that it violates the &lt;CODE&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE=1024&lt;/CODE&gt;?&lt;/P&gt;&lt;P&gt;2. How can I set or limit the globalsize/localsize&amp;nbsp; that the OpenCV&amp;nbsp; is using when queuing CL kernels into the openCL run-time environment to prevent this behavior.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Guy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Program Code&lt;/P&gt;&lt;P&gt;==================&lt;/P&gt;&lt;P&gt;#include "opencv2/highgui/highgui.hpp"&lt;BR /&gt;#include "opencv2/imgproc/imgproc.hpp"&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/P&gt;&lt;P&gt;using namespace cv;&lt;BR /&gt;using namespace std;&lt;/P&gt;&lt;P&gt;/// Global variables&lt;BR /&gt;Mat src, src_gray;&lt;BR /&gt;UMat usrc,usrc_gray;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;int maxCorners = 500;&lt;BR /&gt;int maxTrackbar = 100;&lt;/P&gt;&lt;P&gt;RNG rng(12345);&lt;BR /&gt;char* source_window = "Image";&lt;/P&gt;&lt;P&gt;/// Function header&lt;BR /&gt;void goodFeaturesToTrack_Demo( int, void* );&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt; * @function main&lt;BR /&gt; */&lt;BR /&gt;int main( int argc, char** argv )&lt;BR /&gt;{&lt;BR /&gt; /// Load source image and convert it to gray&lt;BR /&gt; //src = imread( argv[1], 1 );&lt;BR /&gt; imread( argv[1], 1 ).copyTo(usrc);&lt;BR /&gt; cvtColor( usrc, usrc_gray, CV_BGR2GRAY );&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /// Create Window&lt;BR /&gt; namedWindow( source_window, CV_WINDOW_AUTOSIZE );&lt;/P&gt;&lt;P&gt;/// Create Trackbar to set the number of corners&lt;BR /&gt; createTrackbar( "Max corners:", source_window, &amp;amp;maxCorners, maxTrackbar, goodFeaturesToTrack_Demo );&lt;/P&gt;&lt;P&gt;imshow( source_window, usrc );&lt;/P&gt;&lt;P&gt;goodFeaturesToTrack_Demo( 0, 0 );&lt;/P&gt;&lt;P&gt;waitKey(0);&lt;BR /&gt; return(0);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt; * @function goodFeaturesToTrack_Demo.cpp&lt;BR /&gt; * @brief Apply Shi-Tomasi corner detector&lt;BR /&gt; */&lt;BR /&gt;void goodFeaturesToTrack_Demo( int, void* )&lt;BR /&gt;{&lt;BR /&gt; if( maxCorners &amp;lt; 1 ) { maxCorners = 1; }&lt;/P&gt;&lt;P&gt;/// Parameters for Shi-Tomasi algorithm&lt;BR /&gt; vector&amp;lt;Point2f&amp;gt; corners;&lt;BR /&gt; double qualityLevel = 0.01;&lt;BR /&gt; double minDistance = 10;&lt;BR /&gt; int blockSize = 3;&lt;BR /&gt; bool useHarrisDetector = false;&lt;BR /&gt; double k = 0.04;&lt;/P&gt;&lt;P&gt;/// Copy the source image&lt;BR /&gt; UMat ucopy;&lt;/P&gt;&lt;P&gt;ucopy = usrc.clone();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/// Apply corner detection&lt;BR /&gt; goodFeaturesToTrack( usrc_gray,&lt;BR /&gt; corners,&lt;BR /&gt; maxCorners,&lt;BR /&gt; qualityLevel,&lt;BR /&gt; minDistance,&lt;BR /&gt; Mat(),&lt;BR /&gt; blockSize,&lt;BR /&gt; useHarrisDetector,&lt;BR /&gt; k );&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /// Draw corners detected&lt;BR /&gt; cout&amp;lt;&amp;lt;"** Number of corners detected: "&amp;lt;&amp;lt;corners.size()&amp;lt;&amp;lt;endl;&lt;BR /&gt; int r = 4;&lt;BR /&gt; for( int i = 0; i &amp;lt; corners.size(); i++ )&lt;BR /&gt; { circle( ucopy, corners[i], r, Scalar(rng.uniform(0,255), rng.uniform(0,255),&lt;BR /&gt; rng.uniform(0,255)), -1, 8, 0 ); }&lt;/P&gt;&lt;P&gt;/// Show what you got&lt;BR /&gt; namedWindow( source_window, CV_WINDOW_AUTOSIZE );&lt;BR /&gt; imshow( source_window, ucopy );&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jan 2019 07:19:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851542#M130295</guid>
      <dc:creator>guyorfreeman</dc:creator>
      <dc:date>2019-01-23T07:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCV 3.0 T-API (OpenCL) CL_Error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851543#M130296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was wondering if you reached a resolution on this or have acquired any other info. I am working through the same problem on an i.MX8M based DART-MX8M SOM. OpenCL kernels are not being enqueued correctly with CL_INVALID_WORK_GROUP_SIZE as the error. I tried some of the suggestions here such as setting maxWorkGroupSize_, to no avail. I believe it is one of the other GPU constraints being violated but not sure which or how to determine it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I modify OpenCV to pass NULL as the localsize always, this error goes away, but that breaks kernels which expect a specific localsize so is not a general solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2019 22:37:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851543#M130296</guid>
      <dc:creator>jrestifo</dc:creator>
      <dc:date>2019-02-01T22:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCV 3.0 T-API (OpenCL) CL_Error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851544#M130297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, due to&amp;nbsp;time constraints I went on looking for workarounds.&lt;/P&gt;&lt;P&gt;I tend to agree with you that it has to do with the wrong implementation/GPU constraints.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the&amp;nbsp;best&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 13:53:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/851544#M130297</guid>
      <dc:creator>guyorfreeman</dc:creator>
      <dc:date>2019-02-07T13:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: OpenCV 3.0 T-API (OpenCL) CL_Error</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/1375973#M183460</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I'm trying the same goodfeaturestoTrack Opencv 4.5 function using Opencl in Vivante 7000 GPU on IMX8MPlus, and I'm facing the different error,&lt;BR /&gt;CL_LINK_PROGRAM_FAILURE. Is this a similar problem, or does this require something else to be done.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 05:59:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/OpenCV-3-0-T-API-OpenCL-CL-Error/m-p/1375973#M183460</guid>
      <dc:creator>fenil</dc:creator>
      <dc:date>2021-11-24T05:59:05Z</dc:date>
    </item>
  </channel>
</rss>

