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 automatically added to each user’s environment. 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, the module system on Rhea automatically pulls in libraries compiled with a given compiler when changing compilers. The compiler modules will load the correct pairing of compiler version, message passing libraries, and other items required to build and run code.

To change the default loaded Intel environment to the GCC environment for example, use:

$ module load gcc

This will automatically unload the current compiler and system libraries associated with it, load the new compiler environment and automatically load associated system libraries as well.

Changing Versions of the Same Compiler

To use a specific compiler version, you must first ensure the compiler’s 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 load gcc
$ 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.


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.