<?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>topic Re: It's like OpenCL kernel instance ends abruptly in GPU Compute Software</title>
    <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389705#M501</link>
    <description>&lt;P&gt;Once again, thank you for spending your invaluable time to help me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually before I posted the first question, I had done the test with float instead of double and confirmed it worked correctly(with less accuracy).&lt;/P&gt;
&lt;P&gt;But I wanted to figure out why the code with double was not running the way I expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I think I need to investigate the behavior of the codes more on my own.&lt;/P&gt;
&lt;P&gt;I will try to use GDB debugger if I can learn anything from using it.&lt;/P&gt;
&lt;P&gt;Actually I tried GDB debugger but it didn't go like 'Set Up Intel® Distribution for GDB* to Debug GPUs on Windows*'.&lt;/P&gt;
&lt;P&gt;That's&amp;nbsp;because I failed to start '&lt;SPAN&gt;gdbserver-gt'&amp;nbsp; although I referred to 'trouble shooting'. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I might need to ask another question&amp;nbsp; regarding GDB debugger.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, one more question. I really appreciated if you give me any opinion on this.&lt;/P&gt;
&lt;P&gt;I was stunned to see the same program(with double) run correctly after installing&amp;nbsp; GDB debugger(oneAPI\debugger\latest\target\gen_debugger_target.msi).&lt;/P&gt;
&lt;P&gt;I swear there was nothing else other than installing GDB.&lt;/P&gt;
&lt;P&gt;I did the test three times install/uninstalling GDB(with reboot) and running the program.&lt;/P&gt;
&lt;P&gt;I'm sure the debugger make a difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Ethan Kim&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2022 00:47:02 GMT</pubDate>
    <dc:creator>heysweetethan</dc:creator>
    <dc:date>2022-06-03T00:47:02Z</dc:date>
    <item>
      <title>It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1386883#M478</link>
      <description>&lt;P&gt;I'm posting the same question from "&lt;A href="https://stackoverflow.com/questions/72357676/its-like-opencl-kernel-instance-ends-abruptly&amp;quot;" target="_blank"&gt;https://stackoverflow.com/questions/72357676/its-like-opencl-kernel-instance-ends-abruptly"&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm new to OpenCL and I'm working on converting an existing algorithm to OpenCL. In this process, I am experiencing a phenomenon that I cannot solve on my own, and I would like to ask some help.&lt;/P&gt;
