Ocean Modeling Discussion


Search for:
It is currently Sat Mar 23, 2019 9:01 pm

Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

Author Message
PostPosted: Mon Sep 11, 2017 7:46 pm 

Joined: Wed Dec 31, 2003 6:16 pm
Posts: 762
Location: USGS, USA
Dear all-

I want to strongly encourage removal of gfortran compiler flag: -ffast-math

My recent experience shows this compiler option is not a good choice. The documentation is stating:
" ... the -ffast-math flag which is a shortcut for several options, presenting the least conforming but fastest math mode. It enables -fno-trapping-math, -funsafe-math-optimizations, ...."

Further the "-funsafe-math-optimizations" says "... enables optimizations that allow arbitrary reassociations and transformations with no accuracy guarantees."

This has been a bad experience for me that past few weeks. I have been trying to get a N-S periodic test to run, but it would not maintain periodicity. I finally removed this -ffast-math flag, recompiled, and now all is well.

This is reminiscent of the ifort -fprecise flag, but that is a different story.

In summary: I highly recommend that if you use gfortran you consider to remove the -ffast-math flag from Compilers:
Compilers/Linux-g95.mk:94: FFLAGS += -O3 -ffast-math
Compilers/Darwin-gfortran.mk:92:# FFLAGS += -O3 -ffast-math
Compilers/MINGW-gfortran.mk:81: FFLAGS += -O3 -ffast-math
Compilers/Linux-path.mk:104:# FFLAGS += -O3 -OPT:Ofast -fno-math-errno -ffast-math
Compilers/Linux-gfortran.mk:91: FFLAGS += -O3 -ffast-math
Compilers/CYGWIN-g95.mk:87: FFLAGS += -O3 -ffast-math
Compilers/CYGWIN-gfortran.mk:99: FFLAGS += -O3 -ffast-math
Compilers/MINGW-g95.mk:79: FFLAGS += -O3 -ffast-math


Reply with quote  
PostPosted: Tue Sep 12, 2017 12:38 pm 

Joined: Tue May 06, 2003 4:35 pm
Posts: 53
Location: University of Concepcion
I've once heard a similar comment about the -O3 flag, from the IT manager of a modeling group, he was describing it as "aggressive paralelization".

Any experience between -O3 and -O2 ?

In the last ROMS_AGRIF (3.1.1) and CROCO the default flags for gfortran are

FFLAGS1="-O3 -fdefault-real-8 -fdefault-double-8 -mcmodel=medium"

Andres Sepulveda

Geophysics Department
University of Concepcion

Reply with quote  
PostPosted: Tue Sep 12, 2017 3:43 pm 
Hi John,
Which version of gfortran are you using?

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group