<?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 you do move to using in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000458#M103521</link>
    <description>&lt;P&gt;If you do move to using double precision then remember to change any real&amp;nbsp;literals (constants)&amp;nbsp;also. Then there is the need to check whether any constants are passed as actual arguments and the corresponding dummy arguments&amp;nbsp;need to be&amp;nbsp;the same precision. When you compile in debug make sure you have all of the check options on. This will help identify problems in passing data around.&lt;/P&gt;

&lt;P&gt;Les&lt;/P&gt;</description>
    <pubDate>Mon, 22 Sep 2014 15:24:32 GMT</pubDate>
    <dc:creator>Les_Neilson</dc:creator>
    <dc:date>2014-09-22T15:24:32Z</dc:date>
    <item>
      <title>Different results when running in debug and optimized (O3) mode</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000455#M103518</link>
      <description>&lt;P&gt;Different results when running in debug and optimized (O3) mode: I have some code that calculates the eigenvalues and eigenvectors of a symmetric positive-definite matrix followed by some simple matrix algebra. The code is embedded in a much larger program. &amp;nbsp;It uses 4 byte word lengths. I get different results when I use the release and debug versions of the program. The differences are very small when the input matrix is small, (say 10x10) but become huge as the matrix gets bigger (to 400x400). How common is this problem and does anyone have advice for how to proceed?&amp;nbsp; Will conversion to 8 byte reals help?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 09:23:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000455#M103518</guid>
      <dc:creator>Chris_G_2</dc:creator>
      <dc:date>2014-09-22T09:23:08Z</dc:date>
    </item>
    <item>
      <title>Hello Chris,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000456#M103519</link>
      <description>&lt;P&gt;Hello Chris,&lt;/P&gt;

&lt;P&gt;The differences between "debug" and "optimized" code are common, due the finite capability of the processor to store "digits" to perform calculations, and the fact the optimization usually leads to changes in the order the calculations happens.&lt;/P&gt;

&lt;P&gt;I think (not sure), that there are some compilation options that allow you to avoid those changes in the order of calculations (with performance penalties), and some others related specifically with float point operations.&lt;/P&gt;

&lt;P&gt;On the other hand, 4 bytes real numbers (with 7 significant digits, I think), will led to increasing differences along time, due "roundoff's" and the same reason above. So, usually using 8 byte real numbers usually increase precision. But this depends on the kind of calculations you are doing and the values you are using.&lt;/P&gt;

&lt;P&gt;Another possibility is related with parallelization. If there are errors in the parallel parts of the code that happens only when running in parallel (usually disabled in Debug mode), you can see big differences when comparing them.&lt;/P&gt;

&lt;P&gt;Problems of bigger differences in bigger matrixes than in smaller ones usually happens when you are performing calculations using multiple values instead of single values (like determinants, etc).&lt;/P&gt;

&lt;P&gt;Hope this can help you understand from where can come the differences.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;

&lt;P&gt;Eduardo&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 11:26:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000456#M103519</guid>
      <dc:creator>Jauch</dc:creator>
      <dc:date>2014-09-22T11:26:46Z</dc:date>
    </item>
    <item>
      <title>4 Bytes is just not enough to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000457#M103520</link>
      <description>&lt;P&gt;4 Bytes is just not enough to even attempt to maintain accuracy in the inversion algorithm, IMO. Rounding errors will build up, especially with large matrices, so you will do best to take the computational hit involved in going from 4-byte lengths (single precision) to 8-bytes (double precision) as the price for maintaining accuracy. After all, its no good being fast if the results are wrong.&lt;/P&gt;

&lt;P&gt;You appear not to question the matrix inversion/eigenvalue algorithm you are using. Is the code you use from one of the tried and much tested standard software packages offered with IVF or is it your own?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 13:10:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000457#M103520</guid>
      <dc:creator>Anthony_Richards</dc:creator>
      <dc:date>2014-09-22T13:10:54Z</dc:date>
    </item>
    <item>
      <title>If you do move to using</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000458#M103521</link>
      <description>&lt;P&gt;If you do move to using double precision then remember to change any real&amp;nbsp;literals (constants)&amp;nbsp;also. Then there is the need to check whether any constants are passed as actual arguments and the corresponding dummy arguments&amp;nbsp;need to be&amp;nbsp;the same precision. When you compile in debug make sure you have all of the check options on. This will help identify problems in passing data around.&lt;/P&gt;

&lt;P&gt;Les&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 15:24:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000458#M103521</guid>
      <dc:creator>Les_Neilson</dc:creator>
      <dc:date>2014-09-22T15:24:32Z</dc:date>
    </item>
    <item>
      <title>Thank you all for this. I</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000459#M103522</link>
      <description>&lt;P&gt;Thank you all for this. I guess I need to try real*8.&lt;/P&gt;

&lt;P&gt;Could vectorization be an issue?&lt;/P&gt;

&lt;P&gt;Anthony: I am using the Jacobi routine from 'Numerical Recipes'.&lt;/P&gt;

&lt;P&gt;ChrisG&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 16:02:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000459#M103522</guid>
      <dc:creator>Chris_G_2</dc:creator>
      <dc:date>2014-09-22T16:02:29Z</dc:date>
    </item>
    <item>
      <title>Try this program:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000460#M103523</link>
      <description>&lt;P&gt;Try this program:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program RoundOff