&lt;P&gt;Here's details.&lt;/P&gt;
&lt;P&gt;My kernel is applied to images of different size (to be precise, each layer of the Laplacian pyramid).&lt;/P&gt;
&lt;P&gt;I get normal results for images of larger size such as 3072 x 3072, 1536 x 1536. But I get&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;abnormal results for smaller images&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;such as 12 x 12, 6 x 6, 3 x 3, 2 x 2.&lt;/P&gt;
&lt;P&gt;At first, I suspected that&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;clEnqueueNDRangeKernel&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;had a bottom limit for dimensions, causing this problem. So, I added&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;printf&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to the beginning of the kernel as follows. It is confirmed that all necessary kernel instances are executed.&lt;/P&gt;
&lt;PRE class="lang-c s-code-block"&gt;&lt;CODE class="hljs language-c"&gt;__kernel &lt;SPAN class="hljs-type"&gt;void&lt;/SPAN&gt; &lt;SPAN class="hljs-title function_"&gt;GetValueOfB&lt;/SPAN&gt;&lt;SPAN class="hljs-params"&gt;(&lt;SPAN class="hljs-comment"&gt;/* parameters */&lt;/SPAN&gt;)&lt;/SPAN&gt;
{
    uint xB = get_global_id(&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;);
    uint yB = get_global_id(&lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;);
    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"(%d, %d)\n"&lt;/SPAN&gt;, xB, yB);

    &lt;SPAN class="hljs-comment"&gt;// calculation code is omitted&lt;/SPAN&gt;
 }
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So after wandering for a while, I added the same&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;printf&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to the end of the kernel. When I did this, it was confirmed that&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;printf&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;works only for some pixel positions. For pixel positions not output by printf, the calculated values in the resulting image are incorrect, and as a result, I concluded that some kernel instances terminate abnormally before completing the calculations.&lt;/P&gt;
&lt;PRE class="lang-c s-code-block"&gt;&lt;CODE class="hljs language-c"&gt;__kernel &lt;SPAN class="hljs-type"&gt;void&lt;/SPAN&gt; &lt;SPAN class="hljs-title function_"&gt;GetValueOfB&lt;/SPAN&gt;&lt;SPAN class="hljs-params"&gt;(&lt;SPAN class="hljs-comment"&gt;/* parameters */&lt;/SPAN&gt;)&lt;/SPAN&gt;
{
    uint xB = get_global_id(&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;);
    uint yB = get_global_id(&lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;);
    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"(%d, %d)\n"&lt;/SPAN&gt;, xB, yB);

    &lt;SPAN class="hljs-comment"&gt;// calculation code is omitted&lt;/SPAN&gt;
   
    &lt;SPAN class="hljs-built_in"&gt;printf&lt;/SPAN&gt;(&lt;SPAN class="hljs-string"&gt;"(%d, %d)\n"&lt;/SPAN&gt;, xB, yB);
 }
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It seems that there is no problem with the calculation of the kernel.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;If I compile the kernel turning off the optimization with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;-cl-opt-disable&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;option, I get perfectly correct results for all images regardless of their size.&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;In addition to that, with NVIDA P4000, it works correct. Of course, in theses cases, I confirmed that the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;printf&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;added at the bottom of the Kernel works for all pixels.&lt;/P&gt;
&lt;P&gt;Below I put additional information and attach a part of the code I wrote.&lt;/P&gt;
&lt;P&gt;Any advice is welcomed and appreciated. Thank you.&lt;/P&gt;
&lt;P&gt;SDK: Intel® SDK For OpenCL™ Applications 2020.3.494&lt;/P&gt;
&lt;P&gt;Platform: Intel(R) OpenCL HD Graphics&lt;/P&gt;
&lt;PRE class="lang-c s-code-block"&gt;&lt;CODE class="hljs language-c"&gt; &lt;SPAN class="hljs-keyword"&gt;for&lt;/SPAN&gt; all images
 {
      ...

        &lt;SPAN class="hljs-keyword"&gt;const&lt;/SPAN&gt; &lt;SPAN class="hljs-type"&gt;size_t&lt;/SPAN&gt; globalSize[&lt;SPAN class="hljs-number"&gt;2&lt;/SPAN&gt;] = { &lt;SPAN class="hljs-type"&gt;size_t&lt;/SPAN&gt;(vtMatB_GPU_LLP[nLayerIndex].cols), &lt;SPAN class="hljs-type"&gt;size_t&lt;/SPAN&gt;(vtMatB_GPU_LLP[nLayerIndex].rows) };

        err = clEnqueueNDRangeKernel(_pOpenCLManager-&amp;gt;GetCommandQueue(), kernel, &lt;SPAN class="hljs-number"&gt;2&lt;/SPAN&gt;, 
              &lt;SPAN class="hljs-literal"&gt;NULL&lt;/SPAN&gt;, globalSize, &lt;SPAN class="hljs-literal"&gt;NULL&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="hljs-literal"&gt;NULL&lt;/SPAN&gt;, &lt;SPAN class="hljs-literal"&gt;NULL&lt;/SPAN&gt;);
        &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (CL_SUCCESS != err)
            &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; &lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt;;

        &lt;SPAN class="hljs-comment"&gt;// I tried with this but it didn't make any difference&lt;/SPAN&gt;
        &lt;SPAN class="hljs-comment"&gt;//std::this_thread::sleep_for(std::chrono::seconds(1));&lt;/SPAN&gt;

        err = clFinish(_pOpenCLManager-&amp;gt;GetCommandQueue());
        &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (CL_SUCCESS != err)
            &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; &lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt;;

        err = clEnqueueReadBuffer(_pOpenCLManager-&amp;gt;GetCommandQueue(), memMatB, CL_TRUE, 
              &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="hljs-keyword"&gt;sizeof&lt;/SPAN&gt;(&lt;SPAN class="hljs-type"&gt;float&lt;/SPAN&gt;) * vtMatB_GPU_LLP[nLayerIndex].cols * 
              vtMatB_GPU_LLP[nLayerIndex].rows, vtMatB_GPU_LLP[nLayerIndex].data, &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;, nullptr, nullptr);
        &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (CL_SUCCESS != err)
            &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; &lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt;;
      ...          
 }

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 07:26:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1386883#M478</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-05-24T07:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1387315#M483</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please provide us with a complete reproducer and the steps you have followed so that we can try it at our end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Noorjahan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 10:02:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1387315#M483</guid>
      <dc:creator>NoorjahanSk_Intel</dc:creator>
      <dc:date>2022-05-25T10:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1387648#M485</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your attention.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the link for minimum code to reproduce phenomenon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/heysweetethan/GPUOpenCLProjectforWindows" target="_blank"&gt;https://github.com/heysweetethan/GPUOpenCLProjectforWindows&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I really appreciate if you take a look.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Ethan Kim&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 08:12:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1387648#M485</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-05-26T08:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1388772#M490</link>
      <description>&lt;P class="sub_section_element_selectors"&gt;Hi,&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;I'm sorry but may I ask someone to take a look at this?&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;I'm still working on it but I cannot solve the issue myself.&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;Best Regards,&lt;/P&gt;
