wkitty42 wrote in Sat Aug 10, 2019 9:55 pm:i generally use these in my wrapper script to i build the same every time... the following is for a normal release type build...
- Code: Select all
CFLAGS="-march=native" CPPFLAGS="-march=native" $MYFGBASEDIR/dnc.sh -a n -p n -j $(($(nproc)-1)) -b RelWithDebInfo -f Release PLIB OSG SIMGEAR FGFS DATA
@wkitty,
"-march=native" may not be doing what you think it is doing. It will produce good code, but not necessarily the best code for your hardware.
Run this code to see what GCC believes your chipset is:
- Code: Select all
gcc -march=native -Q --help=target | grep -- '-march='
broadwell
Run this code to see what hardware the code is being tuned for:
- Code: Select all
gcc -march=native -Q --help=target | grep -- '-mtune='
generic
Run this to understand what family of instructions is being generated:
- Code: Select all
gcc -mtune=generic -Q --help=target | grep -- '-march='
x86-64
So this implies that the compiler is generating code that is optimized
generically for all x86-64 machines but will run best on the broadwell chipset.
Run this to get a better optimization strategy:
- Code: Select all
gcc -march=broadwell -Q --help=target | grep -- '-mtune='
broadwell
This implies that the compiler is generating code that is optimized for broadwell machines that support the broadwell chipset or better. The code will fail to execute on any machine not supporting the broadwell instruction set.
Scott