-
-
Notifications
You must be signed in to change notification settings - Fork 684
Description
We should compile Sage with the extra compile argument -march=native for extra performance, at least if SAGE_FAT_BINARY is not set.
In gcc/spkg_configure.ac we check, whether the argument -march=native is accepted.
In build/make/Makefile.in we assemble the flags.
We add -march=native to the compiler flags, if not building fat binaries and the compiler and the package accepts it.
During the build of sage there are now the following flags that can be exported in spkg_install.in with one line, instead of checking SAGE_DEBUG etc. for each individual package, e.g. by
export CFLAGS=$CFLAGS(redundant, use flags as above with-march=nativeif possible)export CFLAGS=$CFLAGS_NON_NATIVE(flags as above without-march=native)export CFLAGS=$CFLAGS_O3(O3instead ofO2, but only if not in debug mode, add-march=nativeif possible)export CFLAGS=$CFLAGS_O3_NON_NATIVE(O3instead ofO2, no-march=native)export CFLAGS=$ORIGINAL_CFLAGS(use$CFLAGSas set beforeconfigure)
Likewise we do with CXXFLAGS, FCFLAGS, F77FLAGS.
We try to respect the users choice and do not overwrite the flags if already set by the user, but only add compile flags if absolutely necessary for packages to work.
Inidividual packages can still be compiled with specified flags or in debug mode using
make CFLAGS=-O2 some-package
or
make SAGE_DEBUG="yes" some-package
Depends on #30375
CC: @sophiasage @vbraun @embray @kiwifb
Component: build
Keywords: Intrinsics, SIMD
Author: Jonathan Kliem
Branch: 7bc1f28
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/27122