Compiling code on Rhea is typical of commodity or beowulf-style HPC linux clusters.

Available Compilers

The following compilers are available on Rhea:

  • Intel, Intel Composer XE (default)
  • PGI, the Portland Group Compiler Suite
  • GCC, the GNU Compiler Collection

Upon login, default versions of the Intel compiler and OpenMPI (Message Passing Interface) libraries are added to each user’s environment through a programming environment (PE) module. Users do not need to make any environment changes to use the default version of Intel and OpenMPI.


Changing Compilers

If a different compiler is required, it is important to use the correct environment for each compiler. To aid users in pairing the correct compiler and environment, programming environment modules are provided. The programming environment modules will load the correct pairing of compiler version, message passing libraries, and other items required to build and run code. We highly recommend that the programming environment modules be used when changing compiler vendors.

The following programming environment modules are available on OLCF commodity clusters:

  • PE-intel (default)
  • PE-pgi
  • PE-gnu

To change the default loaded Intel environment to the GCC environment use:

$ module unload PE-intel 
$ module load PE-gnu

Or alternatively:

$ module swap PE-intel PE-gnu

Changing Versions of the Same Compiler

To use a specific compiler version, you must first ensure the compiler’s PE module is loaded, and then swap to the correct compiler version. For example, the following will configure the environment to use the GCC compilers, then load a non-default GCC compiler version:

$ module swap PE-intel PE-gnu
$ module swap gcc gcc/4.7.1
Note: we recommend the following general guidelines for using the programming environment modules:

  • Do not purge all modules; rather, use the default module environment provided at the time of login, and modify it.
  • Do not swap moab, torque, or MySQL modules after loading a programming environment modulefile.

Compiler Wrappers

Commodity Clusters at the OLCF can be accessed via the following wrapper programs:

  • mpicc to invoke the C compiler
  • mpiCC, mpicxx, or mpic++ to invoke the C++ compiler
  • mpif77 or mpif90 to invoke appropriate versions of the Fortran compiler

These wrapper programs are cognizant of your currently loaded modules, and will ensure that your code links against our OpenMPI installation. More information about using OpenMPI at our center can be found in our Software Documentation.

Compiling Threaded Codes

When building threaded codes, compiler-specific flags must be included to ensure a proper build.

OpenMP

For PGI, add “-mp” to the build line.

$ mpicc -mp test.c -o test.x
$ export OMP_NUM_THREADS=2

For GNU, add “-fopenmp” to the build line.

$ mpicc -fopenmp test.c -o test.x
$ export OMP_NUM_THREADS=2

For Intel, add “-qopenmp” to the build line.

$ mpicc -qopenmp test.c -o test.x
$ export OMP_NUM_THREADS=2

For information on running threaded codes, please see the Thread Layout subsection of the Running Jobs section in this user guide.