26.11.2012 Views

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

32035 Rev. 3.22 November 2007<br />

<str<strong>on</strong>g>Compiler</str<strong>on</strong>g> <str<strong>on</strong>g>Usage</str<strong>on</strong>g> <str<strong>on</strong>g>Guidelines</str<strong>on</strong>g> <str<strong>on</strong>g>for</str<strong>on</strong>g> AMD<str<strong>on</strong>g>64</str<strong>on</strong>g> Plat<str<strong>on</strong>g>for</str<strong>on</strong>g>ms<br />

Table 7. Profile Guided Optimizati<strong>on</strong> <str<strong>on</strong>g>for</str<strong>on</strong>g> 32-<str<strong>on</strong>g>Bit</str<strong>on</strong>g> GCC <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux ®<br />

SuSE GCC 4.2.0<br />

(<str<strong>on</strong>g>for</str<strong>on</strong>g> C/C++ and Fortran) and<br />

Red Hat gcc-ssa<br />

(<str<strong>on</strong>g>for</str<strong>on</strong>g> C/C++ and Fortran) and<br />

SuSE GCC 4.2.0<br />

FSF GCC 4.2.0<br />

(<str<strong>on</strong>g>for</str<strong>on</strong>g> C/C++ and Fortran) and<br />

Red Hat GCC 4.2.0<br />

Step 1.Compile the program with -fprofile-arcs.<br />

Step 2.Run the executable produced in Step 1. Running this<br />

executable generates several files with profile<br />

in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> (*.da).<br />

Step 3.Recompile the program with -fbranch-probabilities.<br />

Step 1.Compile the program with -fprofile-generate.<br />

Step 2.Run the executable produced in Step 1. Running this<br />

executable generates several files with profile<br />

in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> (*.da).<br />

Step 3.Recompile the program with -fprofile-use.<br />

-funroll-loops. This switch causes loops, the iterati<strong>on</strong>s of which can be determined at compile time<br />

or entry into the loop to be unrolled. Some loops are there<str<strong>on</strong>g>for</str<strong>on</strong>g>e unrolled.<br />

This switch can be used with all three versi<strong>on</strong>s of the 32-bit GCC <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux.<br />

-Bsymbolic. GCC 4.2 no l<strong>on</strong>ger uses the -Bsymbolic compiler switch. Instead, GCC 4.2 now offers<br />

the -combine -fwhole-program switch combinati<strong>on</strong>, which should be used together. This switch<br />

combinati<strong>on</strong> requires that makefiles be changed to use a single command to compile and link all files<br />

of an applicati<strong>on</strong>, slowing down builds. So the -combine -fwhole-program switch combinati<strong>on</strong>,<br />

should <strong>on</strong>ly be used <str<strong>on</strong>g>for</str<strong>on</strong>g> n<strong>on</strong>-debug builds. Un<str<strong>on</strong>g>for</str<strong>on</strong>g>tunately, these opti<strong>on</strong>s may fail when compiling<br />

some files.<br />

minline-all-stringops. When using the GCC 4.2.0 compiler <strong>on</strong> Red Hat Enterprise Linux 4,<br />

experiment with the switch -minline-all-stringops. This switch is not recommended <str<strong>on</strong>g>for</str<strong>on</strong>g> GCC 4.2.0<br />

<strong>on</strong> SuSE Linux Enterprise Server.<br />

This switch can be used with all three versi<strong>on</strong>s of the 32-bit GCC <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux.<br />

Linking with ACML. The AMD Core Math Library (ACML) includes BLAS, LAPACK and FFT<br />

routines that are optimized <str<strong>on</strong>g>for</str<strong>on</strong>g> AMD Athl<strong>on</strong> <str<strong>on</strong>g>64</str<strong>on</strong>g> and AMD Opter<strong>on</strong> processors. If the program<br />

uses these routines, using ACML in place of generic C/Fortran implementati<strong>on</strong> may greatly improve<br />

the per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance. For additi<strong>on</strong>al details <strong>on</strong> how to install this library and use it, see<br />

http://developer.amd.com/assets/acml_userguide.pdf.<br />

ACML can be used with all 3 versi<strong>on</strong>s of 32-bit GCC <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux discussed in this<br />

applicati<strong>on</strong> note.<br />

Generate 32-bit binaries with -m32. The 32-bit GCC compilers generate 32-bit binaries by<br />

default. The user can also use <str<strong>on</strong>g>64</str<strong>on</strong>g>-bit GCC compilers to generate 32-bit binaries by using the -m32<br />

switch. Use the switches recommended in this secti<strong>on</strong> al<strong>on</strong>g with the -m32 switch.<br />

This switch can be used with all three versi<strong>on</strong>s of the GCC <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux talked about here.<br />

Chapter 3 Per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance-Centric <str<strong>on</strong>g>Compiler</str<strong>on</strong>g> Switches 33

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!