Support #149

Support #150: Align -optimize flags with current compiler releases

Choose backend options for -optimize on icc

Added by Nikhil Jain over 6 years ago. Updated about 1 year ago.

Target version:
Start date:
Due date:
% Done:



NERSC mailing list advised use of -fast -no-ipo as the preferred option for icc compilers on Edison. Phil did that and found issues such as forced static linking, incompatibility with existing libraries etc. However, (in my opinion) we should not discard it if it can help improve performance, hence this task.


#1 Updated by Phil Miller over 6 years ago

The -fast option to icc is nothing special in itself. It's a roll-up of other options, specifically documented in the compiler's help output. It's also specifically documented as not allowing most of those options to be overridden - exactly what we don't want. I think it's preferable to see what -fast does on each modern version (11-13, I guess), and pick out the pieces that can be safely offered as common defaults.

For the record, the referenced message was in commit 370935b1f72b7d861db7d2f6ee8886:

Revert "Add appropriate flags for charmc -optimize when using Intel compilers"

It turns out the -fast flag to icc forces static linking, which is unacceptable
for various reasons (off the top of my head, broken memory allocator choice,
incompatibility with some external libraries, loss of some options for global
privatization in AMPI). The default for -optimize of -O2 should be good enough.

This reverts commit 852b02387d887802a04506d9d33525634c5afaf3.

On Edison, icc 13.0.1 20121010 says the following about -fast:

-fast enable -xHOST -O3 -ipo -no-prec-div -static
options set by -fast cannot be overridden with the exception of
-xHOST, list options separately to change behavior

-Ofast enable -O3 -no-prec-div optimizations

And icc (ICC) 12.1.5 20120612 is the same

On Taub, icc (ICC) 11.1 20100806 says this:

-fast enable -xHOST -O3 -ipo -no-prec-div -static
options set by -fast cannot be overridden with the exception of
-xHOST, list options separately to change behavior

With no -Ofast on offer.

As noted, forced static linking is not acceptable. Compiling with -ipo enabled also requires that the entire stack and application code also be compiled with -ipo. This is a very heavy hammer, and can make compilation much slower for unpredictable gain. That's the sort of thing I would actually put in charmc's -production flag.

Beyond those, we're left with -xHOST -O3 -no-prec-div. We should definitely have appropriate -x options to select the best available instruction sets for a given machine, but we're not guaranteed that the head nodes on which users will compile will actually match the compute nodes. Enabling -no-prec-div is making a policy decision on computational accuracy that I don't think we can usurp from individual application developers - numerical code shouldn't be that sensitive, but we shouldn't knowingly and without possibility of override break it if it is.

Finally, there's -O3:

-O1 optimize for maximum speed, but disable some optimizations which
increase code size for a small speed benefit

-O2 optimize for maximum speed (DEFAULT)

-O3 optimize for maximum speed and enable more aggressive optimizations
that may not improve performance on some programs

-O same as -O2

-Os enable speed optimizations, but disable some optimizations which
increase code size for small speed benefit

This is the set that I think we should actually be choosing from. Which we pick should be a result of benchmarks, not rhetoric.

#2 Updated by Phil Miller over 6 years ago

  • Subject changed from Explore -fast option for icc to Choose backend options for -optimize on icc
  • Description updated (diff)

#3 Updated by Phil Miller over 6 years ago

  • Parent task set to #150

Put this below a generalized audit task for other backend compilers.

#4 Updated by Eric Bohm over 6 years ago

  • Assignee set to Phil Miller

#5 Updated by Eric Bohm almost 3 years ago

  • Tracker changed from Bug to Support

#6 Updated by Phil Miller over 1 year ago

  • Assignee changed from Phil Miller to Eric Bohm

#7 Updated by Sam White about 1 year ago

Separate issue to enable link-time optimization:

Also available in: Atom PDF