How to get best AVX2 performance from gfortran?

Jerry DeLisle jvdelisle@charter.net
Thu Apr 19 03:40:00 GMT 2018


On 04/18/2018 07:22 AM, Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND 
APPLICATIONS INC] wrote:
> Dear GNU Fortran Gurus,
> 
> I have a question mainly based around AVX2 and flags.
> 
--- snip ---

> 
> So, my questions to you gurus are: Is there something I could try adding 
> to my gfortran options that might help with this discrepancy between 
> Intel AVX2 and GCC? Or perhaps I need to *remove* something (some flag 
> kills the vectorizer)?
> 
> At this point I'm mainly searching for speed for speed's sake so I'm 
> willing to try anything even if it's thought of as "stupid agressive". 
> As long as it doesn't crash the model, I'm willing to try and then check 
> to make sure the world isn't boiling or freezing because I broke reality.
> 
> Matt

Well I have seen some codes pessimized by -O3 so try -O2.  Also 
generally I do -march=native.

Also you may try something like this:

-ffast-math -ftree-vectorize -funroll-loops --param max-unroll-times=4 
-mprefer-avx128

Curious about what you find out, generally speakig one has to fine tune 
to the code being compiled since there are many many factors that can 
influence the outcome.

Regards,

Jerry



More information about the Fortran mailing list