NERSC logo National Energy Research Scientific Computing Center
  A DOE Office of Science User Facility
  at Lawrence Berkeley National Laboratory
 

Important Portland Group Compiler Options

The most important Portland Group compiler optimization and some debugging flags are described here. For the most part, the Portland Group Fortran, C, and C++ compilers all have the same optimization arguments. The description of these arguments below applies to all three compilers unless otherwise stated. For a full reference of Portland Group flags see PGI References.

-fast and -fastsse

In PGI7 family, -fast and -fastsee are the same They both contain the common optimizations and also include SSE hardware and vectorization. The -fast and -fastsse arguments are equal to "-O2 -Munroll=c:1 -Mnoframe -Mlre -Mvect=sse -Mscalarsse -Mcache_align -Mflushz"

  • -Munroll
    • For -Munroll=c specifies completely unroll loops with this loop count or less
    • For -Munroll=n:(m) says unroll other loops m times
  • -Mnoframe does not set up a stack frame
  • -Mlre is loop-carried redundancy elimination
  • -Mcache_align aligns the top level arrays and objects on cache-line boundaries
  • -Mflushz flushes SSE denormal numbers to zero

Note: In PGI6 family, -fast and -fastsse are different. Please use "pgf95 -help -fast" or "pgf95 -help -fastsse" to see the details.

-On

The compilers allow you to select a general level of optimization by specifying a numeric optimization level with the -O flag. The higher the number the greater the amount of optimization the compiler does, the longer the compile takes, and the more memory the compile uses. The current default optimization -O2.

  • -O0
  • -O1
  • -O2 (default)
  • -O3 more aggressive hoisting and scalar replacement; not part of -fastsse.
  • -O4 (currently no different than -03)

-Mipa

The -Mipa option enables interprocedural analysis (IPA) by the compiler. This enables the compiler to identify optimization opportunities across procedural boundaries. It does this by extending the area that is examined during optimization and inlining from a single procedure to multiple procedures (possibly in different source files) and the linkage between them. This option should be included in both the compile and link phases.

Additionally the -Mipa flag can do the following

  • Interprocedural constant propagation
  • Pointer disambiguation
  • Alignment detection and propagation
  • F90 shape propagation
  • Function inlining
  • IPA optimization of libraries, including inlining

-Mipa options

  • -Mipa=fast
  • -Mipa=fast,inline
  • -Mipa=safe:(name) It is safe to optimize functions which call or are called from unknown function or library 'name'
  • -Mipa=libopt Perform IPA optimizations on libraries
  • -Mipa=libinline Perform IPA inlining from libraries

-Minfo and -Mneginfo

  • -Minfo provides feedback on optimations made by the compiler
  • -Mneginfo provides feedback on what the compiler was unable to optimize
  • -v gives verbose output, useful for debugging system or build problems

Debugging Options

  • -g generates symbolic debug information used by a debugger
  • -gopt generates debug information in the presence of optimization
  • -Mbounds adds array bounds checking
  • -Mchkptr checks for unintended de-referencing of null pointers
  • -v gives verbose output, useful for debugging system or build problems
  • -Mlist will generate a listing
  • -Minfo provides feedback on optimations made by the compiler
  • -S or -Mkeepasm to see exact assembly generated

Explicit Function Inlining with -Minline

Particularly important for C and C++ codes

syntax: -Minline=[=[lib:]<inlib> | [name:]<func> | except:<func>: | size:<n> | levels:<n>]

  • [lib:]<inlib> Inline extracted functions from inlib
  • [name:]<func> Inline function func
  • except:<func> Do not inline function func
  • size:<n> Inline only functions smaller than n statements (approximate)
  • levels:<n> Inline n levels of functions
For C++ Codes, PGI recommends IPA=based inlining or -Minling=levels:10

-Msafeptr for C and C++ Codes

syntax: -M[no]safeptr[=all | arg | auto | dummy | local | static | global]

  • all All pointers are safe
  • arg Argument pointers are safe
  • local Local pointers are safe
  • static Static local pointers are safe
  • global Global pointers are safe

LBNL Home
Page last modified: Tue, 30 Oct 2007 21:08:57 GMT
Page URL: http://www.nersc.gov/nusers/systems/franklin/software/pgi_options.php
Web contact: webmaster@nersc.gov
Computing questions: consult@nersc.gov

Privacy and Security Notice
DOE Office of Science