Compiling options for speed optimization

Dear friends,

Please, I would like to ask for your recommendations on the best compiling options for optimizing code speed performance. I use the last version of GFortran.

Tipically, I use -Ofast, but I don’t know if this is enough. The website of GFortran states that adding
-fcoarray = simple, -lcaf_single improves speed. I’ve tested it, but the result was the opposite, it was slower.

Many thanks for your help.

With gfortran I use -O3 -march=native -ffast-math -funroll-loops with good results. I believe the -Ofast enables all those.

Yes, what @kargl said is correct. I develop in Debug mode with the options -Wall -Wextra -Wimplicit-interface -fPIC -g -fcheck=all -fbacktrace. Then in Release mode with the options I suggested above, I always test that the numerical results are acceptable in terms of accuracy against the Debug mode results.

@kargl, @certik, many thanks for your help.

1 Like

I’ve never used this -ftree-vectorize (which I found on the gcc man page), which seems interesting :slightly_smiling_face: (but I am not sure what “tree” means here so need to read man pages more…)