CPUFlags
CPUFlags is a small perl-script serving as a database for compiler-optimisation flags on different hardware-platforms and processors.
I simply was tired of setting up each Makefile with the right parameters and wanted to have an automatic procedure for this. The result might not be optimal, e.g. the database could grow quite large, but it works.
The list of known operating systems contains Linux, Solaris, Darwin (MacOSX) and (to some degree) AIX, Irix, HP-UX, Tru64 and Windows. Various compilers are supported like GCC-2/3/4, Intel-CC, Portland-CC, Sun-CC, Kai-CC, IBM-xlC, Mips-CC, Compaq-CC, Visual-C++ etc. .
You are welcome to send options for platforms/processors which are currently not supported by CPUFlags to me.
Changes
v0.8.2
- Support for GCC up to v4.9, ICC up to v13, Clang up to v3.4 and Open64
- Support for Intel Sandybridge, Ivybridge and Haswell processors and AMD Barcelona CPUs
v0.8.1
- Support for Power5, Power6 CPUs and Penryn CPU
- updated CPU detection under Darwin
v0.8.0
- optional output of compiler flags for warnings added, e.g. “-Wall”
(dependend on compiler and language, e.g.
gcc
vs.g++
) - support for GCC-4.4, Intel-CC v9/10/11 and Sun-Studio 10/11 added
- some new Core2 and Opteron processors added
- switched processor detection in Solaris to
prtdiag
v0.7.2
- Core Duo/Core2 support and new Opteron model
- print reason of error (e.g. which model is unknown)
- colour support for better readability in case of error
- some source code improvements
v0.7.1
- bug in handling of pentium3 fixed
- detection of newer IBM VisualAge C++ compilers added
v0.7.0
- removed flag
–compver
- support for Microsoft Windows added
- cleaned up some variable declarations
v0.6.11
- added model number for dual-core opteron processors
- changed version and flag handling of Sun compilers
v0.6.10
- updated flags for PathScale compilers
- separated Intel compiler v5-v7 and v8-v9 since flags have changed
v0.6.9
- automatic processor detection on HP-UX (PA-RISC)
- support for gcc-4 on Darwin
v0.6.8
- support for pentium4 willamette, prescott, nocona and foster with flags for gcc-3.4, gcc-4.0, icc-8 and icc-9
- CPU-type “p4-xeon” was removed
v0.6.7
- added support for Tru64 and the compaq-C-compiler for EV5, EV5.6, EV6 and EV6.7
- VisualAge-Compiler on AIX is now detected correctly
v0.6.6
- support for gcc-4.0 and vectorisation
- unkown arguments are no longer considered an error, e.g. CC=gcc -Wall
- removed -finline-functions since already included in -O3
- removed AMD Duron since equal (from compiler) to AMD Athlon
- some code cleanups
v0.6.5
- support for IBM VisualAge compiler on MacOSX
- correct detection of various PowerPC processors on MacOSX
v0.6.4
- support for PathScale compiler
- removed -fexpensive-optimizations and -fschedule-insn2
- code restructuring
v0.6.3
- changed parsing of command-line (now with Getopt::Long)
- Darwin modifications
- script is now called via “env perl” to handle different locations of perl
v0.6.2
- changed environment variable CPU to PROCESSOR since it collides with same variable in RedHat
- slightly changed processor detection
- changed flags for centrino with gcc (3.4 vs. pre 3.4)
v0.6.1
- changed “fpmath” to “mfpmath”
- no support of SSE2 in gcc-3.3 or less (corrected)
- new athlon-xp model (Noah Williamsson)
v0.6
- support for Portland compiler on Linux
- remove
-mmmx
and-msse
flags for GCC since these should be implied by-march
- errors in Intel compiler flags for Pentium 3 fixed
- added
-march
flags for Intel compiler - wrong error output fixed
v0.6pre2
- bug in handling of Cygwin removed (Noah Williamsson)
- bugs in compiler detection removed
v0.6pre1
- restructuring of the internal database
- autodetection of compiler version (where possible)
- support for AMD K6, K6-2 and K6-3 (thanks to Noah Williamsson)
- preliminary support for Darwin and CYGWIN (again thanks to Noah Williamsson) and IRIX
- error messages are now printed on stderr
- using flags-field in /proc/cpuinfo in Linux to set support for MMX, SSE, SSE2, 3DNOW for unkown processors
v0.5.8
- -mmx mysteriously reappeared and fixed again (thanks to Jeremy Laine)
- Pentium4 Model 1 is now detected (again thanks to Jeremy)
- (early) support for the AMD Opteron processor
v0.5.7
- added support for Duron-XP processors (thanks to Karsten Kruse)
- added verbosity option to show some of the parsed data (mainly for debug)
v0.5.6
- reading environment variable
CPU
(circumvents cpu detection) - wrong argment for pentium4 processors (-mmx instead of -mmmx)
v0.5.5
- added support for the Intel Centrino (p3-centrino) processor
- added standard optimisation flags (-O) if no processor could be found
v0.5.4
- added support for the VIA C3 Nehemiah (via-c3a) processor
v0.5.3
- added support for AIX running on Power4-CPUs with gcc, xlC and xlC-64
v0.5.2
- initial public release
Usage
Command-Line Options
- --cpu <name>
- Show flags for given CPU identifier <name>.
- automatic detection
- --comp <name>
- Show flags for given compiler <name>.
- cc
- --showcpu
- Show CPU identifier.
- off
- --(no)cflags
- (Don't) print general architecture flags for compiler.
- on
- --(no)opt
- (Don't) print optimisation flags for compiler.
- off
- -32, -64
- Choose between 32 or 64 bit system.
- maximal
- -h, --help
- Print this text.
- -v, --verbose
- Define verbosity level.
- 0
- -V, --version
- Print version number of CPUFlags.
Supported Systems and Compilers
- Linux:
- gcc-2.x, gcc-3.x, icc-(5678), pgi, pathcc
- Solaris:
- gcc-2.x, gcc-3.x, SunCC-(67), kcc
- AIX:
- gcc, xlC
- IRIX:
- gcc, Mips-CC
- Darwin:
- gcc, xlc
- Tru64:
- Compaq-cc
- HP-UX:
- HP Ansi C++ compiler
- Win32:
- Visual C++
Supported Processors
- Linux:
- i386, i486, i586, pentium, pentium-mmx, pentium-pro, p2, p3, p3-sse, p3-centrino, p3-xeon, p4, p4-(w|p|n|f), k6, k6-2, k6-3, athlon, duron, athlon-tbird, athlon-xp, duron-xp, opteron, via-c3a, ppc750, ppc7450
- Solaris:
- ultra1, ultra2, ultra3, ultra3cu
- AIX:
- power4
- IRIX:
- mips4
- Darwin:
- ppc, ppc6XX, ppc750, ppc7450, ppc970
- True64:
- EV5, EV5.6, EV6, EV6.7
- HP-UX:
- PA7x00 und PA8x00
- Win32:
- i386, i486, i586, pentium, pentium-mmx, pentium-pro, p2, p3, p3-sse, p3-centrino, p3-xeon, p4, p4-(w|p|n|f), k6, k6-2, k6-3, athlon, duron, athlon-tbird, athlon-xp, duron-xp, opteron, via-c3a
Links
Here you can find a collection of links regarding compiler optimisation: