Personal tools

Compiling Code on ALICE and SpeCTRE

Details of the available compilers and how to use them

This section provides information for users who need to compile their own code in C, C++ or Fortran.    There are two C/C++/Fortran compiler suites available on HPC: the Intel Cluster Toolkit and the Gnu Compiler Collection (GCC).

 

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

Table 1.  compilers names for the compiler suites on HPC

 

GNU Compiler Collection

Currently two versions of the GNU Compiler Collection are available, in general you will want to use the most recent but there have been changes to the library interfaces so you may find you need 4.1.1:

module load gcc/4.3.4

or

module load gcc/4.1.1

Intel Compilers

If you just wish to use the Intel compilers you can simply load

module load intel/64/compiler

However if you also want to link to the Intel Maths Kernel Libraries (MKL), use the Profiling tools (ITAC) or Intel MPI (IMPI) it is simpler to load the meta-module

module load intel/64/suite

This will load the recommended version of all the Intel Cluster Toolkit modules. 

Linking against MKL in particular can prove difficult for user new to the Intel Toolkit.  It is recommend that you use the Intel MKL Link Advisor to create your link lines - at least as a starting point.   Table two shows common values for the Link advisor:

 

Field Recommend 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 *

Select Cluster library: Scalapack *
Select MPI library: Intel MPI | Open MPI *

Table 2. Useful starting values for Intel MKL Link advisor for HPC.

 

You may not need to enter any values for the last three fields.  Once you have entered your values the link advisor will provide you with a list of linker options e.g.  

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

that 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 instead you are using a Makefile (rather than linking directly at the command line) you will 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.

MPI

There are four distinct flavour of MPI available

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

 

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

Table 3. Names of MPI wrapper scripts for the different MPI implementations.

 

OpenMPI

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 (they have different names - unlike the OpenMPI wrapper script which all have identical names and therefore require their own module).

module load intel/64/impi
Need IT Help?

IT Service Desk
Phone: 0116 252 2253
Online: Self Service
Email: ithelp@le.ac.uk
In person: Help Zone
Hours: Service Hours
See also: IT Training


Teaching Room Help
Phone: 0116 252 2919
Email: AVS Support


Problem not resolved - still need help?

Website Feedback

If you can't find what you need, or wish to send us comments, please use our feedback form.