Vincent Labrecque wrote:

> And as I'm writing this, with regards to optimization flags, maybe the  
> sage build system should provide an abstraction over -On.   As I'm  
> sure you know, these have widely differing behaviors across  
> compilers.  Sometimes -O3 will do nothing, sometimes it will break  
> your code.  ``high'', ``medium'' and ``low'' can be translated by an  
> expert on the particular platform (os/compiler/compiler-version).   
> Then again I'm thinking in general terms and maybe in the case of sage  
> people don't build it or change flags so often and you can ignore this)
> 
> --Vincent

Yes, they do widely differ. On Solaris, with Sun's compiler, -O defaults 
to -O3, but Sun say that can change.


I think an environment variable SAGE_OPTIMISATION, which the user can 
set, but which otherwise defaults to something reasonable might be 
sensible.

* i.e, with GNU compilers it defaults to -O3
* With Sun Studio compiler it defaults to -O
* With any other compilers I can work out, I'll default it to something 
reasonable.

But in every case, the user could set SAGE_OPTIMISATION to whatever they 
want. So if they want "-fast -nobreakages" or whatever, they can set it.

Of course, one issue is that not every configure script will

My thoughts for a set of CFLAGS for a default build would be:


-Wall -g -O3

Each of those would be changed where appropriate

i.e. -Wall would not work with Sun compilers, or any other compiler that 
I know of.

-O3 would be changed to -O with the Sun Studio compiler.

-m64 would be added with the GNU or Sun compilers if SAGE64 was set to yes.

SAGE64=yes would not be permitted with a native HP-UX compiler, as HP's 
Fortran compiler can't generate 64-bit code, which seems a bit stupid, 
as HP had 64-bit machines long before they were common place.


Clearly the platforms which we use a lot (linux, OS X, Solaris), finding 
the right flags should be easy. For other platforms, lets take a quick 
stab at them, and leave it to someone more serious about porting to find 
them.

Dave

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to