<?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 Problems with parallel_for in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Problems-with-parallel-for/m-p/823870#M1317</link>
    <description>I feel somewhat silly for not thinking of that, but I hadn't. There are no errors now, but the program also doesn't display any output. Assuming I'm reading my own code correctly, shouldn't it print 5 lines worth of "Hello, world" ?&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Edit: So after re-reading the tutorial, I was mis-using blocked range. Now that I've fixed that, the code works as intended.&lt;/DIV&gt;</description>
    <pubDate>Sun, 25 Sep 2011 15:04:19 GMT</pubDate>
    <dc:creator>brtaylor92</dc:creator>
    <dc:date>2011-09-25T15:04:19Z</dc:date>
    <item>
      <title>Problems with parallel_for</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Problems-with-parallel-for/m-p/823868#M1315</link>
      <description>I'm trying to learn how to use the parallel_for() function described in &lt;A href="http://cache-www.intel.com/cd/00/00/30/11/301114_301114.pdf#page=28"&gt; this link.  &lt;/A&gt;.  To do so, I wrote a simple program that prints "Hello World!" to the terminal 5 times using a loop.  It looks like: &lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
#include &lt;IOSTREAM&gt; &lt;BR /&gt;
#include "tbb/parallel_for.h" &lt;BR /&gt;
#include "tbb/blocked_range.h" &lt;BR /&gt;
&lt;BR /&gt;
using namespace tbb;&lt;BR /&gt;
&lt;BR /&gt;
struct Hello { &lt;BR /&gt;
    void operator() ( const blocked_range&lt;INT&gt;&amp;amp; range ) const { &lt;BR /&gt;
        for (int i=range.begin(); i!=range.end(); i++) &lt;BR /&gt;
            std::cout &amp;lt;&amp;lt; "Hello World!" &amp;lt;&amp;lt; std::endl; &lt;BR /&gt;
       }&lt;BR /&gt;
}; &lt;BR /&gt;
&lt;BR /&gt;
int main () &lt;BR /&gt;
{   &lt;BR /&gt;
    int i=0; &lt;BR /&gt;
    Hello hi; &lt;BR /&gt;
    parallel_for( blocked_range&lt;INT&gt;(0, i, 5), hi); &lt;BR /&gt;
    return 0; &lt;BR /&gt;
} &lt;BR /&gt;
&lt;/INT&gt;&lt;/INT&gt;&lt;/IOSTREAM&gt;&lt;/CODE&gt;
&lt;BR /&gt;
When I compile it with &lt;CODE&gt;icpc hello.cpp&lt;/CODE&gt; I get: &lt;BR /&gt;

&lt;CODE&gt;Undefined symbols for architecture x86_64:
  "__ZNK3tbb8internal32allocate_root_with_context_proxy4freeERNS_4taskE", referenced from:
      __ZdlPvRKN3tbb8internal32allocate_root_with_context_proxyE in icpcFImXZe.o
  "__ZNK3tbb8internal27allocate_continuation_proxy8allocateEm", referenced from:
      __ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_ in icpcFImXZe.o
  "__ZNK3tbb8internal20allocate_child_proxy8allocateEm", referenced from:
      __ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_ in icpcFImXZe.o
  "__ZNK3tbb18task_group_context28is_group_execution_cancelledEv", referenced from:
      __ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_ in icpcFImXZe.o
  "__ZNK3tbb8internal27allocate_continuation_proxy4freeERNS_4taskE", referenced from:
      __ZdlPvRKN3tbb8internal27allocate_continuation_proxyE in icpcFImXZe.o
  "__ZNK3tbb8internal20allocate_child_proxy4freeERNS_4taskE", referenced from:
      __ZdlPvRKN3tbb8internal20allocate_child_proxyE in icpcFImXZe.o
  "__ZN3tbb4task13note_affinityEt", referenced from:
      __ZTVN3tbb10interface68internal9flag_taskE in icpcFImXZe.o
      __ZTVN3tbb10interface68internal11signal_taskE in icpcFImXZe.o
  "__ZTIN3tbb4taskE", referenced from:
      __ZTIN3tbb10interface68internal9flag_taskE in icpcFImXZe.o
      __ZTIN3tbb10interface68internal11signal_taskE in icpcFImXZe.o
      __ZTIN3tbb10interface68internal9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEE in icpcFImXZe.o
