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.

v Partitioning and layout of static data according to reference<br />

affinity. (Data that is frequently referenced together will be<br />

located closer together in memory.)<br />

This is the default level when -qipa is specified.<br />

level=2 Global alias analysis, specialization, interprocedural data flow.<br />

v Whole-program alias analysis. This level includes the<br />

disambiguation of pointer dereferences and indirect function<br />

calls, and the refinement of in<strong>for</strong>mation about the side effects of<br />

a function call.<br />

v Intensive intraprocedural optimizations. This can take the <strong>for</strong>m<br />

of value numbering, code propagation and simplification, code<br />

motion into conditions or out of loops, elimination of<br />

redundancy.<br />

v Interprocedural constant propagation, dead code elimination,<br />

pointer analysis.<br />

v Procedure specialization (cloning).<br />

inline=inline-options<br />

Provides precise user control of inlining.<br />

fine_tuning<br />

Other values <strong>for</strong> -qipa= provide the ability to specify the behavior<br />

of library code, tune program partioning, read commands from a<br />

file, and so on.<br />

Getting the Most from -qipa<br />

It is not necessary to compile everything with -qipa, but try to apply it to as much<br />

of your program as possible. Here are some suggestions.<br />

v When specifying optimization options in a makefile, remember to use the<br />

compiler command (xlf, xlf90, and so on) to link, and to include all compiler<br />

options on the link step.<br />

Optimizing Subprogram Calls<br />

v<br />

v<br />

v<br />

v<br />

v<br />

v<br />

-qipa works when building executables or shared objects, but always compile<br />

main and exported functions with -qipa.<br />

When compiling and linking separately, use -qipa=noobject on the compile step<br />

<strong>for</strong> faster compilation.<br />

Ensure that there is enough space in /tmp (at least 200 MB), or use the TMPDIR<br />

environment variable to specify a different directory with sufficient free space.<br />

The level suboption is a throttle. Try varying it if link time is too long.<br />

Compiling with -qipa=level=0 can be very beneficial <strong>for</strong> little additional link<br />

time.<br />

Look at the generated code after compiling with -qlist or -qipa=list. If too few<br />

or too many functions are inlined, consider using -qipa=inline or<br />

-qipa=noinline. To control inlining of a specific function, use -Q+ and -Q−.<br />

If your application contains a mixture of <strong>Fortran</strong> and C or C++ code compiled<br />

with <strong>IBM</strong> <strong>XL</strong> C/C+ compilers, you can achieve additional optimization by<br />

compiling all your code with the -qipa option.<br />

If a program has many subprogram calls, you can use the -qipa=inline option to<br />

turn on inlining, which reduces the overhead of such calls. Consider using the -p<br />

or -pg option with prof or gprof, respectively, to determine which subprograms are<br />

called most frequently and to list their names on the command line.<br />

To make inlining apply to calls where the calling and called subprograms are in<br />

different scopes, include the -qipa option.<br />

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

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

Saved successfully!

Ooh no, something went wrong!