PGI

De Wiki de Calcul Québec
Aller à : Navigation, rechercher
Cette page est une traduction de la page PGI et la traduction est complétée à 100 % et à jour.

Autres langues :anglais 100% • ‎français 100%

The Portland Group compiler suite is a set of compilers for C (pgcc), C++ (pgCC) and Fortran (pgf77 ou pgf90) developped and maintained by Portland Group.

Sommaire

Advantages and disadvantages

Portland Group has been involved closely in scientific computation with general purpose graphical processing units (GPGPU). Its compilers therefore sometimes support technologies such as CUDA, OpenACC and OpenCL that is more advanced than other compiler suites. However, much fewer projects are tested with PGI compilers than with GNU and Intel compilers. It may therefore be harder to compile a software with PGI. PGI compilers are not available on all of our servers. To check for support, please refer to the page Table summarizing properties of Calcul Québec servers.

Compiling options

A list of generic options is available on the page Compiling Code.

Options specific to Portland Group compilers

Option Description Example
-fastsse Equivalent to a set of options, generally optimal and which includes SSE/SSE2 instructions.
pgcc -fastsse ...
-Bstatic Links binaries (objects and libraries) statically to the executable.
pgcc -static ...
-Bdynamic Links binaries (objects and libraries) dynamically to the executable.
pgcc -static ...
-Mvect=sse Vectorizes some loops and use SSE, SSE2 and prefetching where possible.
pgcc -Mvect=sse ...
-mp Enables support for OpenMP.
pgcc -mp ...
-mcmodel=medium Creates an executable with the "medium" memory model (total memory > 2 GB, object sizes < 2 GB) on a 64 bits linux86-64 environment.
pgcc -mcmodel=medium ...
-Mlarge_arrays Allows array sizes larger than 2 GB for linux86-64 environments. Must be used with the -mcmodel=medium option.
pgcc -mcmodel=medium -Mlarge_arrays ...
-Mipa=fast, -Mipa=fast,inline Enables interprocedural optimizations
pgcc -Mipa=fast,inline ...
-Mbounds Enables array bound checking (overflows).
pgcc -Mbounds ...

Options specific to Fortran compiler

Option Description Example
-Mextend Allows lines of code up to 132 characters. Enabled by default with pgf90.
pgf77 -Mextend ...
-Mdclchk Forces explcit declaration of all variables.
pgf77 -Mdclchk ...

Recommended options

We recommend using the -O2 -fastsse options. -O2 may be replaced by -O3, which adds some more optimizations. While -O2 is almost always better than -O1, -O3 sometimes perform worse than -O2.

Interprocedural Optimization

Softwares are generally compiled one source file at a time, and binaries are then linked together to create the executable. Interprocedural Optimization enables compiler optimisations using the full syntaxic tree of all source files. To do so, optimization of intermediate representations is delayed until linking time [1] [2] [3] [4].

To enable Interprocedural Optimization with Portland Group compilers, use the -Mipa=fast or -Mipa=inline options:

[name@server $] pgcc -Mipa=fast -fastsse -O2 f1.c f2.c  -o f.out


or

[name@server $] pgcc -Mipa=fast,inline -fastsse -O2 f1.c f2.c  -o f.out


Compiling OpenMP code

To enable OpenMP threadnig, you need to add the -mp option. For example:

[name@server $] pgcc -Mipa=fast,inline -fastsse -O3 -mp f1.c f2.c -o f.out


References

  1. https://en.wikipedia.org/wiki/Link-time_optimization
  2. http://gcc.gnu.org/onlinedocs/gccint/LTO.html
  3. http://gcc.gnu.org/wiki/LinkTimeOptimization
  4. http://www.phoronix.com/scan.php?page=article&item=gcc_471_lto&num=1
Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Ressources de Calcul Québec
Outils
Partager