<?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 Debugging OpenMP in Analyzers</title>
    <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772827#M415</link>
    <description>Hi folks,&lt;BR /&gt;&lt;BR /&gt;Recently, I downloaded Parallel Studio XE 2011. I ran Inspector XE&lt;BR /&gt;on my scientific simulation code in order to find OpenMP data races.&lt;BR /&gt;The Inspector reported many race conditions at Fortran allocate/deallocate&lt;BR /&gt;statements within parallel regions. However, trying to figure out which &lt;BR /&gt;allocate is declared as data race, it turned out that the behavior doesn't&lt;BR /&gt;seem to be deterministic.&lt;BR /&gt;&lt;BR /&gt;So I came up with this trivial test problem:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fortran]program omp_alloc
   implicit none

   integer, dimension(:), allocatable :: a

   !$omp parallel private(a) 
   allocate(a(10))
   deallocate(a)
   !$omp end parallel
end program omp_alloc[/fortran]&lt;/PRE&gt; &lt;BR /&gt;&amp;gt; ifort --version&lt;BR /&gt;ifort (IFORT) 12.0.2 20110112&lt;BR /&gt;Copyright (C) 1985-2011 Intel Corporation. All rights reserved.&lt;BR /&gt;&amp;gt; ifort -openmp -g omp_alloc.F90&lt;BR /&gt;&amp;gt; inspxe-cl --version&lt;BR /&gt;Intel Inspector XE 2011 Update 2 (build 134657) Command Line tool&lt;BR /&gt;Copyright (C) 2009-2011 Intel Corporation. All rights reserved.&lt;BR /&gt;&amp;gt; export OMP_NUM_THREADS=4&lt;BR /&gt;&amp;gt; inspxe-cl -collect ti3 -- ./a.out&lt;BR /&gt;Used suppression file(s): []&lt;BR /&gt; &lt;BR /&gt;1 new problem(s) found &lt;BR /&gt; 1 Data race problem(s) detected &lt;BR /&gt;&lt;BR /&gt;Inspecting the data race with the GUI, it points to the allocate/deallocate statments.&lt;BR /&gt;The data race is not reported in a deterministic fashion. However, increasing the&lt;BR /&gt;number of threads over the number of available cores drastically increases the&lt;BR /&gt;probability for the data race to be reported.&lt;BR /&gt;&lt;BR /&gt;What is going on here? Is that really a data race or just a false positive?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Fabian&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 30 Mar 2011 19:56:47 GMT</pubDate>
    <dc:creator>fah10</dc:creator>
    <dc:date>2011-03-30T19:56:47Z</dc:date>
    <item>
      <title>Debugging OpenMP</title>
      <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772827#M415</link>
      <description>Hi folks,&lt;BR /&gt;&lt;BR /&gt;Recently, I downloaded Parallel Studio XE 2011. I ran Inspector XE&lt;BR /&gt;on my scientific simulation code in order to find OpenMP data races.&lt;BR /&gt;The Inspector reported many race conditions at Fortran allocate/deallocate&lt;BR /&gt;statements within parallel regions. However, trying to figure out which &lt;BR /&gt;allocate is declared as data race, it turned out that the behavior doesn't&lt;BR /&gt;seem to be deterministic.&lt;BR /&gt;&lt;BR /&gt;So I came up with this trivial test problem:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fortran]program omp_alloc
   implicit none

   integer, dimension(:), allocatable :: a

   !$omp parallel private(a) 
   allocate(a(10))
   deallocate(a)
   !$omp end parallel
