<?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 lambda for TBB parallel_for in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/lambda-for-TBB-parallel-for/m-p/743433#M1302</link>
    <description>Is it possible to pass a lambda function into 'parallel_for' instead of Body object?&lt;BR /&gt;This is an example of what I would like to do:&lt;BR /&gt; &lt;BR /&gt;auto procEachRowL = [this, &amp;amp;imageOut, &amp;amp;imWB](const tbb::blocked_range&lt;SIZE_T&gt; &amp;amp;r){ &lt;BR /&gt; for (size_t i=r.begin(); i&lt;R.END&gt;&lt;/R.END&gt; this-&amp;gt;ProcessEachRow(i, imageOut, imWB); };&lt;BR /&gt;&lt;BR /&gt; parallel_for(blocked_range&lt;INT&gt;(0, yMax, 1), procEachRowL); // Syntax error here&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;/INT&gt;&lt;/SIZE_T&gt;</description>
    <pubDate>Fri, 23 Oct 2009 01:13:51 GMT</pubDate>
    <dc:creator>Goran_N</dc:creator>
    <dc:date>2009-10-23T01:13:51Z</dc:date>
    <item>
      <title>lambda for TBB parallel_for</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-for-TBB-parallel-for/m-p/743433#M1302</link>
      <description>Is it possible to pass a lambda function into 'parallel_for' instead of Body object?&lt;BR /&gt;This is an example of what I would like to do:&lt;BR /&gt; &lt;BR /&gt;auto procEachRowL = [this, &amp;amp;imageOut, &amp;amp;imWB](const tbb::blocked_range&lt;SIZE_T&gt; &amp;amp;r){ &lt;BR /&gt; for (size_t i=r.begin(); i&lt;R.END&gt;&lt;/R.END&gt; this-&amp;gt;ProcessEachRow(i, imageOut, imWB); };&lt;BR /&gt;&lt;BR /&gt; parallel_for(blocked_range&lt;INT&gt;(0, yMax, 1), procEachRowL); // Syntax error here&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;/INT&gt;&lt;/SIZE_T&gt;</description>
      <pubDate>Fri, 23 Oct 2009 01:13:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-for-TBB-parallel-for/m-p/743433#M1302</guid>
      <dc:creator>Goran_N</dc:creator>
      <dc:date>2009-10-23T01:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: lambda for TBB parallel_for</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-for-TBB-parallel-for/m-p/743434#M1303</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/427384"&gt;Goran N&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;auto procEachRowL = [this, &amp;amp;imageOut, &amp;amp;imWB](const tbb::blocked_range&lt;SIZE_T&gt; &amp;amp;r){ &lt;BR /&gt;for (size_t i=r.begin(); i&lt;R.END&gt;&lt;/R.END&gt;this-&amp;gt;ProcessEachRow(i, imageOut, imWB); };&lt;BR /&gt;&lt;BR /&gt;parallel_for(blocked_range&lt;INT&gt;(0, yMax, 1), procEachRowL); // Syntax error here&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;/INT&gt;&lt;/SIZE_T&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;I used NQ example and it works fine for me. &lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;[cpp]void solve() { 
	auto forPar_For = 
 [](const blocked_range&lt;SIZE_T&gt; &amp;amp;r){ 
      for (size_t i = r.begin(); i != r.end(); ++i) { 
      setQueen(new int[size], 0, (int)i); 
         }; 
      };

	parallel_for(blocked_range&lt;SIZE_T&gt;(0, size, 1), forPar_For);
}
[/cpp]&lt;/SIZE_T&gt;&lt;/SIZE_T&gt;&lt;/PRE&gt;
&lt;BR /&gt;I'm using the Parallel Composer update2-revised. &lt;BR /&gt;&lt;BR /&gt;Jennifer</description>
      <pubDate>Fri, 23 Oct 2009 23:40:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-for-TBB-parallel-for/m-p/743434#M1303</guid>
      <dc:creator>JenniferJ</dc:creator>
      <dc:date>2009-10-23T23:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: lambda for TBB parallel_for</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-for-TBB-parallel-for/m-p/743435#M1304</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;My syntax error was coming from:&lt;BR /&gt;&lt;BR /&gt;parallel_for(blocked_range&amp;lt;&lt;STRONG&gt;int&lt;/STRONG&gt;&amp;gt;...&lt;BR /&gt;&lt;BR /&gt;instead of:&lt;BR /&gt;&lt;BR /&gt;parallel_for(blocked_range&amp;lt;&lt;STRONG&gt;size_t&lt;/STRONG&gt;&amp;gt;...&lt;BR /&gt;&lt;BR /&gt;Now it works correctly. Thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/334919"&gt;Jennifer Jiang (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt; &lt;BR /&gt;I used NQ example and it works fine for me. &lt;BR /&gt;&lt;BR /&gt;
&lt;/EM&gt;&lt;PRE&gt;&lt;EM&gt;[cpp]void solve() { &lt;BR /&gt;	auto forPar_For = &lt;BR /&gt; [](const blocked_range&lt;SIZE_T&gt; &amp;amp;r){ &lt;BR /&gt;      for (size_t i = r.begin(); i != r.end(); ++i) { &lt;BR /&gt;      setQueen(new int[size], 0, (int)i); &lt;BR /&gt;         }; &lt;BR /&gt;      };&lt;BR /&gt;&lt;BR /&gt;	parallel_for(blocked_range&lt;SIZE_T&gt;(0, size, 1), forPar_For);&lt;BR /&gt;}&lt;BR /&gt;[/cpp]&lt;/SIZE_T&gt;&lt;/SIZE_T&gt;&lt;/EM&gt;&lt;/PRE&gt;
&lt;BR /&gt;I'm using the Parallel Composer update2-revised. &lt;BR /&gt;&lt;BR /&gt;Jennifer&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Oct 2009 04:00:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-for-TBB-parallel-for/m-p/743435#M1304</guid>
      <dc:creator>Goran_N</dc:creator>
      <dc:date>2009-10-29T04:00:00Z</dc:date>
    </item>
  </channel>
</rss>

