Main navigation

Compilers

Basic Compiler Commands

These compilers can be used to build sequential (single processor) or shared memory-type threaded/OpenMP executables (that is, applications that are confined to run on the available cores on a single computational node). See the section Compiling MPI programs for compilers used to build parallel applications that use the message passing communication paradigm (and that can be run across several machines – i.e. nodes).

Intel Compilers

Please notice that you should be using at most only up to a couple of concurrent instances of the intel compilers to ensure availability of this shared resource. 

Language Command Example
C icc icc [options] foo.c
C++ icpc icpc [options] foo.cpp
Fortran ifort ifort [options] foo.f

Additional notes for Intel compilers:

  • To enable OpenMP support, use the -openmp option, e.g. icc -openmp foo.c
  • Use -help to see help information, e.g. icc -help
  • Use –version to see the compiler version, e.g. icc –version
  • Use the “man” command to see all compiler options, e.g. man icc

GCC Compilers

Language Command Example
C gcc gcc [options] foo.c
C++ g++ g++ [options] foo.cpp
Fortran gfortran gfortran [options] foo.f90

Additional notes for GNU compilers:

  • To enable OpenMP support, use the -fopenmp option, e.g. gcc foo.c -fopenmp
  • Use –help to see help information, e.g. gcc –help
  • Use –version to see the compiler version, e.g. gcc –version
  • Use “man” command to see all compiler options, e.g. man gfortran

Using Debuggers

The Intel debugger, idb, is available when the Intel compiler is loaded in user environment. There is also a GNU debugger gdb available. Use the command “man idb” and “man gdb” to see more information about Intel and GNU debuggers, respectively.

Do not run debugger on the login nodes. You should always run debugger within an interactive session obtained with qrsh. In fact, it is not possible to run the Intel debugger on the login nodes due to resource limitation.

See Languages and Debuggers for more debugging options.

Compiling MPI programs

The Intel MPI is the supported MPI library, automatically loaded in the default user environment. The basic commands to compile MPI code are listed in the following table.

Language Command Example
C mpiicc mpiicc [options] foo.c
C++ mpiicpc mpiicpc [options] foo.cpp
Fortran mpiifort mpiifort [options] foo.f90

Important Note: Intel MPI provides two sets of MPI compilers {mpiicc,mpicpc,mpiifort} and {mpicc,mpicxx,mpif90} that use Intel compilers and GNU compilers, respectively. Use the -show option, as shown below, to display the underlying compiler in each of the MPI compiler commands.

For {mpiicc, mpiicpc, mpiifort}, the underlying compilers are Intel compilers:

$ mpiicc -show
icc -I/u/local/compilers/intel-cs/.../mpi/intel64/include ...

$ mpiicpc -show
icpc -I/u/local/compilers/intel-cs/.../mpi/intel64/include ...

$ mpiifort -show
ifort -I/u/local/compilers/intel-cs/.../mpi/intel64/include ...

For {mpicc, mpicxx, mpif90}, the underlying compilers are GNU compilers:

$ mpicc -show
gcc -I/u/local/compilers/intel-cs/.../mpi/intel64/include ...

$ mpicxx -show
g++ -I/u/local/compilers/intel-cs/.../mpi/intel64/include ...

$ mpif90 -show
gfortran -I/u/local/compilers/intel-cs/.../mpi/intel64/include/gfortran/ ...

See How to Run MPI for more details and options to use other MPI libraries. You could also install a MPI library of your choice under your home directory.

How to Use Non-default Compilers

There are other versions of compilers available on the cluster. They are made available for your convenience, but may not be supported; only the default version is supported. To switch one’s environment to use a different compiler, the appropriate module should be loaded.

For a list of available Intel compilers, issue the command:

module available intel

For a list of available GNU compilers, issue the command:

module available gcc

Load any needed compiler in your environemnt with, for example:

module load intel/11.1

To see what compiler is loaded in your environment issue:

module list

GNU compiler commands are part of the operating system installation and will not appear in the output of the command “module list”, this is true unless a GNU compiler different then the default was loaded (with a module load command), in this case the latter will replace the default GNU compiler commands and it will appear in the output of the command “module list”.

Additional Information

 

Report Typos and Errors
UCLA OIT

© 2016 UC REGENTS TERMS OF USE & PRIVACY POLICY