-mtune=core2 hard coded into CFLAGS?

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Posts: 49
Joined: 2013-12-13T09:54:14-07:00
Authentication code: 6789

-mtune=core2 hard coded into CFLAGS?

Post by BrianP007 »

In building binaries for mass use, it may make sense to shoot for the least common denominator hardware so the code will run most everywhere.

When building for my system, I find that building for -march=native and -mtune=<my_exact_CPU> runs vastly faster.
Indeed, I have measured a 6:1 speed boost in fully optimized code vs the binary from cybercom.net in DCRaw.exe!

Core2 is one step above Pentium << Nixon-administration-#1 era? At least it's not i386! :)

I find that even when I attempt to shoehorn my -MTune in with the CFLAGS, the venerable CORE2 spec succeeds mine in the actual make spew:
... -mtune=broadwell<knightslanding does not compute... :\( > -Wall -mtune=core2 ...

I can only hope GCC is smart enough to see the conflict and pick the right one.

It might be better to not make strain GCC's desperately tenuous grip on reality by forcing it to choose.


While we are at it, Intel recommends a bunch of compiler optimizations for GCC for the newer CPUs [GCC x86 performance hints https://software.intel.com/en-us/blogs/ ... ance-hints]

I build all my programs with "gcc -ffast-math -m64 -Ofast -march=native -fopenmp -funroll-loops -flto ... " and have found only 1 case in which I needed to drop the FullLinkTimeOpt, -flto, option to get a link.

Will these "localized sub-optimizations", as Click & Clack might have called them, melt IM?

User avatar
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: -mtune=core2 hard coded into CFLAGS?

Post by magick »

> when I attempt to shoehorn my -MTune in with the CFLAG

Have you tried 'configure --with-gcc-arch=<arch>'?