<?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 CPU  OpenCL work-items in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/CPU-OpenCL-work-items/m-p/1128742#M5692</link>
    <description>&lt;P&gt;What is the meaning of having a certain number of OpenCL work-items into a CPU?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying tu understand why I could have more work-items in a CPU than a GPU in one dimension.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;== CPU ==&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE_VENDOR: Intel&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE NAME: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF PARALLAEL COMPUTE UNITS: 4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM DIMENSIONS FOR THE GLOBAL/LOCAL WORK ITEM IDs: 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN EACH DIMENSION: (1024 1 1 &amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN A WORK-GROUP: 1024&lt;/P&gt;&lt;P&gt;== GPU ==&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE_VENDOR: Intel Inc.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE NAME: Intel(R) Iris(TM) Graphics 6100&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF PARALLAEL COMPUTE UNITS: 48&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM DIMENSIONS FOR THE GLOBAL/LOCAL WORK ITEM IDs: 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN EACH DIMENSION: (256 256 256 &amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN A WORK-GROUP: 256&lt;/P&gt;&lt;P&gt;The above is the result of my test code to print the information of the actual hardware that the OpenCL framework can use.&lt;/P&gt;&lt;P&gt;I really do not understand why the value of 1024 in the Maximum number of work-items in the CPU section. What is the real meaning of having that amount of work-items? What is the meaning of 1024 work-items into a 4-core&amp;nbsp;CPU?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2019 15:19:17 GMT</pubDate>
    <dc:creator>Juan_G_1</dc:creator>
    <dc:date>2019-04-15T15:19:17Z</dc:date>
    <item>
      <title>CPU  OpenCL work-items</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CPU-OpenCL-work-items/m-p/1128742#M5692</link>
      <description>&lt;P&gt;What is the meaning of having a certain number of OpenCL work-items into a CPU?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying tu understand why I could have more work-items in a CPU than a GPU in one dimension.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;== CPU ==&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE_VENDOR: Intel&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE NAME: Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF PARALLAEL COMPUTE UNITS: 4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM DIMENSIONS FOR THE GLOBAL/LOCAL WORK ITEM IDs: 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN EACH DIMENSION: (1024 1 1 &amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN A WORK-GROUP: 1024&lt;/P&gt;&lt;P&gt;== GPU ==&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE_VENDOR: Intel Inc.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;DEVICE NAME: Intel(R) Iris(TM) Graphics 6100&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF PARALLAEL COMPUTE UNITS: 48&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM DIMENSIONS FOR THE GLOBAL/LOCAL WORK ITEM IDs: 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN EACH DIMENSION: (256 256 256 &amp;nbsp;)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;MAXIMUM NUMBER OF WORK-ITEMS IN A WORK-GROUP: 256&lt;/P&gt;&lt;P&gt;The above is the result of my test code to print the information of the actual hardware that the OpenCL framework can use.&lt;/P&gt;&lt;P&gt;I really do not understand why the value of 1024 in the Maximum number of work-items in the CPU section. What is the real meaning of having that amount of work-items? What is the meaning of 1024 work-items into a 4-core&amp;nbsp;CPU?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 15:19:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CPU-OpenCL-work-items/m-p/1128742#M5692</guid>
      <dc:creator>Juan_G_1</dc:creator>
      <dc:date>2019-04-15T15:19:17Z</dc:date>
    </item>
    <item>
      <title>Hi JuanG,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/CPU-OpenCL-work-items/m-p/1128743#M5693</link>
      <description>&lt;P&gt;Hi JuanG,&lt;/P&gt;&lt;P&gt;Thanks for the question and the interest in heterogeneous programming.&lt;/P&gt;&lt;P&gt;The number of OpenCL workitems available per workgroup does not necessarily have a linear relationship to the number of cores of an Intel processor nor the cores reported by an OpenCL runtime. The reason is two fold.&lt;/P&gt;&lt;P&gt;1) The microarchitecture on different devices may be different.&lt;/P&gt;&lt;P&gt;2) The built OpenCL program may exhibit different residency and transfer characteristics that can affect performance. Runtimes have some flexibility in&amp;nbsp;scheduling&amp;nbsp;work on the target as they see fit... and this is&amp;nbsp;transparent to the program calling them.&lt;/P&gt;&lt;P&gt;Your posted OpenCL runtimes employ their own methods to stage work to an OpenCL device that vary by platform and cl_kernel&amp;nbsp;... So programmers are recommended two heuristics:&lt;/P&gt;&lt;P&gt;1) Start from scheduling as much work as possible to the target device. Stage the number of workitems&amp;nbsp;dynamically. Use API call feedback to assist with scheduling sizing (see notes below). Let the Intel runtime compile and do the scheduling and affinitization work.&lt;/P&gt;&lt;P&gt;2) Minimize offload transfers... Composite buffers and transfer them in one shot if possible. Use zero copy where possible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reference:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp; &amp;nbsp;&lt;A href="https://software.intel.com/en-us/articles/getting-the-most-from-opencl-12-how-to-increase-performance-by-minimizing-buffer-copies-on-intel-processor-graphics"&gt;Zero Copy Reference&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Intel employees put effort into tuning these platforms. As such, feedback that shows a gap in expectations is appreciated as it allows the product to be improved.... and for Intel Graphics ... especially if provided to the github portal directly&amp;nbsp;for Windows OS or Linux OS. For Intel CPU runtime this forum is a good location to comment on issues.&lt;/P&gt;&lt;P&gt;Note two closely related API provisions:&lt;BR /&gt;1) &lt;STRONG&gt;clGetKernelWorkGroupInfo(...)&lt;/STRONG&gt; with &lt;STRONG&gt;CL_KERNEL_WORK_GROUP_SIZE&lt;/STRONG&gt;&lt;BR /&gt;This will give you the maximum workgroup size for the kernel object on that device. Logically this should be less than or equal to the value &lt;STRONG&gt;clGetDeviceInfo(...)&lt;/STRONG&gt; provides from &lt;STRONG&gt;CL_DEVICE_MAX_WORK_GROUP_SIZE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2) &lt;STRONG&gt;clGetKernelWorkGroupInfo(...)&lt;/STRONG&gt; with &lt;STRONG&gt;CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE&lt;/STRONG&gt;&lt;BR /&gt;Can't think of a reason this shouldn't be used unless there is a 'tail' of a data set to try to execute.&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/clGetKernelWorkGroupInfo.html"&gt;clGetKernelWorkGroupInfo Reference&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/clGetDeviceInfo.html"&gt;clGetDeviceInfo Reference&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Note that for most best cases for any library, a compiler and runtime scheduler will saturate the compute available in each vector lane of the device. The compiler will analyse the source to choose it's best known vector operation that could apply to a particular source code line. Within the context of Intel® Core™ i5-5257U CPU Runtime, for the CPU case the runtime could leverage AVX[2] vector instructions. Newer Intel CPUs have wider vector widths that will in some cases see each vector lane of an AVX512 instruction filled for compute. AVX512 functionality is one of the key features in the CPU runtime released most recently.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://software.intel.com/en-us/articles/opencl-runtime-release-notes"&gt;CPU RT release notes&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://www.intel.com/content/www/us/en/architecture-and-technology/avx-512-overview.html"&gt;AVX512 overview&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In the noted case observe that the CPU in use is 2 core 4 thread (assuming Intel Hyper Threading technology is on). The example program you mentioned suggests the CPU runtime enumerates 4 compute units. I don't have a machine to check immediately, but I would suspect if HT was turned off only two compute units would be enumerated.&lt;/P&gt;&lt;P&gt;If you're interested in getting a better feel for the capabilities of Intel Graphics devices with respect to programming, I recommend the training video composed by Adam Herr, one of Intel's leaders in heterogeneous compute. I expect the video to still be useful for developers targeting just the CPU runtime as well. Herr discusses general principles that extend beyond Graphics devices.&lt;/P&gt;&lt;P&gt;Reference&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://techdecoded.intel.io/essentials/what-intel-processor-graphics-gen9-unlocks-in-opencl/"&gt;Video Reference&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;-MichaelC&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 23:34:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/CPU-OpenCL-work-items/m-p/1128743#M5693</guid>
      <dc:creator>Michael_C_Intel1</dc:creator>
      <dc:date>2019-04-16T23:34:58Z</dc:date>
    </item>
  </channel>
</rss>

