Compiling Code on ALICE and SPECTRE

If you need to compile your own code, there are two compilers for C, C++ and Fortran on the High Performance Computing (HPC) system: the Intel Cluster Toolkit and the Gnu Compiler Collection (GCC).

Compiler names

Language GCC Intel
C gcc icc
C++ g++ icpc
F77 gfortran ifort
F90 gfortran ifort
F95 gfortran ifort

GNU Compiler Collection (GCC)

The default compiler on the HPC systems is the GNU Compiler Collection, version 4.8.5. This is the compiler which will be available immediately on logging in and is used to compile the libraries that are available on the system.

Newer versions of gcc can be loaded via the module system. You should only use these if there are specific features of the newer compiler you need and you cannot use the intel compilers.

Intel Compilers

To use the latest Intel compilers, enter:

module load intel/compilers

It is recommended that you use the Intel MKL Link Advisor to create your link lines. It can be difficult to link against MKL and this will give you a good starting point.

Recommended values for the Link advisor:

Field Recommended values
Select OS: Linux
Select processor architecture: Intel 64
Select compiler: Intel | GNU C | GNU Fortran
Select dynamic or static linking dynamic | static
Select your integers length: 32-bit (lp64)
Select sequential or multi-threaded sequential | multi-threaded
Select OpenMP library:

iomp5 (may not be needed)

Select Cluster library: Scalapack (may not be needed)
Select MPI library: Intel MPI | Open MPI (may not be needed)

Once you have entered your values the link advisor will provide you with a list of linker options, for example:

-L$MKLPATH $MKLPATH/libmkl_solver_lp64_sequential.a \
-Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core \
-Wl,--end-group -lpthread

These can be used directly if you are linking from the command line, for example:

> ifort -L$MKLPATH $MKLPATH/libmkl_solver_lp64_sequential.a \
-Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core \
-Wl,--end-group -lpthread mycode.f90 -o mycode.exe

If you are using a Makefile rather than linking directly at the command line, you need to add the above linker options to the LDFLAGS, CFLAGS or FFLAGS variable in your Makefile.  You will also need to change references to $MKLPATH to $(MKLPATH), so that the make command understands them.


There are four implementations of MPI available:

  1. OpenMPI + Intel Compilers
  2. OpenMPI + GNU Compilers
  3. IntelMPI + Intel Compilers (recommended for performance)
  4. IntelMPI + GNU Compilers

MPI wrapper scripts for the different implementations:

Language Open MPI + Any Intel MPI + GCC Intel MPI + Intel
C mpicc mpicc mpiicc
C++ mpicxx mpicxx mpiicpc
F77 mpif77 mpif77 mpiifort
F90 mpif90 mpif90 mpiifort
F95 mpif90 mpif90 mpiifort


To load the Intel MPI wrapper scripts and libraries use:

module load openmpi/intel

To load the GNU MPI wrapper scripts and libraries use:

module load openmpi/gcc

This will also load the related compiler module if it is not already loaded, for instance the Intel Compiler module.

Intel MPI

When you load Intel MPI it will add both the GNU and Intel compilers to your path. The Intel MPI wrapper scripts have different names, whereas the OpenMPI wrapper scripts have identical names and therefore require their own module.

module load intel/impi

Share this page:

Contact us

IT Service Desk

Report an issue or make a request


In person:

Opening hours:
Mon - Fri 8.30am - 5.00pm

0116 252 2253
Ask for Ismail Patel


Teaching room help

Instant help:
0116 252 2919
Search IT Help