Compiling Code on Quest
Available compilers on Quest.
Quest users have the choice of GNU's gcc/gfortran and Intel's icc/ifort compilers to compile their codes. In addition to being accessible as modules, the GNU compilers are also provided by the operating system (RedHat Enterprise Linux). These compilers are sometimes referred to as native in the Quest documentation. More up-to-date versions are provided as modules (see Modules on Quest).
Code can be compiled on any of the login nodes.
Compilers
- GCC (The GNU Compiler Collection providing gcc and gfortran for compiling C and Fortran programs)
- Intel ® Cluster Toolkit (consisting of icc/ifort for compiling C and Fortran programs, as well as Intel MPI Library for compiling MPI parallelized codes)
See available versions of the compilers with
module avail gcc
module avail intel
MPI Libraries
- Open MPI using either GNU compilers or Intel compilers
- Intel® MPI Library
- MPICH Library
- MVAMPICH Library
See available versions of the libraries with
module avail mpi
Debuggers and Profilers
- GDB: The GNU Project Debugger also supporting OpenMP parallel programs
- IDB: Intel® debugger also supporting OpenMP parallel programs
- Valgrind: Open-source memory debugger
- TotalView®: Source code and memory debugger supporting OpenMP, MPI and GPU enabled programs
The idb debugger is loaded when you load an intel module. The gdb debugger from the Red Hat Linux installation is always available.
For serial and multi-threaded programs the advanced debugger and profiler Valgrind is also available, more widely known for its memory debugging capabilities. It can be accessed as module via
module load valgrind
There exists extensive documentation online as well as locally on Quest under the directory $VALGRIND_DOCDIR. For instance, to view the PDF User Manual simply execute
evince $VALGRIND_DOCDIR/valgrind_manual.pdf
Parallel MPI programs can be debugged with TotalView, which comes integrated with the memory debugger MemoryScape. Both are available as module via
module load totalview
and the corresponding PDF user manuals can be viewed with
evince $TOTALVIEW_DOCDIR/TotalView_User_Guide.pdf
evince $MEMORYSCAPE_DOCDIR/MemoryScape_User_Guide.pdf
Note: In general, debugging should be carried out on the compute nodes by submitting interactive jobs to ensure that the environment is the same as it will be when you submit your batch job. In order to use TotalView's graphical interface, X11 forwarding has to be enabled, both when connecting via ssh to the login nodes as well as when submitting the interactive job (see Interactive Jobs for more details).
Compiling Programs
The Intel Fortran and C/C++ compiler commands are ifort, icc, and icpc. Appropriate file name extensions are required for each compiler command. The compiler creates a compiled object file (with a .o suffix) for each file to be compiled and then combines them with the system library files in a link step to create an executable. Examples:
icc -xhost -O2 -o flamec.exe prog.c
ifort -xhost -O2 -o flamef.exe prog.f90
For more information type the compiler command with the -help option to display every compiler flag, its syntax, along with a brief explanation for its usage on Quest.
The compilation of MPI programs is mainly accomplished through the use of the compile wrappers mpicc, mpicxx, mpif77, and mpif90 depending on whether the program is written in C, C++, Fortran77 or Fortran90, respectively. In addition, mpiicc and mpiifort, which always use Intel's icc and ifort compilers, are available when the Intel-MPI module has been loaded. Individual files are compiled with:
C: mpicc [options] file.c
C++: mpicxx [options] file.cpp
Fortran77: mpif77 [options] file.f
Fortran90: mpif90 [options] file.f90
For additional information, execute the OpenMPI flag -showme to display the command line options for compiling and linking MPI codes.
This option does not invoke the underlying compiler. Instead, it shows the command line that would be executed to compile the program. NOTE: If a non-filename argument is passed on the command line, the -showme option will not display any additional flags. For example, both mpicxx --showme and mpicxx --showme my_source.c will show all the wrapper-supplied flags. But mpicxx -showme -v will only show the underlying compiler name and -v.
-showme:compile
This option does not invoke the underlying C++ compiler. Instead, it shows the compiler flags that would be supplied to the C++ compiler.
-showme:link
This option does not invoke the underlying C++ compiler. Instead, it shows the linker flags that would be supplied to the C++ compiler.
Note: Certain proprietary software use MPI libraries which may not be supported on Quest (e.g. HPMPI and MVAPICH). If you need assistance to install a custom MPI library package, contact quest-help@northwestern.edu.