&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none
&amp;nbsp;&amp;nbsp;&amp;nbsp; integer :: i
&amp;nbsp;&amp;nbsp;&amp;nbsp; real(4) :: A4
&amp;nbsp;&amp;nbsp;&amp;nbsp; real(4) :: sum4
&amp;nbsp;&amp;nbsp;&amp;nbsp; real(8) :: A8
&amp;nbsp;&amp;nbsp;&amp;nbsp; real(8) :: sum8
&amp;nbsp;&amp;nbsp;&amp;nbsp; A4=0.1&amp;nbsp;&amp;nbsp; ! infinite repeating binary fraction
&amp;nbsp;&amp;nbsp;&amp;nbsp; A8=0.1_8
&amp;nbsp;&amp;nbsp;&amp;nbsp; sum4 = 0.0
&amp;nbsp;&amp;nbsp;&amp;nbsp; sum8 = 0.0_8
&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1,1000000
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum4 = sum4 + A4
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum8 = sum8 + A8
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(mod(i,10000) .eq. 0) then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(*,'(I10,X,4F40.20)') i,sum4,i*A4, sum8, i*A8
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif
&amp;nbsp;&amp;nbsp;&amp;nbsp; end do
&amp;nbsp;&amp;nbsp;&amp;nbsp; print *, 'done'
end program RoundOff
&lt;/PRE&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 21:18:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000460#M103523</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-09-22T21:18:21Z</dc:date>
    </item>
    <item>
      <title>You say you get differences</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000461#M103524</link>
      <description>&lt;P&gt;You say you get differences between debug and release versions. Are you saying that you know one is correct but the other diverges from the correct answer? Which one gives the 'correct' evaluation? Or is it possible both are incorrect but their different incorrect values increasingly diverge with array size? If only rounding is the problem, it should be the same in both debug and release versions, so if you get differences between the two, this may be due to your not initialising the arrays fully. In debug mode allocated arrays may be initialised to zero (or some other value) whereas in release mode the contents (other than the elements you explicitly assign values to) can be anything. You should always initialise allocated (or any other) arrays to zero if you are not going to assign a value yourself to every array element in the array.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;P.S. You say the code is part of a much larger program. Are you talking about divergences involving just the eigenvale-eigen vector code, or divergences in the results from the 'much larger program'?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2014 10:20:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000461#M103524</guid>
      <dc:creator>Anthony_Richards</dc:creator>
      <dc:date>2014-09-23T10:20:00Z</dc:date>
    </item>
    <item>
      <title>Interestingly I have</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000462#M103525</link>
      <description>&lt;P&gt;Interestingly I have rewritten the code to work with real*8 instead of real*4 and I get the same answers in debug and release mode for matrices up to 400x400 then the results start to diverge.So I don't think there is an issue due to not intializing variables but just rounding errors.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 08:09:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000462#M103525</guid>
      <dc:creator>Chris_G_2</dc:creator>
      <dc:date>2014-09-25T08:09:43Z</dc:date>
    </item>
    <item>
      <title>While there may be little you</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000463#M103526</link>
      <description>&lt;P&gt;While there may be little you can do about the accumulation of rounding errors with multiply and divide, there are some simple things you can do about the accumulation of rounding errors with add and subtract (at the expense of additional computation).&lt;/P&gt;

&lt;P&gt;The technique is to add and subtract numbers of similar magnitude. For summation, you could create an array of 256 for real(4) or 1024 for real(8). Then using integer functions on the element to be summed extract the exponent only of the number, and use it as the index into the array for performing the summation.&lt;/P&gt;

&lt;P&gt;SummationArray(ExtractExponent(X)) = SummationArray(ExtractExponent(X)) + X&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;integer function ExtractExponent(X)
real :: X
ExtractExponent = EXPONENT(X) + EXPONENT(HUGE(X)) ! bias to produce positive indices
&lt;/PRE&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 12:36:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000463#M103526</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-09-25T12:36:35Z</dc:date>
    </item>
    <item>
      <title>Please can you define what</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000464#M103527</link>
      <description>&lt;P&gt;Please can you define what you mean by 'the same'? Do you mean identical to all visible decimal places, or the same up to the n'th decimal place, after which the answers diverge? You are in a difficult place, because with two answers to the same problem (debug, release), how to decide which is closest to the correct the answer?&lt;/P&gt;

&lt;P&gt;Not being conversant with the possible differences that might occur in arithmetic used by debug and release versions, I leave it to others more knowledgeable to advise on that subject.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 13:43:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000464#M103527</guid>
      <dc:creator>Anthony_Richards</dc:creator>
      <dc:date>2014-09-25T13:43:40Z</dc:date>
    </item>
    <item>
      <title>The software I am writing and</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000465#M103528</link>
      <description>&lt;P&gt;The software I am writing and adapting produces 3-D plots. When I say the 'same', I mean that the plots are identical to within 4 decimal places. Given the nature of the uderlying theory that I am using and the type and quality of the data I am working with even 3 decimal places is satisfactory.&lt;/P&gt;

&lt;P&gt;Jim Dempsey's point is intersting and I will investigate.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 14:15:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Different-results-when-running-in-debug-and-optimized-O3-mode/m-p/1000465#M103528</guid>
      <dc:creator>Chris_G_2</dc:creator>
      <dc:date>2014-09-25T14:15:58Z</dc:date>
    </item>
  </channel>
</rss>

