From Documentation
Jump to: navigation, search
Note: Some of the information on this page is for our legacy systems only. The page is scheduled for an update to make it applicable to Graham.
PGI
Description: the Portland Group Compiler suite
SHARCNET Package information: see PGI software page in web portal
Full list of SHARCNET supported software



Overview

Portland Group produces high-quality compilers that include certain unusual features, such as OpenACC, Cuda Fortran and dual optimized binaries for opteron and intel. Sharcnet does NOT currently provide a pgi compatible build of openmpi.

Versions

Unload any currently loaded compiler module (typically intel), e.g.,

module unload intel mkl openmpi/intel

then load the PGI module:

module load pgi

Usage

Interactive Use

Once the pgi module is loaded, available compiler commands are:

pgcc (C compiler)
pgCC or pgc++ (C++ compiler)
pgf77, pgf90, pgf95, pgfortran (Fortran compilers)

Cluster Use

Serial Job

sqsub -r 10m -q serial --mpp=200m -o ofile.%J ./a.out

Threaded Job

sqsub -r 10m -q threaded --mpp=200m -o ofile.%J ./a.out

Example

o The pgi examples can be retrieved from /opt/sharcnet as follows:

[roberpj@orc-login2:~/pgiexamples] tar zxf /opt/sharcnet/pgi/14.4/linux86-64.examples.tar.gz
[roberpj@orc-login2:~/pgiexamples] tree -L 4
.
`-- linux86-64
    `-- 2014
        `-- examples
            |-- AutoPar
            |-- CUDA-Fortran-SDK
            |-- CUDA-x86-SDK
            |-- F2003
            |-- MPI
            |-- OpenACC
            |-- OpenMP
            `-- README

o To build the threaded matmul example then run it in the queue do:

[roberpj@saw-login1:~] module unload intel
[roberpj@saw-login1:~] module load pgi/14.4
[roberpj@saw-login1:~/pgiexamples/linux86-64/2014/examples/OpenMP/matmul] make build
------------------------------------ building matmul.out
pgf90 -fast -mp -Minfo -DPGF90 -DSYSCLK -o matmul.out matmul.F
PGF90-W-0119-Redundant specification for etime (matmul.F: 32)
  0 inform,   1 warnings,   0 severes, 0 fatal for matmul_time
matmul_time:
     44, Loop interchange produces reordered loop nest: 45,44
         2 loops fused
         Generated vector sse code for the loop
     45, 2 loops fused
     49, Loop interchange produces reordered loop nest: 50,49
     55, Memory zero idiom, loop replaced by call to __c_mzero8
     65, Loop not vectorized/parallelized: too deeply nested
     72, Parallel region activated
     75, Parallel loop activated with static block schedule
         Generated vector sse code for the loop
     79, Barrier
     80, Parallel loop activated with static block schedule
     81, Generated an alternate version of the loop
         Generated vector sse code for the loop
     85, Barrier
         Parallel region terminated
     96, Loop not vectorized/parallelized: contains call
    106, Loop unrolled 1 times (completely unrolled)
    107, sum reduction inlined
         Loop unrolled 1 times (completely unrolled)
    120, Loop not fused: function call before adjacent loop

o To run the threaded example:

[roberpj@saw-login1:~/pgiexamples/linux86-64/2014/examples/OpenMP/matmul] sqsub -r 30m -q threaded -n 2 --mpp=500M -o ofile.%J make run
submitted as jobid 5319843
[roberpj@saw-login1:~/pgiexamples/linux86-64/2014/examples/OpenMP/matmul] cat ofile.5319843.saw-admin.saw.sharcnet
------------- executing matmul.out with 2 threads
export OMP_NUM_THREADS=2; ./matmul.out
   0.3944332                0      1972167      1972168
 M =         1000 , N =         1000 , P =         1000
 MFLOPS =     5068.032    
 Test PASSED

Mpi Job

module load openmpi/pgi
mpicc cpi.c
sqsub -r 10m -q mpi -n 2 --mpp=200m -o ofile.%J ./a.out

Graphical Use

There is no notable graphical usage component of the pgi compiler supported at this time.

Notes

ACML

o We recommend using the shared library version of acml that ship with pgi.

[roberpj@orc-login2:/opt/sharcnet/pgi/14.4/linux86-64/2014/acml/5.3.0] tree
.
|-- include
|   `-- acml.h
|-- lib
|   |-- libacml.a
|   |-- libacml_fma4.a
|   |-- libacml_fma4_mp.a
|   `-- libacml_mp.a
`-- libso
    |-- libacml_fma4_mp.so
    |-- libacml_fma4.so
    |-- libacml_mp.so
    `-- libacml.so

o This is typically ensured since the module sets ...

 [roberpj@orc-login2:~] module show pgi | grep LD_RUN_PATH
 prepend-path     LD_RUN_PATH /opt/sharcnet/pgi/14.4//linux86-64/14.4/libso

o Examples how to link with acml can be found by looking at the examples included with the acml modules. GNUmakefiles demonstrate exactly howto link:

[roberpj@orc-login2:/opt/sharcnet/acml/5.3.0/pgi-64bit/pgi64/examples] ls *getrf*
dgetrf_example.expected  sgetrf_c_example.c         sgetrf_cpp_example.cpp       sgetrf_example.expected
dgetrf_example.f         sgetrf_c_example.expected  sgetrf_cpp_example.expected  sgetrf_example.f
[roberpj@orc-login2:/opt/sharcnet/acml/5.3.0/pgi-64bit/pgi64_mp/examples] ls *getrf*
dgetrf_example.expected  sgetrf_c_example.c         sgetrf_cpp_example.cpp       sgetrf_example.expected
dgetrf_example.f         sgetrf_c_example.expected  sgetrf_cpp_example.expected  sgetrf_example.f

C11, C++11, C++14

Understanding C11 and C++11 support is important since it is not yet default -- and SHARCNET programs are virtually all concurrent by design. The C11 and C++11 standards brought formal, well-defined semantics into C and C++ for concurrent programs. Think threads, atomics, memory models, alignment information, etc. besides a number of other items. Previously, these were not standardized or even guaranteed although all compilers typically did the right thing so there weren't usually any major issues. C11, C++11, and Java language definitions now all guarantee well-defined sequentially consistent semantics if a program does not have data races. C11 and C++11 also permit other models --but most users will never use such (as they are a lot harder to correctly use). More information about this important topic will follow soon! A table of compiler support for new C++ features (including C++11, C++14, C++17 and various technical specifications) is given in http://en.cppreference.com/w/cpp/compiler_support.

References

o PGI Homepage
http://www.pgroup.com

o PGI Resources
http://www.pgroup.com/resources/

o PGI Support FAQ (cuda info direct link)
http://www.pgroup.com/support/install.htm#cuda_info

o PGI Download Release Information
http://www.pgroup.com/support/download_releases.php