<?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 Re: Linux ifort OpenMP incorrect work-sharing distribution? in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Linux-ifort-OpenMP-incorrect-work-sharing-distribution/m-p/944136#M5087</link>
    <description>Hi Samlor,

I have exactly the same problem as you posted here using Intel ifort 9.0 on SGI altix machine. Have you got the answer or solution to fix it? Thanks.</description>
    <pubDate>Fri, 14 Jul 2006 21:45:43 GMT</pubDate>
    <dc:creator>jemmyhu</dc:creator>
    <dc:date>2006-07-14T21:45:43Z</dc:date>
    <item>
      <title>Linux ifort OpenMP incorrect work-sharing distribution?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Linux-ifort-OpenMP-incorrect-work-sharing-distribution/m-p/944135#M5086</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;G'day All,&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;The simple program enclosed seems to indicate a problem in Linux ifort OpenMP compilation of parallel do loop work-sharing directives that distributes increasing numbers of iterations instead of spreading them evenly amongst threads when the loop index variable i is re-used in later loop statements inside a single directive. The problem does not occur in equivalent C code. Nor does it occur if i is declared private or a different variable j is used for the 2nd loop.&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Am I doing something wrong or is this a bug? And, where/how should it be reported?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Regards,&lt;BR /&gt;Sam&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;PRE&gt;$ cat incorrect.f
      program main
      integer i, j, omp_get_thread_num, omp_get_num_threads
!$omp parallel private(i)
!$omp do
      do i=1,omp_get_num_threads()
        print *, 'tid =', omp_get_thread_num(), 'i =', i
      enddo
!$omp end do
!$omp single
      do i=1,omp_get_num_threads()
        print *, 'tid =', omp_get_thread_num(), 'i =', i
      enddo
!$omp end single
!$omp end parallel
      end
$ cat correct.c
#include &lt;OMP.H&gt;

main ()  {
int i,j;
#pragma omp parallel private(i)
  {
#pragma omp for
  for (i=0; i&lt;OMP_GET_NUM_THREADS&gt; !$omp single private(i)
$ ifort -openmp correct1.f -o correct1
correct1.f(4) : (col. 6) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
correct1.f(3) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
$ ./correct1
 tid =           0 i =           1
 tid =           1 i =           2
 tid =           2 i =           3
 tid =           3 i =           4
 tid =           0 i =           1
 tid =           0 i =           2
 tid =           0 i =           3
 tid =           0 i =           4
$ diff incorrect.f correct2.f

10,11c10,11
&amp;lt;       do i=1,omp_get_num_threads()
&amp;lt;         print *, 'tid =', omp_get_thread_num(), 'i =', i
---
&amp;gt;       do j=1,omp_get_num_threads()
&amp;gt;         print *, 'tid =', omp_get_thread_num(), 'j =', j
$ ifort -openmp correct2.f -o correct2
correct2.f(4) : (col. 6) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
correct2.f(3) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
$ ./correct2
 tid =           0 i =           1
 tid =           1 i =           2
 tid =           2 i =           3
 tid =           3 i =           4
 tid =           0 j =           1
 tid =           0 j =           2
 tid =           0 j =           3
 tid =           0 j =           4
$ 
&lt;/OMP_GET_NUM_THREADS&gt;&lt;/OMP.H&gt;&lt;/PRE&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;Message Edited by samlor on &lt;SPAN class="date_text"&gt;02-23-2006&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;09:36 AM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2006 07:34:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Linux-ifort-OpenMP-incorrect-work-sharing-distribution/m-p/944135#M5086</guid>
      <dc:creator>samlor</dc:creator>
      <dc:date>2006-02-23T07:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Linux ifort OpenMP incorrect work-sharing distribution?</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Linux-ifort-OpenMP-incorrect-work-sharing-distribution/m-p/944136#M5087</link>
      <description>Hi Samlor,

I have exactly the same problem as you posted here using Intel ifort 9.0 on SGI altix machine. Have you got the answer or solution to fix it? Thanks.</description>
      <pubDate>Fri, 14 Jul 2006 21:45:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Linux-ifort-OpenMP-incorrect-work-sharing-distribution/m-p/944136#M5087</guid>
      <dc:creator>jemmyhu</dc:creator>
      <dc:date>2006-07-14T21:45:43Z</dc:date>
    </item>
  </channel>
</rss>

