24.05.2014 Views

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

XL Fortran Enterprise Edition for AIX : User's Guide - IBM

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.

Summary of Compiler Options <strong>for</strong> Optimization<br />

The following table describes the compiler options that have the most effect on<br />

per<strong>for</strong>mance. You can experiment with different combinations of compiler options<br />

to see which options are most suitable <strong>for</strong> your application.<br />

Table 20. Compiler options <strong>for</strong> optimization<br />

Option<br />

Overview<br />

-O0 or -qnoopt The compiler per<strong>for</strong>ms very limited optimization. This is the default<br />

optimization level. Be<strong>for</strong>e you start optimizing your application, ensure<br />

that it compiles and executes successfully at optimization level 0.<br />

-qarch<br />

-qtune<br />

The compiler generates instructions <strong>for</strong> the specified processor<br />

architecture. This option allows the compiler to take advantage of<br />

processor instructions that exist on the specified architecture but do not<br />

exist on other architectures.<br />

The compiler optimizes the application <strong>for</strong> the specified processor<br />

architecture. The application will run on all of the processors specified<br />

by the -qarch option, but its per<strong>for</strong>mance will be tuned <strong>for</strong> the<br />

processors specified by the -qtune option.<br />

-O2 The compiler per<strong>for</strong>ms basic optimization. This option provides a<br />

balance between compilation speed and run-time per<strong>for</strong>mance.<br />

-O3 The compiler per<strong>for</strong>ms aggressive optimization, including optimizations<br />

that are memory-intensive, compile-time-intensive, or both.<br />

-qhot<br />

-qcache<br />

-qipa<br />

The compiler per<strong>for</strong>ms additional loop optimization, automatic<br />

vectorization, and optionally per<strong>for</strong>ms array padding. This option is<br />

most useful <strong>for</strong> scientific applications that contain numerical processing.<br />

If you want better per<strong>for</strong>mance than -O3 with less compile time than<br />

-O4, try -O3 -qhot.<br />

The compiler assumes that the processor will have the specified cache<br />

configuration. This option can improve per<strong>for</strong>mance if all of the<br />

processors that execute the application have the same non-default cache<br />

configuration.<br />

The compiler per<strong>for</strong>ms interprocedural analysis to optimize the entire<br />

application as a unit. This option is most useful <strong>for</strong> applications that<br />

contain a large number of frequently used routines. In many cases, this<br />

option significantly increases compilation time.<br />

-O4 This is equivalent to: -O3 -qipa -qhot -qarch=auto -qtune=auto<br />

-qcache=auto<br />

-O5 This is equivalent to: -O4 -qipa=level=2<br />

-qpdf1<br />

-qpdf2<br />

The compiler uses profile-directed feedback to optimize the application<br />

based on an analysis of how often your application executes different<br />

sections of code.<br />

Choosing an Optimization Level<br />

Optimization requires additional compilation time, but usually results in a faster<br />

run time. <strong>XL</strong> <strong>Fortran</strong> allows you to select whether you want optimization to be<br />

per<strong>for</strong>med at compile time. By default, the compiler per<strong>for</strong>ms very limited<br />

optimization (-O0 or -qnoopt).<br />

To enable compiler optimization, specify the -O compiler option with an optional<br />

digit that signifies the level. The following table summarizes compiler behavior at<br />

each optimization level.<br />

Optimizing <strong>XL</strong> <strong>Fortran</strong> Programs 307

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

Saved successfully!

Ooh no, something went wrong!