<?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 Handle many kernel arguments in OCL Kernel in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Handle-many-kernel-arguments-in-OCL-Kernel/m-p/1048811#M3989</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;

&lt;P&gt;I am developing an OpenCL kernel for particle simulation and I face a problem. I have to transfer a lot of arguments to the device (I have not counted properly, but from the original code it could be more than 20 or 30 float arrays). Could you suggest me a way to handle properly such amount of arguments without having to call clSetKernelArgument() and clEnqueueWriteBuffer() more than 20 times?.&lt;/P&gt;

&lt;P&gt;The original code was written in Fortran, where the data was stored inside COMMON blocks, therefore one approach that I used was to use Fortran/C interoperability and store the arguments inside the proper structs and then pass the structs to the kernel. I wrote a C source file to handle all the OpenCL execution and then I return the results to the Fortran code for post-processing... what would you suggest to me?&lt;/P&gt;

&lt;P&gt;Thanks for your help!, best regards!&lt;/P&gt;</description>
    <pubDate>Thu, 12 Mar 2015 17:30:05 GMT</pubDate>
    <dc:creator>Edgardo_Doerner</dc:creator>
    <dc:date>2015-03-12T17:30:05Z</dc:date>
    <item>
      <title>Handle many kernel arguments in OCL Kernel</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Handle-many-kernel-arguments-in-OCL-Kernel/m-p/1048811#M3989</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;

&lt;P&gt;I am developing an OpenCL kernel for particle simulation and I face a problem. I have to transfer a lot of arguments to the device (I have not counted properly, but from the original code it could be more than 20 or 30 float arrays). Could you suggest me a way to handle properly such amount of arguments without having to call clSetKernelArgument() and clEnqueueWriteBuffer() more than 20 times?.&lt;/P&gt;

&lt;P&gt;The original code was written in Fortran, where the data was stored inside COMMON blocks, therefore one approach that I used was to use Fortran/C interoperability and store the arguments inside the proper structs and then pass the structs to the kernel. I wrote a C source file to handle all the OpenCL execution and then I return the results to the Fortran code for post-processing... what would you suggest to me?&lt;/P&gt;

&lt;P&gt;Thanks for your help!, best regards!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 17:30:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Handle-many-kernel-arguments-in-OCL-Kernel/m-p/1048811#M3989</guid>
      <dc:creator>Edgardo_Doerner</dc:creator>
      <dc:date>2015-03-12T17:30:05Z</dc:date>
    </item>
    <item>
      <title>Dear Edgardo,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Handle-many-kernel-arguments-in-OCL-Kernel/m-p/1048812#M3990</link>
      <description>&lt;P&gt;Dear Edgardo,&lt;/P&gt;

&lt;P&gt;1. You don't need to do clEnqueueWriteBuffer if you use aligned allocations (e.g. aligned_malloc) with 4096 byte alignment&amp;nbsp;and create your buffers with CL_USE_HOST_PTR and make sure their sizes are multiples of 64 (cacheline size)&amp;nbsp;if you target Intel Processor Graphics. You will need to do a lot of clSetKernelArgument calls still.&lt;/P&gt;

&lt;P&gt;2. You can put all of your data into one huge buffer and then pass that buffer and the struct with offsets.&lt;/P&gt;

&lt;P&gt;3. You can do a combination of 1. and 2.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 18:53:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Handle-many-kernel-arguments-in-OCL-Kernel/m-p/1048812#M3990</guid>
      <dc:creator>Robert_I_Intel</dc:creator>
      <dc:date>2015-03-12T18:53:10Z</dc:date>
    </item>
    <item>
      <title>thanks for the suggestion ;)</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Handle-many-kernel-arguments-in-OCL-Kernel/m-p/1048813#M3991</link>
      <description>&lt;P&gt;thanks for the suggestion ;)&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 17:00:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Handle-many-kernel-arguments-in-OCL-Kernel/m-p/1048813#M3991</guid>
      <dc:creator>Edgardo_Doerner</dc:creator>
      <dc:date>2015-03-18T17:00:07Z</dc:date>
    </item>
  </channel>
</rss>

