<?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 How to pass nd_item&amp;lt;1&amp;gt; to h.single_task lambda function or any other methods? in Software Tuning, Performance Optimization &amp; Platform Monitoring</title>
    <link>https://community.intel.com/t5/Software-Tuning-Performance/How-to-pass-nd-item-lt-1-gt-to-h-single-task-lambda-function-or/m-p/1400970#M8082</link>
    <description>&lt;P&gt;Hi support team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using oneapi devcloud fpga hardwares and other devices now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my code, if i want to modify&amp;nbsp;lambda function from&amp;nbsp;h.parallel_for to&amp;nbsp;h.single_task beause i wanna run it on fpga hw.&lt;/P&gt;
&lt;P&gt;If it can be modified to h.single_task, I need to use nd_item&amp;lt;1&amp;gt; class, but it seems h.single_task cannot pass parameter. So how can i modify it? i need to get the values of&amp;nbsp;get_local_id(0),&amp;nbsp;get_group(0) and&amp;nbsp;&amp;nbsp;get_local_range(0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fragments of my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;h.parallel_for&amp;lt;class bude_kernel&amp;gt;(nd_range&amp;lt;1&amp;gt;(global, wgSize), [=](nd_item&amp;lt;1&amp;gt; item) {&lt;/P&gt;
&lt;P&gt;const size_t lid = item.get_local_id(0);&lt;BR /&gt;const size_t gid = item.get_group(0);&lt;BR /&gt;const size_t lrange = item.get_local_range(0);&lt;/P&gt;
&lt;P&gt;float etot[NUM_TD_PER_THREAD];&lt;BR /&gt;cl::sycl::float3 lpos[NUM_TD_PER_THREAD];&lt;BR /&gt;cl::sycl::float4 transform[NUM_TD_PER_THREAD][3];&lt;/P&gt;
&lt;P&gt;size_t ix = gid * lrange * NUM_TD_PER_THREAD + lid;&lt;BR /&gt;ix = ix &amp;lt; nposes ? ix : nposes - NUM_TD_PER_THREAD;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;</description>
    <pubDate>Sun, 17 Jul 2022 15:31:14 GMT</pubDate>
    <dc:creator>Wei-Chih</dc:creator>
    <dc:date>2022-07-17T15:31:14Z</dc:date>
    <item>
      <title>How to pass nd_item&lt;1&gt; to h.single_task lambda function or any other methods?</title>
      <link>https://community.intel.com/t5/Software-Tuning-Performance/How-to-pass-nd-item-lt-1-gt-to-h-single-task-lambda-function-or/m-p/1400970#M8082</link>
      <description>&lt;P&gt;Hi support team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using oneapi devcloud fpga hardwares and other devices now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my code, if i want to modify&amp;nbsp;lambda function from&amp;nbsp;h.parallel_for to&amp;nbsp;h.single_task beause i wanna run it on fpga hw.&lt;/P&gt;
&lt;P&gt;If it can be modified to h.single_task, I need to use nd_item&amp;lt;1&amp;gt; class, but it seems h.single_task cannot pass parameter. So how can i modify it? i need to get the values of&amp;nbsp;get_local_id(0),&amp;nbsp;get_group(0) and&amp;nbsp;&amp;nbsp;get_local_range(0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;fragments of my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;h.parallel_for&amp;lt;class bude_kernel&amp;gt;(nd_range&amp;lt;1&amp;gt;(global, wgSize), [=](nd_item&amp;lt;1&amp;gt; item) {&lt;/P&gt;
&lt;P&gt;const size_t lid = item.get_local_id(0);&lt;BR /&gt;const size_t gid = item.get_group(0);&lt;BR /&gt;const size_t lrange = item.get_local_range(0);&lt;/P&gt;
&lt;P&gt;float etot[NUM_TD_PER_THREAD];&lt;BR /&gt;cl::sycl::float3 lpos[NUM_TD_PER_THREAD];&lt;BR /&gt;cl::sycl::float4 transform[NUM_TD_PER_THREAD][3];&lt;/P&gt;
&lt;P&gt;size_t ix = gid * lrange * NUM_TD_PER_THREAD + lid;&lt;BR /&gt;ix = ix &amp;lt; nposes ? ix : nposes - NUM_TD_PER_THREAD;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jul 2022 15:31:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Tuning-Performance/How-to-pass-nd-item-lt-1-gt-to-h-single-task-lambda-function-or/m-p/1400970#M8082</guid>
      <dc:creator>Wei-Chih</dc:creator>
      <dc:date>2022-07-17T15:31:14Z</dc:date>
    </item>
  </channel>
</rss>