&lt;P class="sub_section_element_selectors"&gt;Ethan Kim&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 06:03:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1388772#M490</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-05-31T06:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389242#M493</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for providing the source code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have tried the reproducer that you have provided and we got some issues at runtime.&lt;/P&gt;
&lt;P&gt;when we run the code, the program just hangs and we cannot see any output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to the below screenshot:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NoorjahanSk_Intel_0-1654083742810.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/30116i651E31CEED0A01A9/image-size/medium?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="NoorjahanSk_Intel_0-1654083742810.png" alt="NoorjahanSk_Intel_0-1654083742810.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Could you please help us in reproducing your issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Noorjahan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:42:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389242#M493</guid>
      <dc:creator>NoorjahanSk_Intel</dc:creator>
      <dc:date>2022-06-01T11:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389440#M496</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your reply and for paying attention to my issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you "git clone &lt;A href="https://github.com/heysweetethan/GPUOpenCLProjectforWindows.git&amp;quot;" target="_blank" rel="noopener"&gt;https://github.com/heysweetethan/GPUOpenCLProjectforWindows.git"&lt;/A&gt;&amp;nbsp;, build it, and start it over again?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tested it again on another newly installed computer and checked that it runs(with errors in different way).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it still doesn't work on your side I will add more &lt;EM&gt;printf&lt;/EM&gt;s in cpp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And about the issue,&lt;/P&gt;
&lt;P&gt;I guess that the &lt;EM&gt;for&lt;/EM&gt; loop in the kernel code might cause the problem.&lt;/P&gt;
&lt;P&gt;On my second PC(i7-10700 CPU), &lt;EM&gt;clEnqueueNDRangeKernel&lt;/EM&gt; returns &lt;EM&gt;CL_OUT_OF_RESOURCES&lt;/EM&gt;. This is completely okay to me and I think I can handle it.&lt;/P&gt;
&lt;P&gt;But what I'm confused is that on my main PC(&lt;SPAN&gt;i9-9900 CPU), it just, instead of returning&amp;nbsp;&lt;EM&gt;CL_OUT_OF_RESOSURCES,&lt;/EM&gt; runs&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;in a way that I cannot understand.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know that it's not well designed kernel if there is a &lt;EM&gt;for&lt;/EM&gt; loop that iterates too many times in it and I need to modify the kernel so that it can&amp;nbsp; be distributed over processing elements or computer units. But I want to figure out why my kernel &lt;SPAN&gt;does not return &lt;EM&gt;CL_OUT_OF_RESOSURCES&lt;/EM&gt; and just runs awkwardly in i9-9900.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Ethan Kim&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 04:11:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389440#M496</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-06-02T04:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389479#M497</link>
      <description>&lt;P&gt;Hello, I don't think your kernel instance ends abruptly, rather I think it is taking a very long time to execute.&lt;/P&gt;
