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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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 />

implementati<strong>on</strong> may greatly improve 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<br />

library and use it, see http://developer.amd.com/assets/acml_userguide.pdf.<br />

-fno-rtti. This switch disables generati<strong>on</strong> of in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> about every class, with virtual functi<strong>on</strong>s, <str<strong>on</strong>g>for</str<strong>on</strong>g><br />

use by the C++ runtime type identificati<strong>on</strong> features (dynamic_cast and typeid). If the user does not<br />

use those parts of the language, some space can be c<strong>on</strong>served by using this switch.<br />

Generate 32-<str<strong>on</strong>g>Bit</str<strong>on</strong>g> Binaries with -m32. The user can also use <str<strong>on</strong>g>64</str<strong>on</strong>g>-bit GCC compilers to generate<br />

32-bit binaries by using the -m32 switch. This can improve per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance if the program has lots of<br />

variables of the type l<strong>on</strong>g and/or pointers. As these data-types are 32-bit in x86, this switch will<br />

reduce the memory footprint of the program. Also, the user should use the recommended switches <str<strong>on</strong>g>for</str<strong>on</strong>g><br />

the 32-bit GCC compiler (secti<strong>on</strong> 3.8.4 <strong>on</strong> page 32) when -m32 is used.<br />

Users can obtain more details <strong>on</strong> these switches by trying info gcc <strong>on</strong> their Linux systems.<br />

3.3 Intel <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s (<str<strong>on</strong>g>64</str<strong>on</strong>g>-<str<strong>on</strong>g>Bit</str<strong>on</strong>g>) <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux ®<br />

Intel provides <str<strong>on</strong>g>64</str<strong>on</strong>g>-bit compilers <str<strong>on</strong>g>for</str<strong>on</strong>g> Linux that can be used <str<strong>on</strong>g>for</str<strong>on</strong>g> AMD<str<strong>on</strong>g>64</str<strong>on</strong>g> systems. The current versi<strong>on</strong><br />

(as of Augus 2007) is 10.0. All opti<strong>on</strong>s described in this secti<strong>on</strong> apply to this versi<strong>on</strong>.<br />

3.3.1 Invocati<strong>on</strong> Commands<br />

The following commands invoke specific compilers:<br />

icpc invokes the C++ compiler.<br />

icc invokes the C compiler.<br />

i<str<strong>on</strong>g>for</str<strong>on</strong>g>t invokes the Fortran compiler.<br />

3.3.2 Generic Per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance Switches<br />

The switches -xW -ipo -O3 -static are generally recommended.<br />

3.3.3 Other Switches<br />

In additi<strong>on</strong> to the generic per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance switches, it is worth experimenting with the following<br />

switches.<br />

Profile Guided Optimizati<strong>on</strong>. Intel compilers allow profile guided optimizati<strong>on</strong>. Use the<br />

following steps <str<strong>on</strong>g>for</str<strong>on</strong>g> profile guided optimizati<strong>on</strong> with Intel compilers.<br />

1. Compile the program with the -prof_gen switch. The -ipo or -ip switch is ignored by the compiler<br />

if used with -prof_gen.<br />

2. Run the executable produced in Step 1. Running this executable generates several files with profile<br />

in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> (*.dyn and *.dpi).<br />

3. Recompile the program with the -prof_use switch. It is recommended to also use the -ipo switch<br />

in this stage.<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 25

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

Saved successfully!

Ooh no, something went wrong!