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

Create successful ePaper yourself

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

-qipa=list<br />

cross-file type checking of external variables and functions. This<br />

option requires the linker -btypchk option to be active.<br />

Instructs the compiler to emit an object listing that provides<br />

in<strong>for</strong>mation <strong>for</strong> IPA optimization.<br />

Different Results in Optimized Programs<br />

Here are some reasons why an optimized program might produce different results<br />

from those of an unoptimized one:<br />

v<br />

v<br />

v<br />

Optimized code can fail if a program contains code that is not valid. For<br />

example, failure can occur if the program passes an actual argument that also<br />

appears in a common block in the called procedure, or if two or more dummy<br />

arguments are associated with the same actual argument.<br />

If a program that worked without optimization fails when compiled with it,<br />

check the cross-reference listing and the execution flow of the program <strong>for</strong><br />

variables that are used be<strong>for</strong>e they are initialized. Compile with the<br />

-qinitauto=hex_value option to try to produce the incorrect results consistently.<br />

For example, using -qinitauto=FF gives REAL and COMPLEX variables an<br />

initial value of ″negative not a number″ (-NAN). Any operations on these<br />

variables will also result in NAN values. Other bit patterns (hex_value) may<br />

yield different results and provide further clues as to what is going on.<br />

(Programs with uninitialized variables may appear to work properly when<br />

compiled without optimization, because of the default assumptions the compiler<br />

makes, but may fail when compiled with optimization. Similarly, a program may<br />

appear to execute correctly when optimized, but fails at lower optimization<br />

levels or when run in a different environment.)<br />

Use with caution debugging techniques that rely on examining values in storage.<br />

The compiler might have deleted or moved a common expression evaluation. It<br />

might have assigned some variables to registers, so that they do not appear in<br />

storage at all.<br />

Related In<strong>for</strong>mation: See “-g Option” on page 108, “-qinitauto Option” on page<br />

177, and “Problem Determination and Debugging” on page<br />

369.<br />

Compiler-friendly Programming<br />

Compiler-friendly programming idioms can be as useful to per<strong>for</strong>mance as any of<br />

the options or directives. Here are some suggestions.<br />

General<br />

v Where possible, use command invocations like xlf90 or xlf95 to enhance<br />

standards con<strong>for</strong>mance and code portability. If this is not possible,<br />

consider using the -qnosave option to have all local variables be<br />

automatic; doing this provides more opportunities <strong>for</strong> optimization.<br />

v Use modules to group related subroutines and functions.<br />

v Consider using the highly tuned MASS and ESSL libraries rather than<br />

custom implementations or generic libraries.<br />

Hand-tuning<br />

v Do not excessively hand-optimize your code. Unusual constructs can<br />

confuse the compiler (and other programmers), and make your<br />

application difficult to optimize <strong>for</strong> new machines.<br />

v Do limited hand tuning of small functions by inlining.<br />

322 <strong>XL</strong> <strong>Fortran</strong> <strong>Enterprise</strong> <strong>Edition</strong> <strong>for</strong> <strong>AIX</strong> : User’s <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!