&lt;P&gt;A few things I noticed:&lt;/P&gt;
&lt;P&gt;1. Your ND-range dimensions are pretty small:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; clEnqueueNDRangeKernel( GetValueOfB &lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt; queue = 0000014CBD352BA0, kernel = 0000014CC1368090, global_work_size = &amp;lt; 12 x 12 &amp;gt;, local_work_size = &amp;lt; NULL &amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;Because the global work size is 12x12, you only have 144 work-items.&amp;nbsp; Even on a small integrated GPU this will only use a fraction of the GPU compute resources.&lt;/P&gt;
&lt;P&gt;2. The kernel contains a doubly-nested for loop.&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;for (int nY = 0; nY &amp;lt; nROIHeight; nY++)
{
	for (int nX = 0; nX &amp;lt; nROIWidth; nX++)
	{
            // loop body
	}
}
&lt;/LI-CODE&gt;
&lt;P&gt;By itself this isn't bad, but the loop bounds are quite large, so the loop body ends up executing several million times per work-item.&amp;nbsp; Furthermore, the loop body contains quite a bit of floating-point math, including several calls to the (rather expensive) double-precision pow() function.&lt;/P&gt;
&lt;P&gt;Taken together, this means that the few compute resources that are being used are being asked to do a LOT of work, and it's taking a very long time to complete.&lt;/P&gt;
&lt;P&gt;A few suggestions of things to try:&lt;/P&gt;
&lt;P&gt;a) If at all possible, try to use single-precision floating point math rather than double-precision (float rather than double).&amp;nbsp; Most GPUs will perform single-precision math significantly faster than double-precision math.&lt;/P&gt;
&lt;P&gt;Just (a) seems to be enough to run your kernel to completion, but here are a few other things to check that may also improve performance:&lt;/P&gt;
&lt;P&gt;b) If possible, can you replace some calls to pow() with calls to powr()?&lt;/P&gt;
&lt;P&gt;c) If you can tolerate lower precision, you can also try using the native powr() function or the -cl-fast-relaxed-math program build option.&lt;/P&gt;
&lt;P&gt;c) Can you use the built-in function smoothstep() vs. defining your own?&amp;nbsp; See&amp;nbsp;&lt;A href="https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#common-functions" target="_self"&gt;link&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;e) Is it possible to refactor your algorithm to add more work-items that individually do less work?&amp;nbsp; This won't be trivial, but this is likely to produce the biggest improvements.&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 06:23:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389479#M497</guid>
      <dc:creator>Ben_A_Intel</dc:creator>
      <dc:date>2022-06-02T06:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389491#M498</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, I really appreciate your reply.&lt;/P&gt;
&lt;P&gt;With all due respect, I would like to have some clarifications.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did not stop the program. Rather I waited until the program had stopped.&lt;/P&gt;
&lt;P&gt;Having this in mind, I have two questions,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1) If I did not make a wrong code(regarding&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;clFinish&lt;/EM&gt; or something)&lt;/SPAN&gt; , is there inherent limitation regarding kernel execution time?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 2) Why can I make the program run correctly if I compile the kernel with '&lt;SPAN&gt;-cl-opt-disable' although it presumably takes more time for kernel to execute.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Ethan Kim&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 07:52:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389491#M498</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-06-02T07:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389576#M500</link>
      <description>&lt;P&gt;Good questions!&lt;/P&gt;
