[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fortran optimization flags

From: Michael Godfrey
Subject: Re: Fortran optimization flags
Date: Wed, 03 Jun 2015 23:58:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 06/03/2015 08:19 PM, John W. Eaton wrote:
On 06/03/2015 01:44 PM, Rik wrote:
On 05/08/2015 09:00 AM, address@hidden wrote:
Minor question about optimization flags in ./configure
José Luis García Pallero <address@hidden>
05/08/2015 07:45 AM

Octave Maintainers <address@hidden>

text/plain; charset=ISO-8859-1


I've seen (octave 4.0.0 rc4) that after the ./configure step, the
C/C++ compiling order contains the -O2 optimization flags but the
Fortran one contains only the -O. Is there any reason in order to not
use the -O2 flag in Fortran by default?

I think originally there may have been.  For some platforms there wasn't
actually a Fortran compiler, rather there was only a Fortran-to-C
translator and then the C code was compiled.  In that case it was easier
for the C compiler to perform optimization if the input code was
relatively straightforward and had not already been optimized.

But, I would say that this situation has now passed.  Most
distributions, including our MXE distribution for Windows, use gfortran
and it accepts -O2.  I know that I, personally, have been using -O2 in
FFLAGS for several years and never had a problem.

I think if jwe is okay with it then we should change the default
optimization flags on the development branch.

The autoconf macros for Fortran compilers should be doing this for us, but I see we set FFLAGS to -O if it is not already set in the environment when configure runs. That's probably the wrong thing to do. Maybe we should just leave this choice up to the autoconf macro?

Also the gcc and g++ calls contain the -g flag in order to generate
debug symbols, but it is not used in the Fortran call. About the
performance for a normal user (not a developer), has -g any impact?

Someone else will need to speak to this.

I think the only cost is extra disk space. Using -g should not affect code generation.


There should not be any side-effect of leaving -g on for C/C++ and Fortran other than size of the object files. The size difference should make little difference and the presence of debug
data can help with bug reports.  Better to leave -g on.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]