IVF compiler setting for maximizing numerical fidelity

IVF compiler setting for maximizing numerical fidelity

With respect to IVF, the following compiler settings are recommended for maintaining numerical fidelity in results:

/Od
inline-level=2
ip -ipo
fp-model precise
fp-model source
fpconstant
prec-sqrt

I fully appreciate that some compiler settings are not settable via the IDE but I would like find these if possible:

• Under Project Property Pages|Fortran\\Optimization, I find /Od under Optimization

• For inline, I only find inline Function Expansion and no 'level=2'

• For fp-ipo, I find nothing.  What is "IPO"?

•For fp-model precise & fp-model source, I go to Project Property Pages|Fortran\\Floating Point and under Floating Point Model I find a switch that appears to combine these two (/fp:precise)

• I do not find 'prec-sqrt'

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Where did you get this list?  -ipo is /Qipo, or Whole-program Interprocedural Optimization.  I would think you'd be better off to leave that off by default.  For Fortran, the models precise and source mean the same thing.  In C++ they are a bit different.

I don't agree with that list, and it uses the Linux spellings.  fpconstant is /assume:fpconstant and I recommend NOT using that.  Instead, make sure that all your floating point constants are the correct kind (double precision where required, etc.)

-prec-sqrt is /Qprec-sqrt and there is no IDE option for it.

/Od is disabling optimization - a rather big hammer.

-inline-level=2 is the default.  This is /Ob2 on Windows.

You may want to add /assume:protect_parens (no IDE property)

Retired 12/31/2016

/fp:source and /fp:precise should be the same for ifort (about the same as /fp:source for icl).  They should include /Qprec-sqrt /assume:protect_parens

Your meaning of numerical stability seems hard to pin down, and I won't quibble about that.

As Steve said, /assume:fpconstant is meant to override a specification of Fortran standard, but if you want stability, you should make your source code conform to standard.

PS:

fp:constant is one of 7 switch settings for CVF listed in Chapter 4 of:

Michael
Etzel and Karen Dickinson
, Digital Visual Fortran
Programmer’s Guide, Digital Press, 1999, Butterworth-Heinemann

As reported to me,
Use
of all of these switches will remove code transformation and constrain CVF
numerical operations.

fp:constant may still be a bad choice per Steve but I wanted to indicate where it came from.

/fpconstant is there to make up for a bad programming practice, common in F77 codes.  For example:

DOUBLE PRECISION PI
PI = 3.1415926535897

The programmer who writes this thinks that all the digits of the constant will be used, but this is the form of a single-precision constant.  Fortran 77 didn't really say what happens when the assignment is done with the "extra" digits, and many older compilers (including the DEC F77 compilers) would keep floating point constants around in the highest available precision, rounding down when needed.

The Fortran 90 standard established that the constant above is single-precision and therefore rounds to about 7 digits, even when assigned to a double-precision variable, so you lose the digits.  The correct way of writing this would be to put a D0 at the end of the constant, or use a kind specifier as of Fortran 90.  Our compiler follows the Fortran 90 interpretation, but we added /fpconstant (not /fp:constant!) to give the old behavior and make buggy older programs give the results the programmer expected.  It has no effect on arithmetic operations.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today