|
Article ID: 365
Last updated: 04 Dec, 2025
As an alternative to using Intel compilers for Fortran, C, and C++ programs, you can use the compilers and program development tools from PGI Compilers and Tools. By default, the PGI compilers generate code that is optimized for the compilation host. Note: The PGI compilers have been rebranded by NVIDIA. This article will be removed in the near future. PGI CompilingSeveral versions of PGI compilers and tools are installed as modules under the /nasa system directory. To view available versions, run:
The following command line will load version 18.10:
Note: Starting with the PGI compiler 2018, two different code generators (PGI-proprietary vs LLVM-based) are included in each package. The default code generator for 2018 versions is the PGI-proprietary code generator and for 2019 and later versions is the LLVM-based generator. The PGI 2019 compilers using LLVM are not link-compatible with PGI 2018 and prior releases. Using the PGI CompilersPGI provides multiple commands for different languages or functions. In 18.10 and earlier versions, the following are available.
Note: By default, the PGI compilers generate code that is optimized for the type of processor on which compilation is performed (the compilation host). Be aware that the processors are forward-compatible, but not backward-compatible. Thus a code compiled and optimized on a newer-generation processor will not necessarily execute correctly on previous-generation processors. If you want to build an executable that targets a specific processor type, use the -tp flag:
TIP: Using the -tp=sandybridge-64,haswell-64,skylake-64 option will generate a single executable in which the code is optimized for the Intel Sandy Bridge, Haswell, and Skylake architectures. The choice of which optimized copy to execute is made at run time and depends on the machine executing the code. You must load comp-pgi/18.4 or later versions in order to use -tp= skylake-64.
PGI recommends that for best performance on processors which support SSE instructions (including all NAS processor types), use pgfortran, even for FORTRAN 77 code, use the -fastsse option. For more information about the PGI compilers, see man pgfortran, man pgcc, and man pgc++ or use the pgfortran -help, pgcc -help, or pgc++ -help commands. Information about the PGI debugger and performance analysis tool can be found using the commands pgdbg -help and pgprof -help. |