[GenABEL-dev] default CXXFLAGS in OmicABELnoMM's configure.ac

L.C. Karssen l.c.karssen at polyomica.com
Fri Sep 12 10:20:33 CEST 2014


Dear Alvaro, dear all,

I was going through OmicsABELnoMM's configure.ac and found the following
lines where you set the default compiler flags:

# Set some default compile flags
if test -z "$CXXFLAGS"; then
   # User did not set CXXFLAGS, so we can put in our own defaults
   CXXFLAGS=" -O3  -march=corei7 -mfpmath=sse -mtune=corei7 -flto
-funroll-loops"
fi

I was wondering why you explicitly set -march=corei7 and -mtune=corei7.
IMHO this is too specific and will break on other machines. The GCC
manual [1] specifies the following:
"-march=cpu-type allows GCC to generate code that may not run at all on
processors other than the one indicated."

According to the manual, the -march option has an argument 'native':

"This selects the CPU to generate code for at compilation time by
determining the processor type of the compiling machine. Using
-march=native enables all instruction subsets supported by the local
machine (hence the result might not run on different machines). Using
-mtune=native produces code optimized for the local machine under the
constraints of the selected instruction set."

The way I interpret that is that using -march=native tells the compiler
to use the correct option for the current machine (be it corei7, core2,
or whatever CPU the user has).

Moreover, the manual says: "Specifying -march=cpu-type implies
-mtune=cpu-type." So we only need to specify -march here. Therefore I
would suggest to change this line to:
 CXXFLAGS=" -O3  -march=native -mfpmath=sse -flto -funroll-loops"

What do you think?


As a side note: the manual [1] also says that -mfpmath=sse is the
default choice for the x86_64 compiler, so we can remove that option as
well.


Best regards,

Lennart.


[1]
https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/i386-and-x86_002d64-Options.html
-- 
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Lennart C. Karssen
PolyOmica
Groningen
The Netherlands

l.c.karssen at polyomica.com
GPG key ID: 1A15AF2A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.r-forge.r-project.org/pipermail/genabel-devel/attachments/20140912/4706d5cd/attachment.sig>


More information about the genabel-devel mailing list