Ocean Modeling Discussion

ROMS/TOMS

Search for:
It is currently Sun Sep 24, 2017 3:33 pm




Post new topic Reply to topic  [ 3 posts ] 

All times are UTC

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

Joined: Wed Dec 31, 2003 6:16 pm
Posts: 664
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:
[https://gcc.gnu.org/wiki/FloatingPointMath]
" ... 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

-john


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

Joined: Tue May 06, 2003 4:35 pm
Posts: 46
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 12, 2017 3:43 pm 
Offline

Joined: Fri Jan 20, 2017 5:29 pm
Posts: 32
Location: Graduate School of Oceanography,URI
Hi John,
Which version of gfortran are you using?
Xiaohui


Top
 Profile  
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