Compiler Flags

Philippe's picture
Submitted by Philippe on Wed, 11/23/2011 - 09:44

Dear all,

yesterday I played around with several compiler flags to see their effect on execution speed of LIGGGHTS. I measured the execution time of the example movingMeshGran in LIGGGHTS 1.4.6 on my desktop machine (Intel Core i7-2600 with 8GB RAM, gcc 4.4.3) with the command

time liggghts < in.movingMeshGran > /dev/null

Results:
no optimization: 1m27.898s
-O : 0m55.417s
-O2 : 0m47.635s
-O2 -ffast-math -march=native -funroll-loops : 0m44.454s
-O2 -ffast-math -march=native -funroll-loops -finline-functions: real 0m44.415s
-O3 : 0m47.273s
-O3 -ffast-math -march=native -funroll-loops : 0m44.697s
-Os -ffast-math -march=native -funroll-loops : 0m46.519s
-O3 -fno-inline -ffast-math -march=native -funroll-loops : 0m44.837s

Execution times vary by about +/- 0.5s from run to run depending on the background load of the machine, so for example the difference between -O2 and -O3 is not significant, but some interesting things can be seen:
* -O3 is not faster than -O2
* inlining seems to be irrelevant to execution time (last example)
* The contributions of -ffast-math, -march=native and -funroll-loops are about the same (not shown in this post)

What do you think about these results? Also, I would like to hear about your experiences with different compilers (icc?) or compiler flags, on any kind of hardware, especially experiences on AMD machines would be very interresting. Please post :)

regards,
Philippe