&lt;P&gt;(1) Regarding an upper-bound kernel execution time, this actually gets a little complicated.&amp;nbsp; It depends whether your kernel can be preempted, and this can depend on both your kernel and the hardware you are running on.&amp;nbsp; The short answer is that the operating system will try to preempt your kernel to let other things run if it is taking too long to execute.&amp;nbsp; If the preemption is successful, the kernel can effectively run for an unbounded amount of time.&amp;nbsp; If the preemption is unsuccessful though (and there can be many reasons for this), the operating system will stop your kernel and reset the device so e.g. the GUI remains responsive.&lt;/P&gt;
&lt;P&gt;(2) Regarding disabling optimizations, I am unable to reproduce this behavior, and I still see the very long execution when using -cl-opt-disable.&amp;nbsp; Are you sure something else isn't going on here?&lt;/P&gt;
&lt;P&gt;I'm very interested to see if you are able to run the kernel in finite time on an integrated if you use single-precision calculations.&amp;nbsp; Have you been able to try this?&amp;nbsp; Should be as simple as a search-and-replace of "double" with "float" and then maybe fixing up a few double-precision literals (or using&amp;nbsp;&lt;SPAN&gt;-cl-single-precision-constant).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 14:34:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389576#M500</guid>
      <dc:creator>Ben_A_Intel</dc:creator>
      <dc:date>2022-06-02T14:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389705#M501</link>
      <description>&lt;P&gt;Once again, thank you for spending your invaluable time to help me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually before I posted the first question, I had done the test with float instead of double and confirmed it worked correctly(with less accuracy).&lt;/P&gt;
&lt;P&gt;But I wanted to figure out why the code with double was not running the way I expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, I think I need to investigate the behavior of the codes more on my own.&lt;/P&gt;
&lt;P&gt;I will try to use GDB debugger if I can learn anything from using it.&lt;/P&gt;
&lt;P&gt;Actually I tried GDB debugger but it didn't go like 'Set Up Intel® Distribution for GDB* to Debug GPUs on Windows*'.&lt;/P&gt;
&lt;P&gt;That's&amp;nbsp;because I failed to start '&lt;SPAN&gt;gdbserver-gt'&amp;nbsp; although I referred to 'trouble shooting'. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I might need to ask another question&amp;nbsp; regarding GDB debugger.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, one more question. I really appreciated if you give me any opinion on this.&lt;/P&gt;
&lt;P&gt;I was stunned to see the same program(with double) run correctly after installing&amp;nbsp; GDB debugger(oneAPI\debugger\latest\target\gen_debugger_target.msi).&lt;/P&gt;
&lt;P&gt;I swear there was nothing else other than installing GDB.&lt;/P&gt;
&lt;P&gt;I did the test three times install/uninstalling GDB(with reboot) and running the program.&lt;/P&gt;
&lt;P&gt;I'm sure the debugger make a difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Ethan Kim&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 00:47:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1389705#M501</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-06-03T00:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1392715#M525</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/237900"&gt;@heysweetethan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;By the way, one more question. I really appreciated if you give me any opinion on this.&lt;/P&gt;
&lt;P&gt;I was stunned to see the same program(with double) run correctly after installing&amp;nbsp; GDB debugger(oneAPI\debugger\latest\target\gen_debugger_target.msi).&lt;/P&gt;
&lt;P&gt;I swear there was nothing else other than installing GDB.&lt;/P&gt;
&lt;P&gt;I did the test three times install/uninstalling GDB(with reboot) and running the program.&lt;/P&gt;
&lt;P&gt;I'm sure the debugger make a difference.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is a mystery I can't explain, so I've asked a couple of our debugger folks why this might be happening.&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 15:17:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1392715#M525</guid>
      <dc:creator>Ben_A_Intel</dc:creator>
      <dc:date>2022-06-15T15:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1392832#M527</link>
      <description>&lt;P&gt;Thank you for your reply.&lt;BR /&gt;However, I’m not going to be obsessed on this anymore.&amp;nbsp; Actually I spent 'a lot of time' on this and I've been being so obsessed on this.&lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the beginning I’ve posted a question because I think I made a problem by making a wrong code regarding OpenCL things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I concluded that basic rules were abided by in my code and I cautiously suggest a probability of an issue in 'Intel SDK for OpenCL' which only happens in impractical situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I meant, by ‘impractical situation’, for example as you pointed out, a doubly-nested for loop which iterates 9 million times in a single kernel instance which runs much faster in CPU code(I did not have intention to use it at all but I sticked to this code just for curiosity). I think this made all the messes I experienced.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure that does not happen in practical GPU code and I will continue to convert my CPU algorithm to OpenCL GPU version.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I really appreciate all the helps.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 01:53:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1392832#M527</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-06-16T01:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393163#M528</link>
      <description>&lt;P&gt;Since I know how frustrating it can be to be "obsessed" without closure, our current theory as to what is happening here is that something is going awry with preemption, which is causing the kernel to run forever.&amp;nbsp; The debugger part was an important clue, because one of the things that the debugger installer does is to disable preemption, thereby allowing the kernel to be debugged.&lt;/P&gt;