ld: symbol(s) not found for architecture x86_64&lt;/CODE&gt;&lt;BR /&gt;
Or, on another system (gentoo rather than OS X), 
&lt;CODE&gt;
/tmp/icpcFDqPZs.o: In function `operator delete(void*, tbb::internal::allocate_root_with_context_proxy const&amp;amp;)':
hello.cpp:(.text._ZdlPvRKN3tbb8internal32allocate_root_with_context_proxyE[.text._ZdlPvRKN3tbb8internal32allocate_root_with_context_proxyE]+0xb): undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&amp;amp;) const'
/tmp/icpcFDqPZs.o: In function `.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_':
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x1be): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x1f0): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x2c1): undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x3a8): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x3e3): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x4cb): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x502): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x5ac): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
hello.cpp:(.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_[.text._ZN3tbb10interface68internal19partition_type_baseINS1_19auto_partition_typeEE7executeINS1_9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEES8_EEvRT_RT0_]+0x5e7): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
/tmp/icpcFDqPZs.o: In function `operator delete(void*, tbb::internal::allocate_continuation_proxy const&amp;amp;)':
hello.cpp:(.text._ZdlPvRKN3tbb8internal27allocate_continuation_proxyE[.text._ZdlPvRKN3tbb8internal27allocate_continuation_proxyE]+0xb): undefined reference to `tbb::internal::allocate_continuation_proxy::free(tbb::task&amp;amp;) const'
/tmp/icpcFDqPZs.o: In function `operator delete(void*, tbb::internal::allocate_child_proxy const&amp;amp;)':
hello.cpp:(.text._ZdlPvRKN3tbb8internal20allocate_child_proxyE[.text._ZdlPvRKN3tbb8internal20allocate_child_proxyE]+0xb): undefined reference to `tbb::internal::allocate_child_proxy::free(tbb::task&amp;amp;) const'
/tmp/icpcFDqPZs.o:(.data._ZTVN3tbb10interface68internal9flag_taskE[_ZTVN3tbb10interface68internal9flag_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
/tmp/icpcFDqPZs.o:(.data._ZTIN3tbb10interface68internal9flag_taskE[_ZTIN3tbb10interface68internal9flag_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
/tmp/icpcFDqPZs.o:(.data._ZTVN3tbb10interface68internal11signal_taskE[_ZTVN3tbb10interface68internal11signal_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
/tmp/icpcFDqPZs.o:(.data._ZTIN3tbb10interface68internal11signal_taskE[_ZTIN3tbb10interface68internal11signal_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
/tmp/icpcFDqPZs.o:(.data._ZTIN3tbb10interface68internal9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEE[_ZTIN3tbb10interface68internal9start_forINS_13blocked_rangeIiEE5HelloNS_16auto_partitionerEEE]+0x10): undefined reference to `typeinfo for tbb::task'
&lt;/CODE&gt;&lt;BR /&gt;&lt;DIV&gt;Can someone help me figure out what might be causing this? I've got a much more complex piece of code in which I could really use a parallel_for, but unless I can get it working, it appears I'm out of luck.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;--brtaylor92&lt;/DIV&gt;</description>
      <pubDate>Sun, 25 Sep 2011 03:02:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Problems-with-parallel-for/m-p/823868#M1315</guid>
      <dc:creator>brtaylor92</dc:creator>
      <dc:date>2011-09-25T03:02:38Z</dc:date>
    </item>
    <item>
      <title>Problems with parallel_for</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Problems-with-parallel-for/m-p/823869#M1316</link>
      <description>hibrtaylor92,&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;did you add -ltbb to compile/link command line?&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;--Vladimir&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 25 Sep 2011 06:04:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Problems-with-parallel-for/m-p/823869#M1316</guid>
      <dc:creator>Vladimir_P_1234567890</dc:creator>
      <dc:date>2011-09-25T06:04:00Z</dc:date>
    </item>
    <item>
      <title>Problems with parallel_for</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Problems-with-parallel-for/m-p/823870#M1317</link>
      <description>I feel somewhat silly for not thinking of that, but I hadn't. There are no errors now, but the program also doesn't display any output. Assuming I'm reading my own code correctly, shouldn't it print 5 lines worth of "Hello, world" ?&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Edit: So after re-reading the tutorial, I was mis-using blocked range. Now that I've fixed that, the code works as intended.&lt;/DIV&gt;</description>
      <pubDate>Sun, 25 Sep 2011 15:04:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Problems-with-parallel-for/m-p/823870#M1317</guid>
      <dc:creator>brtaylor92</dc:creator>
      <dc:date>2011-09-25T15:04:19Z</dc:date>
    </item>
  </channel>
</rss>

