[Top][All Lists]

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

Re: pb with -ffast-math

From: Jaroslav Hajek
Subject: Re: pb with -ffast-math
Date: Wed, 15 Apr 2009 19:56:30 +0200

On Tue, Apr 14, 2009 at 9:54 AM, Alain Baeckeroot
<address@hidden> wrote:
> Hi
> i builded octave with additional optimisation flags
>> FFLAGS = -O -mieee-fp -march=native
>> XTRA_CFLAGS =  -mieee-fp -march=native
>> XTRA_CXXFLAGS =  -mieee-fp -march=native
> Adding just -march=native is fine, and it seems that the build
> is significantly faster (10-20%) than the one shipped with my distro
> (debian lenny 32bit, on core2duo T5550)

That's highly probable. The distro binaries are meant to be universal
and so are not typically compiled with march.

> All tests are OK (but 2 expected failures).
> when i add the -ffast-math option, it builds, but segfault at runtime:

Currently, the flags are used for nearly all the code, and ffast-math
breaks certain parts, especially those examining fp environment at
runtime. Maybe this will be resolved in the future.

> $ make
> ...
> Octave successfully built.  Now choose from the following:
>   ./run-octave    - to run in place to test before installing
>   make check      - to run the tests
>   make install    - to install
> make[1]: quittant le répertoire « /opt/octave-3.0.5 »
> $ ./run-octave
>  ** On entry to octave parameter number 13 had an illegal value
> Erreur de segmentation
> 1/ Is it normal ?

Yes, see above.

> 2/ Are there some optimisation flags i should set to
> improve speed. We have numerous independant short computations, and
> need no precision (2 significant digit is good enought)
> I thought to add -funsafe-math-optimizations -ffinite-math-only ,
> but only after trying simpler stuff.

I use -O3 -march=native -funroll-loops and get good results.

> And this is really not important, i doubt we can get another 20%
> speed improvement.
> Alain.

Depending on your code, you may get even much better improvements by
switching to the development sources (it seems you use 3.0.5). An
instance is the experience of F. Potorti:


RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic

reply via email to

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