end program omp_alloc[/fortran]&lt;/PRE&gt; &lt;BR /&gt;&amp;gt; ifort --version&lt;BR /&gt;ifort (IFORT) 12.0.2 20110112&lt;BR /&gt;Copyright (C) 1985-2011 Intel Corporation. All rights reserved.&lt;BR /&gt;&amp;gt; ifort -openmp -g omp_alloc.F90&lt;BR /&gt;&amp;gt; inspxe-cl --version&lt;BR /&gt;Intel Inspector XE 2011 Update 2 (build 134657) Command Line tool&lt;BR /&gt;Copyright (C) 2009-2011 Intel Corporation. All rights reserved.&lt;BR /&gt;&amp;gt; export OMP_NUM_THREADS=4&lt;BR /&gt;&amp;gt; inspxe-cl -collect ti3 -- ./a.out&lt;BR /&gt;Used suppression file(s): []&lt;BR /&gt; &lt;BR /&gt;1 new problem(s) found &lt;BR /&gt; 1 Data race problem(s) detected &lt;BR /&gt;&lt;BR /&gt;Inspecting the data race with the GUI, it points to the allocate/deallocate statments.&lt;BR /&gt;The data race is not reported in a deterministic fashion. However, increasing the&lt;BR /&gt;number of threads over the number of available cores drastically increases the&lt;BR /&gt;probability for the data race to be reported.&lt;BR /&gt;&lt;BR /&gt;What is going on here? Is that really a data race or just a false positive?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Fabian&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Mar 2011 19:56:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772827#M415</guid>
      <dc:creator>fah10</dc:creator>
      <dc:date>2011-03-30T19:56:47Z</dc:date>
    </item>
    <item>
      <title>Debugging OpenMP</title>
      <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772828#M416</link>
      <description>&lt;P&gt;Results of Inspector XE make sense. It's a really data race in my view.&lt;BR /&gt;&lt;BR /&gt;Since variable "a" is shared between omp threads, but conflicted when doing "allocate" - they are write-write conflicts.&lt;BR /&gt;&lt;BR /&gt;If you increase number of OMP_NUM_THREADS, problem number still is "1" - but there are more code locationsin more threads.&lt;BR /&gt;&lt;BR /&gt;Regards, Peter&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2011 08:52:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772828#M416</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-04-01T08:52:42Z</dc:date>
    </item>
    <item>
      <title>Debugging OpenMP</title>
      <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772829#M417</link>
      <description>"a" is declared private, so each thread thread has its own copy of the variable and allocates its own memory on the heap.&lt;BR /&gt;So there shouln't be a data race...</description>
      <pubDate>Fri, 01 Apr 2011 11:07:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772829#M417</guid>
      <dc:creator>fah10</dc:creator>
      <dc:date>2011-04-01T11:07:40Z</dc:date>
    </item>
    <item>
      <title>Debugging OpenMP</title>
      <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772830#M418</link>
      <description>"a"was declared in main programand without "common a", should beNOT a global. Also "a was declared as "private" in omp directive.&lt;BR /&gt;&lt;BR /&gt;Let me talk with engineering team, and get back to you soon.</description>
      <pubDate>Fri, 01 Apr 2011 14:17:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772830#M418</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-04-01T14:17:29Z</dc:date>
    </item>
    <item>
      <title>Debugging OpenMP</title>
      <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772831#M419</link>
      <description>Peter,&lt;BR /&gt;&lt;BR /&gt;Unless a subroutine or function is declared as recursive, declaring an array descriptor as if the descriptor were SAVE. The allocation/deallocation from heap is a seperate issue. PRIVATE is used in a parallel region for array a(:). This instantiates thread team number of additional, private, array descriptors, including one for the main thread. When the main thread exits the parallel region, it will copy the contents of its private variables back to the scoped varibles outside the parallel region. Even though the private a(:) of the main threashas now been deallocated, and is presumably identical to the contents of the outer scoped a(:), the compiler doesn't know/care and code is generated to write the contents of the array descriptor back out. If one of the other thread team members be in the startup section of the parallel region at this time thenit is possible that a non-main thread isreading the outer scoped contents of the array descriptor while the main thread is re-writing it.&lt;BR /&gt;&lt;BR /&gt;At least this is my postulation asto what is going on.&lt;BR /&gt;&lt;BR /&gt;In this case, this is a benign issue (one thread writing a null array descriptor while other threads reading that null array descriptor). &lt;BR /&gt;&lt;BR /&gt;To correct for this (if you want to do this), move the code from within the parallel region to a subroutine attributed with RECURSIVE, then in the parallel region call this subroutine.The recursive attribute will cause the array descriptor to be located on the stack (for each thread). As to if this works into the poster's code, I cannot say, as it may require passing a large number of references.&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey</description>
      <pubDate>Sat, 02 Apr 2011 13:13:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772831#M419</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2011-04-02T13:13:44Z</dc:date>
    </item>
    <item>
      <title>Debugging OpenMP</title>
      <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772832#M420</link>
      <description>Thanks Jim, for helpful info! Now I change code as below:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;program omp_alloc&lt;BR /&gt; integer X&lt;/P&gt;&lt;P&gt; X = 16&lt;BR /&gt; !$omp parallel&lt;BR /&gt; call sub(X)&lt;BR /&gt; !$omp end parallel&lt;/P&gt;&lt;P&gt;end program omp_alloc&lt;/P&gt;&lt;P&gt;recursive subroutine sub(X)&lt;BR /&gt; implicit none&lt;BR /&gt; integer, dimension(:), allocatable ::a&lt;BR /&gt; integer X&lt;/P&gt;&lt;P&gt; allocate(a(10))&lt;BR /&gt; deallocate(a)&lt;/P&gt;&lt;P&gt; if (X .GT. 0) then&lt;BR /&gt; call sub(X-1)&lt;BR /&gt; end if&lt;/P&gt;&lt;P&gt;end&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;[root@NHM02 problem_report]# ifort -g -openmp -openmp-report omp_alloc.F90 -o omp_alloc.ifort &lt;BR /&gt;omp_alloc.F90(5) (col. 7): remark: OpenMP DEFINED REGION WAS PARALLELIZED.&lt;BR /&gt;&lt;BR /&gt;However, it still detected data race-&lt;BR /&gt;[root@NHM02 problem_report]# inspxe-cl -collect ti3 -- ./omp_alloc.ifort &lt;BR /&gt;Used suppression file(s): []&lt;BR /&gt; &lt;BR /&gt;2 new problem(s) found &lt;BR /&gt; 1 Cross-thread stack access problem(s) detected &lt;BR /&gt; 1 Data race problem(s) detected &lt;BR /&gt;&lt;BR /&gt;Even I inserted "call sleep(5)" between allocate and deallocate, the result was same.&lt;BR /&gt;&lt;BR /&gt;I will verify this with Inspetcor XE development team.&lt;BR /&gt;&lt;BR /&gt;Regards, Peter&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2011 12:02:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772832#M420</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-04-03T12:02:09Z</dc:date>
    </item>
    <item>
      <title>Debugging OpenMP</title>
      <link>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772833#M421</link>
      <description>This problem has been fixed in latest Update 8</description>
      <pubDate>Thu, 29 Dec 2011 07:55:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Debugging-OpenMP/m-p/772833#M421</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-12-29T07:55:18Z</dc:date>
    </item>
  </channel>
</rss>

