I will start with my personal experience in our lab. Back in the ifort 9 and 10 days, we used to be quite aggressive with the optimizations, compiling with -O3 and processor specific flags (-xW -xSSE4.2 for example). But starting with ifort 11, we started to notice: 1. some inconsistencies in the results (because semantics were not preserved) 2. smaller gains compared to -O2. So currently, we usually simply compile with -O2 and -xhost. Do you have better suggestions with ifort 11? Will this change once again as we transition to ifort 12? Thanks in advance.
Intel Fortran Compiler: tips on optimization at compilation
performance;hpc;compiling;fortran
We strongly recommend all our users start with -O3 -xHost -ipo for both ifort 11 and ifort 12.  If there are particular floating point transformations enabled by O3 that affect the precision of some of your computations, you can turn those specifically off with -fp-model precise -fp-model except (or, more drastically, -fp-model strict) while retaining the other optimizations O3 enables, such as loop blocking for cache, loop fusion and unrolling, and memory access optimizations.   I'd advise trying the floating point model stuff on individual files and finding out where it makes a difference, rather than turning it off globally; it can be a ~15% speed bump, and you want to be able to keep that where it doesn't affect your calculations.  If you're not sure where the precision is being affected, you can play with turning on and off the floating point model flags for those files, or playing with rounding modes.We recently gave a short talk to our users about optimization flags, focusing on the gnu and intel compilers for x86; you can see the slides from that talk here.Incidentally, while we're talking about choosing optimization flags for your code, every now and then it's also worth looking at the output of -vec-report to see where the compiler attempted to vectorize a loop and couldn't; sometimes there are small changes you can make to your loop which can result in vectorization being possible (which can be a 4x speedup).   Similarly for the more general -opt-report.