<?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 Threading in section in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threading-in-section/m-p/828952#M1439</link>
    <description>#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;CONIO.H&gt;&lt;BR /&gt;#include &lt;OMP.H&gt;&lt;BR /&gt;&lt;BR /&gt;void display1()&lt;BR /&gt;{&lt;BR /&gt;#pragma omp parallel for num_threads(5)&lt;BR /&gt; &lt;BR /&gt;  for(int i=0;i&amp;lt;10;i++)&lt;BR /&gt;   printf("From display1 %d\\n\\n",omp_get_thread_num());&lt;BR /&gt; &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void display2()&lt;BR /&gt;{&lt;BR /&gt; printf("From display2 %d\\n\\n",omp_get_thread_num());&lt;BR /&gt;}&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;#pragma omp parallel sections&lt;BR /&gt; {&lt;BR /&gt;#pragma omp section&lt;BR /&gt;  display1();&lt;BR /&gt;#pragma omp section&lt;BR /&gt;  display2();&lt;BR /&gt; }&lt;BR /&gt; getch();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I got the result&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display2 1&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now i wanted to know that when i parallelized for in the function display1 why are all the omp_get_thread_num() in that section 0.&lt;BR /&gt;&lt;BR /&gt;If it is not possible this way then how can we do this. I want to parallelize the sections as well as a part of a particular section.&lt;BR /&gt;&lt;/OMP.H&gt;&lt;/CONIO.H&gt;&lt;/STDIO.H&gt;</description>
    <pubDate>Sat, 01 May 2010 14:30:31 GMT</pubDate>
    <dc:creator>Anupam_Dev</dc:creator>
    <dc:date>2010-05-01T14:30:31Z</dc:date>
    <item>
      <title>Threading in section</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threading-in-section/m-p/828952#M1439</link>
      <description>#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;CONIO.H&gt;&lt;BR /&gt;#include &lt;OMP.H&gt;&lt;BR /&gt;&lt;BR /&gt;void display1()&lt;BR /&gt;{&lt;BR /&gt;#pragma omp parallel for num_threads(5)&lt;BR /&gt; &lt;BR /&gt;  for(int i=0;i&amp;lt;10;i++)&lt;BR /&gt;   printf("From display1 %d\\n\\n",omp_get_thread_num());&lt;BR /&gt; &lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;void display2()&lt;BR /&gt;{&lt;BR /&gt; printf("From display2 %d\\n\\n",omp_get_thread_num());&lt;BR /&gt;}&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;#pragma omp parallel sections&lt;BR /&gt; {&lt;BR /&gt;#pragma omp section&lt;BR /&gt;  display1();&lt;BR /&gt;#pragma omp section&lt;BR /&gt;  display2();&lt;BR /&gt; }&lt;BR /&gt; getch();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I got the result&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display2 1&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;From display1 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now i wanted to know that when i parallelized for in the function display1 why are all the omp_get_thread_num() in that section 0.&lt;BR /&gt;&lt;BR /&gt;If it is not possible this way then how can we do this. I want to parallelize the sections as well as a part of a particular section.&lt;BR /&gt;&lt;/OMP.H&gt;&lt;/CONIO.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Sat, 01 May 2010 14:30:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threading-in-section/m-p/828952#M1439</guid>
      <dc:creator>Anupam_Dev</dc:creator>
      <dc:date>2010-05-01T14:30:31Z</dc:date>
    </item>
    <item>
      <title>Threading in section</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threading-in-section/m-p/828953#M1440</link>
      <description>You must enable nested parallelism&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; omp_set_nested(1); // 0=no nesting, (non zero)=enable nesting&lt;BR /&gt;#pragma omp parallel sections&lt;BR /&gt; {&lt;BR /&gt;#pragma omp section&lt;BR /&gt;  display1();&lt;BR /&gt;#pragma omp section&lt;BR /&gt;  display2();&lt;BR /&gt; }&lt;BR /&gt; getch();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;You can also enable nesting by use of environment variable&lt;BR /&gt;&lt;BR /&gt;set OMP_NESTED=TRUE&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey&lt;BR /&gt;</description>
      <pubDate>Sun, 02 May 2010 12:45:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Threading-in-section/m-p/828953#M1440</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2010-05-02T12:45:37Z</dc:date>
    </item>
  </channel>
</rss>

