Compiling Codes

Use /tmp to compile large codes and software packages. This will provide improved performance and greater system stability.

Compiling C/C++ and Fortran Codes

  • GNU compilers gcc, g++, g77 are in /usr/bin, which is in the default path.
  • Intel compilers require setup files.
    • Fortran (ifort):
      bash: source /opt/intel/fc/9.1.032/bin/ifortvars.sh
      tcsh: source /opt/intel/fc/9.1.032/bin/ifortvars.csh
    • C/C++ (icc):
      bash: source /opt/intel/cc/9.1.045/bin/iccvars.sh
      tcsh: source /opt/intel/cc/9.1.045/bin/iccvars.csh
  • Help: First source the setup file.
    • Fortran: man ifort or info ifort
    • C/C++: man icc or info icc

Compiling MPI programs

    To convert an existing makefile to use the facilities at the CTC, we recommend that you use mpicc and mpif77, located in /usr/local/bin, as appropriate.  These use g77, gcc, and mpich2.  To replace a given GNU compiler with the equivalent Intel compiler, you must either supply an option to mpicc or mpif77, or set an environment variable.

  • Default version of MPI:
    • mpich2 from Argonne National Labs. Link the library with -lmpich. 
  • Default compilers:
    • The default fortran compiler is g77. 
    • The default C/C++ compiler is gcc. 
  • Substituting the Intel Compilers:
    • Fortran: mpif77 -f77=ifort ... (or setenv MPICH_F77 ifort, or export MPICH_F77=ifort)
    • C/C++: mpicc -cc=icc ... (or setenv MPICH_CC icc, or export MPICH_CC=icc)