<?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 If I remember correctly, and in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036659#M111973</link>
    <description>&lt;P&gt;If I remember correctly, and the OpenMP specification does indicate this, then variables that have no explicit data-sharing attribute have the attribute "shared". This could be causing the haphazard spikes you see. (page 157 of the OpenMP 4.0 specifications: In a parallel construct, if no default clause is present, these variables are shared).&lt;/P&gt;

&lt;P&gt;At the very least I would specify an explicit private attribute for all variables, like omega and zeta, that appear in the do-loop and that are not already shared.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Arjen&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jun 2015 08:35:12 GMT</pubDate>
    <dc:creator>Arjen_Markus</dc:creator>
    <dc:date>2015-06-12T08:35:12Z</dc:date>
    <item>
      <title>Unexpected results with OpenMP</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036658#M111972</link>
      <description>&lt;DIV class="field field-name-comment-body field-type-text-long field-label-hidden"&gt;
	&lt;DIV class="field-items"&gt;
		&lt;DIV class="field-item even"&gt;
			&lt;P&gt;Now the sequential version of the code works (&lt;A href="https://software.intel.com/en-us/forums/topic/559357"&gt;https://software.intel.com/en-us/forums/topic/559357&lt;/A&gt;), I tried to parallelize the loop at line 68 of myprog.f (see attached) using OpenMP.&lt;/P&gt;

			&lt;P&gt;As before, I use 'ifort -c mymod.f90' to compile the module.&lt;/P&gt;

			&lt;P&gt;Then I build the program successfully with:&lt;/P&gt;

			&lt;P&gt;c:\&amp;gt;ifort -openmp myprog.f mymod.obj&lt;BR /&gt;
				Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.3.202 Build 20140422&lt;BR /&gt;
				Copyright (C) 1985-2014 Intel Corporation.&amp;nbsp; All rights reserved.&lt;/P&gt;

			&lt;P&gt;Microsoft (R) Incremental Linker Version 10.00.40219.01&lt;BR /&gt;
				Copyright (C) Microsoft Corporation.&amp;nbsp; All rights reserved.&lt;/P&gt;

			&lt;P&gt;-out:myprog.exe&lt;BR /&gt;
				-subsystem:console&lt;BR /&gt;
				-defaultlib:libiomp5md.lib&lt;BR /&gt;
				-nodefaultlib:vcomp.lib&lt;BR /&gt;
				-nodefaultlib:vcompd.lib&lt;BR /&gt;
				myprog.obj&lt;BR /&gt;
				mymod.obj&lt;/P&gt;

			&lt;P&gt;The programs runs without any error and generates correct results when setting the number of threads to 1 (num_threads(1) at line 63 of myprog) but incorrect results are obtained for some loop iterations when specifying more than one thread, as illustrated on the graph Plot.jpg.&lt;/P&gt;

			&lt;P&gt;The program performs integration of a function for several values of a variable, and each iteration of the loop I intend to parallelize corresponds to the computation of the integral for one of these values. These integral computations are completely independent, they just start using common input data and the only thing that basically changes from one iteration to the other is the loop index that define variable omega (line 69) and the other variables depending on it. After execution, it therefore provide an integral value for each value of variable omega and this is presented on the plot (Y axis -&amp;gt; value of the integral, X axis -&amp;gt; variable omega).&lt;/P&gt;

			&lt;P&gt;The blue curve are the correct results, obtained with the sequential version of the code as with num_threads(1). The red line are results obtained with num_threads(2), and shows some peaks with erroneous values. The peaks are not systematically reproducible (i.e., may change from one run of the program to the other).&lt;/P&gt;

			&lt;P&gt;Before I enter more deeply in the debugging process, do you see any obvious problem/mistake in the code that may explain such results? I defined all variables as private, except the input variables and the output one. I also defined all procedures of the module as recursive as it if often recommended on forums about such topics. From my first tests, I suspect the integration variable (line 772 of mymod) to be at the source of the problem, but without understanding why…&lt;/P&gt;
		&lt;/DIV&gt;
	&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 12 Jun 2015 08:20:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036658#M111972</guid>
      <dc:creator>Frederic_A_</dc:creator>
      <dc:date>2015-06-12T08:20:33Z</dc:date>
    </item>
    <item>
      <title>If I remember correctly, and</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036659#M111973</link>
      <description>&lt;P&gt;If I remember correctly, and the OpenMP specification does indicate this, then variables that have no explicit data-sharing attribute have the attribute "shared". This could be causing the haphazard spikes you see. (page 157 of the OpenMP 4.0 specifications: In a parallel construct, if no default clause is present, these variables are shared).&lt;/P&gt;

&lt;P&gt;At the very least I would specify an explicit private attribute for all variables, like omega and zeta, that appear in the do-loop and that are not already shared.&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Arjen&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 08:35:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036659#M111973</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2015-06-12T08:35:12Z</dc:date>
    </item>
    <item>
      <title>Hi Arjen</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036660#M111974</link>
      <description>&lt;P&gt;Hi Arjen&lt;/P&gt;

&lt;P&gt;Thank you for your suggestion.&lt;/P&gt;

&lt;P&gt;As fas as I understand, I already defined all data as private by default (default(private)) in the !$omp parallel directive and shared explicitely only the common input variables and the output vector in which each thread will save its result at the corresponding index (see lines 63-65 of myprog). Is there a more proper way to do it?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 08:59:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036660#M111974</guid>
      <dc:creator>Frederic_A_</dc:creator>
      <dc:date>2015-06-12T08:59:22Z</dc:date>
    </item>
    <item>
      <title>Oops, I completely overlooked</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036661#M111975</link>
      <description>&lt;P&gt;Oops, I completely overlooked that bit. Hm, then my suggestion is completely superfluous.&lt;/P&gt;

&lt;P&gt;But I do see this typo:&lt;/P&gt;

&lt;P&gt;!$opm do&lt;/P&gt;

&lt;P&gt;Could that be the thing that is causing this?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Arjen&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 09:11:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Unexpected-results-with-OpenMP/m-p/1036661#M111975</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2015-06-12T09:11:46Z</dc:date>
    </item>
  </channel>
</rss>

