Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Optimization-dependent results

elquin
Beginner
392 Views
Dear all,

I'm fluid mechanics enginner in south korea.
I'm using Intel Visual Fortran Pro v11.1.065.
The computing is done under Intel Core i5 2500 PC.

Recently, I migrated the huge code from CVF to IVF environment.
I have no idea which compiler option for CVF was used.
Under comparing both results, I found that max. 5 % difference is occured.
From the comparison between optimization option \\Od and \\O3 in IVF environment, the difference is up to 10 %.

I wonder this is acceptable difference.
If there's way to avoid this difference in code, please let me know.

Thank you.
0 Kudos
2 Replies
mecej4
Honored Contributor III
392 Views
A computer model with an error of 10 percent (as compared to experimental results) is probably acceptable in some fields, including fluid mechanics. However, a variation of 10 percent in computed results from a single model/algorithm, suspected to be caused entirely by changes in compiler options, is not acceptable.

Rather than looking for ways to avoid differences, I think that you should put in the effort to track down the causes of the differences. An inaccurate result, no matter how repeatable, is still inaccurate.

There are some major differences in how CVF and IVF treat uninitialized variables, and whether local variables are saved by default, and whether the author of your code assumed a certain kind of treatment of these issues.

Please consult the link "Migrating from CVF" at the top of this forum for details of the differences between CVF and IVF.
0 Kudos
TimP
Honored Contributor III
392 Views
Quoting mecej4
A computer model with an error of 10 percent (as compared to experimental results) is probably acceptable in some fields, including fluid mechanics. However, a variation of 10 percent in computed results from a single model/algorithm, suspected to be caused entirely by changes in compiler options, is not acceptable.

Rather than looking for ways to avoid differences, I think that you should put in the effort to track down the causes of the differences. An inaccurate result, no matter how repeatable, is still inaccurate.

There are some major differences in how CVF and IVF treat uninitialized variables, and whether local variables are saved by default, and whether the author of your code assumed a certain kind of treatment of these issues.

Please consult the link "Migrating from CVF" at the top of this forum for details of the differences between CVF and IVF.

That reference makes several important points about numerics. To elaborate on x87 code, that had the effect of evaluating all expressions in double precision, whether so specified in source code or not. Where your results depend on it, the promotions to double precision should be written in explicitly, rather than depending on code generation option.
In some cases, proper grouping of expressions could improve accuracy of evaluation, e.g.
x*y - x*z => x*(y-z)
a transformation which the compiler can make (or not) as it chooses, unless you write it yourself in the more accurate form.
0 Kudos
Reply