<?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 Different behaviour depending on which thread computes which in in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803014#M38694</link>
    <description>Which compilation flags should I use in order to assure that all variables static/stack/heap are 0-initialized?&lt;DIV&gt;I have not SAVE statments or commons&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance!&lt;/DIV&gt;</description>
    <pubDate>Fri, 02 Mar 2012 12:17:05 GMT</pubDate>
    <dc:creator>aurora</dc:creator>
    <dc:date>2012-03-02T12:17:05Z</dc:date>
    <item>
      <title>Different behaviour depending on which thread computes which interation loop (OpenMP parallel for)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803008#M38688</link>
      <description>Hi,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I have a parallel loop like this one:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;!$OMP PARALLEL DO NUM_THREADS(2) DEFAULT(SHARED)&lt;/DIV&gt;&lt;DIV&gt;DO J=1, X&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;!$OMP CRITICAL&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;aux+=f(...some parameters...)&lt;/DIV&gt;&lt;DIV&gt;!$OMP END CRITICAL&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;END DO&lt;/DIV&gt;&lt;DIV&gt;!$OMP END PARALLEL DO&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;In f(), there are some "double precission" and "integer" definitions and the parameters variables and it calculates a number.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The thing, is that "aux" depends on which threads is computing the f() function. This is, if thread0 computes interations 1,2,3,4 and thread1 computes interations with J=5,6,7,8, aux is always the same. But when there is a different combination of iterations in threads, the results differ.&lt;/DIV&gt;&lt;DIV&gt;So, to achieve the same "aux" result between two executions of the program, thread0 has to compute exactly the same iterations. What could produce this behaviour? ( for example, threadprivate declarations)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Feb 2012 11:26:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803008#M38688</guid>
      <dc:creator>aurora</dc:creator>
      <dc:date>2012-02-23T11:26:05Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803009#M38689</link>
      <description>Variations in roundoff behavior are inherent in reduction operations. In the context you posted, it looks like you need firstprivate(aux) lastprivate(aux) in order to accomplish it by critical section.&lt;BR /&gt;Assuming your function is correctly parallelized and has no side effects (and is compiled with compatible options or RECURSIVE declaration), numerical variations are to be expected due to varying order of addition.&lt;BR /&gt;The OpenMP reduction clause might be more efficient and might have better numerical properties, as well as being simpler to write, than the critical section. reduction clause would avoid the need for firstprivate lastprivate.&lt;BR /&gt;If the code is correctly parallelized but still has excessive variations in roundoff due to various orders of addition, the simplest remedy would be to declare aux as double precision if it isn't already.</description>
      <pubDate>Thu, 23 Feb 2012 12:52:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803009#M38689</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2012-02-23T12:52:41Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803010#M38690</link>
      <description>Hi,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;This is a simplification of the problem. In fact, in my problem, "aux" would be a matrix and each position in the matrix is accesed only once in the whole loop, so no reduction here, only a shared matrix.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tested also the code in sequential with random order of iterations and works fine&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;PS: The critical is only for showing that there is not a concurrence problem. I think the problem is in function f() and what variables it declares in stack (maybe garbage values that persist between iterations or something).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Any ideas?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Feb 2012 13:56:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803010#M38690</guid>
      <dc:creator>aurora</dc:creator>
      <dc:date>2012-02-23T13:56:29Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803011#M38691</link>
      <description>I did suggest that you check the function f() to assure that it was compiled with options to assure private stack. You may recall that Steve Lionel suggested that such functions should be declared RECURSIVE so as to avoid those dependencies on compile options. When that is done, the order of threaded completion should not have any more effects than changes in order of sequential iterations.</description>
      <pubDate>Thu, 23 Feb 2012 14:55:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803011#M38691</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2012-02-23T14:55:26Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803012#M38692</link>
      <description>&lt;DIV&gt;Consider using the ORDERED directive&lt;BR /&gt;&lt;BR /&gt;!$OMP PARALLEL DO &lt;STRONG&gt;&lt;EM&gt;ORDERED&lt;/EM&gt;&lt;/STRONG&gt; NUM_THREADS(2) DEFAULT(SHARED)&lt;/DIV&gt;&lt;DIV&gt;DO J=1, X&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;... ! possibly other work here&lt;BR /&gt;!$OMP &lt;STRONG&gt;&lt;EM&gt;ORDERED&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;aux+=f(...some parameters...)&lt;/DIV&gt;&lt;DIV&gt;!$OMP END &lt;STRONG&gt;&lt;EM&gt;ORDERED&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;... ! possibly other work here&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;END DO&lt;/DIV&gt;&lt;DIV&gt;!$OMP END PARALLEL DO&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Feb 2012 15:19:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803012#M38692</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2012-02-23T15:19:15Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803013#M38693</link>
      <description>Hi,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've read about this in&lt;A href="http://software.intel.com/en-us/forums/showpost.php?p=117749"&gt;http://software.intel.com/en-us/forums/showpost.php?p=117749&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;I thought that /recursive was implicit with /Qopenmp. Anyway, compiling with /recursive doesnt solve the problem :(&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Feb 2012 09:41:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803013#M38693</guid>
      <dc:creator>aurora</dc:creator>
      <dc:date>2012-02-24T09:41:01Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803014#M38694</link>
      <description>Which compilation flags should I use in order to assure that all variables static/stack/heap are 0-initialized?&lt;DIV&gt;I have not SAVE statments or commons&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance!&lt;/DIV&gt;</description>
      <pubDate>Fri, 02 Mar 2012 12:17:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803014#M38694</guid>
      <dc:creator>aurora</dc:creator>
      <dc:date>2012-03-02T12:17:05Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803015#M38695</link>
      <description>Whilst it is not a good idea to rely on such settings(it is always better to change the code even if it is a long slog to do so (or you could write a script to help you)) /QSave and /QZeroare the ones you want.&lt;BR /&gt;&lt;BR /&gt;Note/QZero only initialises saved scalar variables - arrays you will have to do yourself.&lt;BR /&gt;&lt;BR /&gt;see the help for more details&lt;BR /&gt;&lt;BR /&gt;Les</description>
      <pubDate>Fri, 02 Mar 2012 12:44:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803015#M38695</guid>
      <dc:creator>Les_Neilson</dc:creator>
      <dc:date>2012-03-02T12:44:36Z</dc:date>
    </item>
    <item>
      <title>Different behaviour depending on which thread computes which in</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803016#M38696</link>
      <description>The combination /Qsave /Qzero works by removing the affected variables from stack, so it does nothing to initialize stack. It won't help you with parallelization.</description>
      <pubDate>Fri, 02 Mar 2012 16:27:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-behaviour-depending-on-which-thread-computes-which/m-p/803016#M38696</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2012-03-02T16:27:56Z</dc:date>
    </item>
  </channel>
</rss>

