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

Optimization and different servers

tomfmguy_com
Beginner
550 Views

Hello.

I have two questions that I was hoping you could help me with.

1.Why do I get slightly different results when I compile my code using different optimization options (-O1, -O2 and -O3)? Is this normal?

2.Why do I get slightly different results when I run my code on different servers (both linux, 64 bit, using intel fortan 10)? Is this normal?

Reagards,

Tom.

0 Kudos
2 Replies
stefan_m
Beginner
550 Views

Dear Tom,

I'll try to answer question 1.

Does your code involve floating-point operations? If so, then: yes, this is normal. Optimization may change the order of algebraic operations. Due to round-off errors, this can lead to slightly different results (or even very different results, if your algorithm is not numerically stable). Try e.g. the compiler options

-fp-model precise

or

-fp-model strict

and see if the difference in your results gets smaller.

Best wishes,

Stefan

0 Kudos
TimP
Honored Contributor III
550 Views
Quoting - tomfmguy.com

Hello.

I have two questions that I was hoping you could help me with.

1.Why do I get slightly different results when I compile my code using different optimization options (-O1, -O2 and -O3)? Is this normal?

2.Why do I get slightly different results when I run my code on different servers (both linux, 64 bit, using intel fortan 10)? Is this normal?

Reagards,

Tom.

Some of the differences may be eliminated by using -prec-div -prec-sqrt -assume protect_parens. The other suggestion about -fp-model would accomplish some of the same things. I would suggest that you use ifort 10.1 or 11.0, and specify the level of SSE optimization (e.g. -xO) rather than using a -host option.

0 Kudos
Reply