NERSCPowering Scientific Discovery Since 1974

PathScale Compilers (Fortran, C, C++)

Availability

The Pathscale Fortran, C, and C++ compilers are available on Hopper.  To make this compiler the one used by the ftn, C, and C++ compiler wrappers, type in the following:

module swap PrgEnv-pgi PrgEnv-pathscale

Fortran Source Files and Language Dialects

The Pathscale Fortran compiler supports the following file extensions

.f, .F, .f90, .F90, .f95, and .F95

By  default,  input  files suffixed  with  .f or .F are assumed to be written in fixed source form (f77), and input files suffixed with .f90,  .F90,  .f95,  or  .F95  are assumed to be written in free source form.

To change the defaults use the following flags:

  • -extend-source  - Specifies  a  132-character line length for fixed-format source lines.
  • -fixedform - Indicates source code uses fixed-form syntax as in Fortran 77, option is included by default for files with suffixes .f and .F.
  • -freeform - Indicates source code written with free-form syntax as in Fortran 90, option is included by default for files with suffixes .f90, .F90, .f95, and .F95.

Optimization

-Ofast

This produces highly optimized code.  It is equivalent to the following optimizations:  "-O3 -ipa -OPT:Ofast -fno-math-errno -ffast-math".

  • -ipa - Invoke inter-procedural analysis.
  • -OPT:Ofast - Use optimizations selected to maximize performance.  Equivalent to "-OPT:ro=2:Olimit=0:div_split=ON:alias=typed".
    • -OPT:ro=2 - Depart from source language floating-point, round-off, and overflow semantics.  At level 2, allow extensive transformations, such as the reordering of reduction loops.
    • -OPT:Olimit=0 - Program unit size is ignored and optimization process will not be disabled due to compile time limit.
    • -OPT:div_split=ON - Enable changing x/y into x*(recip(y)).
    • -OPT:alias=typed - Assume that the code adheres to the ANSI/ISO C standard which states that two pointers of different types cannot point to the same location in memory.
  • -fno-math-errno - Do not set ERRNO after calling math functions that are executed with a single instruction, e.g. sqrt.
  • -ffast-math - Improves Floating Point speed by relaxing ANSI & IEEE rules.

-On

Pathscale allows 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 - Turn off all optimizations.
  • -O1 - Turn on local optimizations that can be done quickly.
  • -O2 - (default) Turn on extensive optimization.  The optimizations at this level are generally conservative, in the sense that they are virtually always beneficial, provide improvements commensurate to the compile time spent to achieve them, and avoid changes which affect such things as floating point accuracy.
  • -O3 - Turn on aggressive optimization. The optimizations at this level are distinguished from -O2 by their aggressiveness, generally seeking highest-quality generated code even if it requires extensive compile time. They may include optimizations that are generally beneficial but may hurt performance.  This includes but is not limited to turning on the Loop Nest Optimizer, -LNO:opt=1, and setting -OPT:ro=1:IEEE_arith=2:Olimit=9000:reorg_common=ON.
  •  -Os - Code size is to be given priority in tradeoffs with execution time.

-ipa

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.   See the eko man page for more information about the suboptions.

Debugging Options

  • -g - Produces debugging information for symbolic debugging.
  • -C - Fortran bounds check.  Check subscript range at run time and print warnings; if environment variable F90_BOUNDS_CHECK_ABORT is set to YES, also force the program to abort.  Subscript range violations print warnings at compile time regardless of -C; setting F90_BOUND_CHECK_ABORT turns those warnings into errors. This option also checks substrings and null pointer accesses.

Documentation

Pathscale Documentation