<?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 use for TBB in Parallel Studio in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744623#M1708</link>
    <description>Yes, use of &amp;amp; in the context specification sets the default linkage for symbols found in the lambda expression that are defined in the enclosing scope to reference semantics: the variable visible in the expression will be a reference to the actual variable rather than a copy to be used within the lambda construction. If the arrays were big enough or the computation run long enough, you should notice a performance boost by avoiding copying the arrays with each invocation. And if you actually cared about the results of your matrix multiply, you might notice using [=] thatthey're allwrong! ;-)</description>
    <pubDate>Tue, 22 Jun 2010 17:00:34 GMT</pubDate>
    <dc:creator>robert-reed</dc:creator>
    <dc:date>2010-06-22T17:00:34Z</dc:date>
    <item>
      <title>lambda use for TBB in Parallel Studio</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744618#M1703</link>
      <description>I'm using Intel Parallel Studio SP1 within Visual Studio 2008 and cannot get the compiler (v. 11.1.071 [IA-32]) to recognize the lambda expression within a TBB parallel_for. Using several different documentation resources, I've settled on the following code (for matrix multiplication):&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;parallel_for(blocked_range&lt;SIZE_T&gt;&lt;SIZE_T&gt;&lt;/SIZE_T&gt;&lt;SIZE_T&gt;&lt;/SIZE_T&gt;(0, m, 1), &lt;BR /&gt; [=](const blocked_range&lt;SIZE_T&gt;&lt;SIZE_T&gt;&lt;/SIZE_T&gt;&lt;SIZE_T&gt;&lt;/SIZE_T&gt;&amp;amp; r){ // use lambda facility of TBB 3.0 &lt;BR /&gt; for (size_t i = r.begin(); i &amp;lt; r.end(); i++) &lt;BR /&gt; for (int j = 0; j &amp;lt; n; j++){ &lt;BR /&gt; C&lt;I&gt;&lt;J&gt;=0;&lt;BR /&gt;for (int k = 0; k &amp;lt; p; k++) &lt;BR /&gt; C&lt;I&gt;&lt;J&gt; += A&lt;I&gt;&lt;K&gt;*B&lt;K&gt;&lt;J&gt;; &lt;BR /&gt; }&lt;BR /&gt;}, auto_partitioner());&lt;BR /&gt;&lt;BR /&gt;&lt;/J&gt;&lt;/K&gt;&lt;/K&gt;&lt;/I&gt;&lt;/J&gt;&lt;/I&gt;&lt;/J&gt;&lt;/I&gt;&lt;/SIZE_T&gt;&lt;/SIZE_T&gt;&lt;/CODE&gt;&lt;I&gt;&lt;I&gt;&lt;I&gt;I keep getting a compiler error ".\\MMmult.cpp(36): error: expected an expression" pointing to the open square bracket of the lambda. I've tried without the '=' and putting the lambda in a separate declaration (as was pointed out in an earlier forum post). All with the same negative results.&lt;BR /&gt;&lt;BR /&gt;Any advice on what I'm doing wrong or what might be missing?&lt;BR /&gt;&lt;BR /&gt;--clay&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;</description>
      <pubDate>Mon, 21 Jun 2010 17:07:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744618#M1703</guid>
      <dc:creator>ClayB</dc:creator>
      <dc:date>2010-06-21T17:07:35Z</dc:date>
    </item>
    <item>
      <title>lambda use for TBB in Parallel Studio</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744619#M1704</link>
      <description>Did you turn it on?&lt;BR /&gt;&lt;BR /&gt;/Qstd=c++0x, or go to the appropriate compiler configuration page to enable the C++0x extensions.</description>
      <pubDate>Mon, 21 Jun 2010 17:10:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744619#M1704</guid>
      <dc:creator>robert-reed</dc:creator>
      <dc:date>2010-06-21T17:10:45Z</dc:date>
    </item>
    <item>
      <title>lambda use for TBB in Parallel Studio</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744620#M1705</link>
      <description>p.s., While TBB from version 2.2 forward has had support for selected parallel constructs that take advantage of lambda expressions, lambdas are really an attribute of the compiler.&lt;BR /&gt;&lt;BR /&gt;p.p.s TBB 3.0 uses auto_partitioner as the default argument, so you could drop the autopartitioner argument for brevity and clarity.&lt;BR /&gt;&lt;BR /&gt;p.p.p.s You might want to consider reference sematics for the arrays referenced inside the lambda expression, rather than using the copy semantics ("[=]") used in the example: I think you want to use the arrays in place, shared among the threads rather than having each threadmake their own private copy.</description>
      <pubDate>Mon, 21 Jun 2010 17:25:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744620#M1705</guid>
      <dc:creator>robert-reed</dc:creator>
      <dc:date>2010-06-21T17:25:11Z</dc:date>
    </item>
    <item>
      <title>lambda use for TBB in Parallel Studio</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744621#M1706</link>
      <description>&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1277215100032="81" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=336004" href="https://community.intel.com/en-us/profile/336004/" class="basic"&gt;Robert Reed (Intel)&lt;/A&gt;&lt;/DIV&gt;&lt;DIV style="background-color: #e5e5e5; margin-left: 2px; margin-right: 2px; border: 1px inset; padding: 5px;"&gt;&lt;I&gt;Did you turn it on?&lt;BR /&gt;&lt;BR /&gt;/Qstd=c++0x, or go to the appropriate compiler configuration page to enable the C++0x extensions.&lt;/I&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;Aha, that was the missing piece. Thank you, Robert.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2010 13:59:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744621#M1706</guid>
      <dc:creator>ClayB</dc:creator>
      <dc:date>2010-06-22T13:59:33Z</dc:date>
    </item>
    <item>
      <title>lambda use for TBB in Parallel Studio</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744622#M1707</link>
      <description>Not being a C++ programmer and not having read anything about the syntax or semantics of lambda's, I was just copying examples from other codes. &lt;BR /&gt;&lt;BR /&gt;I've used the '[&amp;amp;]' notation. Is this the reference semantics? The execution seem faster with the ampersand instead of the equal sign.</description>
      <pubDate>Tue, 22 Jun 2010 14:02:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744622#M1707</guid>
      <dc:creator>ClayB</dc:creator>
      <dc:date>2010-06-22T14:02:28Z</dc:date>
    </item>
    <item>
      <title>lambda use for TBB in Parallel Studio</title>
      <link>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744623#M1708</link>
      <description>Yes, use of &amp;amp; in the context specification sets the default linkage for symbols found in the lambda expression that are defined in the enclosing scope to reference semantics: the variable visible in the expression will be a reference to the actual variable rather than a copy to be used within the lambda construction. If the arrays were big enough or the computation run long enough, you should notice a performance boost by avoiding copying the arrays with each invocation. And if you actually cared about the results of your matrix multiply, you might notice using [=] thatthey're allwrong! ;-)</description>
      <pubDate>Tue, 22 Jun 2010 17:00:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/lambda-use-for-TBB-in-Parallel-Studio/m-p/744623#M1708</guid>
      <dc:creator>robert-reed</dc:creator>
      <dc:date>2010-06-22T17:00:34Z</dc:date>
    </item>
  </channel>
</rss>