&lt;P&gt;If you want to experiment more with this directly, please see:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/windows-hardware/drivers/display/changing-the-behavior-of-the-gpu-scheduler-for-debugging" target="_blank"&gt;https://docs.microsoft.com/en-us/windows-hardware/drivers/display/changing-the-behavior-of-the-gpu-scheduler-for-debugging&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 20:50:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393163#M528</guid>
      <dc:creator>Ben_A_Intel</dc:creator>
      <dc:date>2022-06-16T20:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393278#M530</link>
      <description>&lt;P&gt;Finally done!!! Thank you so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By setting TdrLevel=0, I could solve my problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just for others who may concern about this, I put links below.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys" target="_blank"&gt;https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.pugetsystems.com/labs/hpc/Working-around-TDR-in-Windows-for-a-better-GPU-computing-experience-777/" target="_blank"&gt;https://www.pugetsystems.com/labs/hpc/Working-around-TDR-in-Windows-for-a-better-GPU-computing-experience-777/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although the phenomenon with '-&lt;SPAN&gt;cl-opt-disable' is still curious to me, now I might be able to delve into it myself.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 04:17:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393278#M530</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-06-17T04:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393292#M533</link>
      <description>&lt;P&gt;Just FYI, there's one last thing to consider.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PC1 with&amp;nbsp;&lt;I&gt;i7-10700 : &lt;EM class="sub_section_element_selectors"&gt;clEnqueueNDRangeKernel&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;returns&amp;nbsp;&lt;EM class="sub_section_element_selectors"&gt;CL_OUT_OF_RESOURCES(-5) when TDR steps in.&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&lt;EM class="sub_section_element_selectors"&gt;PC2 with i9-9900: clEnqueueNDRangeKernel&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;return CL_SUCCESS(0) even if TDR steps in.&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&lt;EM class="sub_section_element_selectors"&gt;Thank you.&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&lt;EM class="sub_section_element_selectors"&gt;Best Regards,&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&lt;EM class="sub_section_element_selectors"&gt;Ethan Kim&lt;/EM&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 04:53:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393292#M533</guid>
      <dc:creator>heysweetethan</dc:creator>
      <dc:date>2022-06-17T04:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: It's like OpenCL kernel instance ends abruptly</title>
      <link>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393384#M536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for sharing the solution with us.&lt;/P&gt;
&lt;P&gt;Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Noorjahan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 10:54:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/GPU-Compute-Software/It-s-like-OpenCL-kernel-instance-ends-abruptly/m-p/1393384#M536</guid>
      <dc:creator>NoorjahanSk_Intel</dc:creator>
      <dc:date>2022-06-17T10:54:51Z</dc:date>
    </item>
  </channel>
</rss>

