PGI Compilers

Fortran, C, and C++ compilers provided by the Portland Group.

Availability and Restrictions

PGI compilers are available on the Ruby, and Owens Clusters. Here are the versions currently available at OSC:

Version Owens Pitzer Notes
16.5.0 X    
17.3.0 X    
17.10.0 X    
18.4 X X  
20.1 X* X*  
* : Current Default Version

You can use module spider pgi to view available modules for a given machine. Feel free to contact OSC Help if you need other versions for your work.

Access

The PGI Compilers are available to all OSC users. If you would like to install the PGI compilers on your local computers, you may use the PGI Community Edition of the compiler for academic users for free at here. If you have any questions, please contact OSC Help.

Publisher/Vendor/Repository and License Type

Nvidia, Commercial

Known Software Issues

GNU Compatibility and Interoperability

PGI compilers use the GNU tools on the clusters:  header files, libraries, and linker.  We call this PGI and GNU compatibility and interoperability in analogy with the Intel compilers' terminology.  Many users will not have to change this.  On OSC clusters the only mechanism of control is based on modules.  The most noticeable aspect of interoperability is that some parts of some C++ standards are available by default in various versions of the PGI compilers; other parts require you to load an extra module. For complete support of the C++11 and later standards with the PGI 20.1 and later compilers do this after the PGI compiler module is loaded:

module load pgi-gcc-compatibility

A symptom of broken compatibility is unusual or non sequitur compiler errors typically involving the C++ standard library especially with respect to templates, for example:

    In function `...':  undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >:: ...'

pgi/20.1: LLVM back-end for code generation

Modern versions of the PGI compilers (version 19.1 and later) switched to using a LLVM-based back-end for code generation, instead of the PGI-proprietary code generator. For most users, this should not be a noticeable change. If you understand the change and need to use the PGI-proprietary back-end, you can use the -Mnollvm flag with the PGI compilers.

pgi/20.1: disabling memory registration

You may have a warning message when you run a MPI job with pgi/20.1 and mvapich2/2.3.3:

WARNING: Error in initializing MVAPICH2 ptmalloc library.Continuing without InfiniBand registration cache support.

Please read about the impact of disabling memory registration cache on application performance in the Mvapich2 2.3.3 user guide

Note that pgi/20.1 works without the warning message with mvapich2/2.3.4.

Usage on Owens

Set-up

To configure your environment for the default version of the PGI Compilers, use module load pgi. To configure your environment for a particular PGI compiler version, use module load pgi/version. For example, use  module load pgi/16.5.0 to load the PGI compiler version 16.5.0.

Using the PGI Compilers

Once the module is loaded, compiling with the PGI compilers requires understanding which binary should be used for which type of code. Specifically, use the pgcc binary for C codes, the pgc++ binary for C++ codes, the  pgf77 for Fortran 77 codes, and the pgf90 for Fortran 90 codes. Note that for PGI compilers version 20.1 and greater, the pgf77 binary is no longer provided; please use pgfortran for Fortran codes instead.

See our compilation guide for a more detailed breakdown of the compilers.

Building with the PGI Compilers

The PGI compilers recognize the following command line options (this list is not exhaustive, for more information run man <compiler binary name>). In particular, if you are using a PGI compiler version 19.1 or later and need the PGI-proprietary back-end, then you can use the -Mnollvm flag (see the note at the top of this Usage section).

COMPILER OPTION PURPOSE
-c Compile into object code only; do not link
-DMACRO[=value] Defines preprocessor macro MACRO with optional value (default value is 1)
-g Enables debugging; disables optimization
-I/directory/name Add /directory/name to the list of directories to be searched for #include files
-L/directory/name Adds /directory/name to the list of directories to be searched for library files
-lname Adds the library libname.a or libname.so to the list of libraries to be linked
-o outfile Names the resulting executable outfile instead of a.out
-UMACRO Removes definition of MACRO from preprocessor
-O0 Disable optimization; default if -g is specified
-O1 Light optimization; default if -g is not specified
-O or -O2 Heavy optimization
-O3 Aggressive optimization; may change numerical results
-M[no]llvm Explicitly selects for the back-end between LLVM-based and PGI-proprietary code generation; only for versions 19.1 and greater; default is -Mllvm
-Mipa Inline function expansion for calls to procedures defined in separate files; implies -O2
-Munroll Loop unrolling; implies -O2
-Mconcur Automatic parallelization; implies -O2
-mp Enables translation of OpenMP directives

Usage on Pitzer

Set-up

To configure your environment for the default version of the PGI Compilers, use module load pgi. To configure your environment for a particular PGI compiler version, use module load pgi/version. For example, use module load pgi/18.4 to load the PGI compiler version 18.4.

Using the PGI Compilers

Once the module is loaded, compiling with the PGI compilers requires understanding which binary should be used for which type of code. Specifically, use the pgcc binary for C codes, the pgc++ binary for C++ codes, the pgf77 for Fortran 77 codes, and the pgf90 for Fortran 90 codes. Note that for PGI compilers version 20.1 and greater, the pgf77 binary is no longer provided; please use pgfortran for Fortran codes instead.

See our compilation guide for a more detailed breakdown of the compilers.

Building with the PGI Compilers

The PGI compilers recognize the following command line options (this list is not exhaustive, for more information run man <compiler binary name>). In particular, if you are using a PGI compiler version 19.1 or later and need the PGI-proprietary back-end, then you can use the -Mnollvm flag (see the note at the top of this Usage section).

COMPILER OPTION PURPOSE
-c Compile into object code only; do not link
-DMACRO[=value] Defines preprocessor macro MACRO with optional value (default value is 1)
-g Enables debugging; disables optimization
-I/directory/name Add /directory/name to the list of directories to be searched for #include files
-L/directory/name Adds /directory/name to the list of directories to be searched for library files
-lname Adds the library libname.a or libname.so to the list of libraries to be linked
-o outfile Names the resulting executable outfile instead of a.out
-UMACRO Removes definition of MACRO from preprocessor
-O0 Disable optimization; default if -g is specified
-O1 Light optimization; default if -g is not specified
-O or -O2 Heavy optimization
-O3 Aggressive optimization; may change numerical results
-M[no]llvm Explicitly selects for the back-end between LLVM-based and PGI-proprietary code generation; only for versions 19.1 and greater; default is -Mllvm
-Mipa Inline function expansion for calls to procedures defined in separate files; implies -O2
-Munroll Loop unrolling; implies -O2
-Mconcur Automatic parallelization; implies -O2
-mp Enables translation of OpenMP directives

Further Reading

See Also

Supercomputer: 
Service: 
Technologies: 
Fields of Science: