Debugging

Profiling

Checkpointing

Compilation of Serial Code

Form for compiling a serial code:  compiler -flags filename

The available compilers are C, C++, Fortran77 and Fortran 90. 

There are several implementations of compilers on the CCR cluster.   These are GNU, INTEL and PGI. 

  • GNU: gcc, g++, gfortran, g77
  • INTEL: icc, icpc, ifort
  • PGI: pgcc, pgCC, pgfortran, pgf77, pgf90

The GNU compilers are in the default path.   A module must be loaded to set the paths for the INTEL and PGI compiler suites.


Basic syntax

Compilation of C code with GNU:

            gcc -o exec filename.c

            where -o specifies the executable file name, which in this case would be exec.  If the -o flag is omitted, then the default executable is a.out.


Compilation of C code with INTEL: 

            module load intel

            icc -o exec filename.c

            where -o specifies the executable file name, which in this case would be exec.  If the -o flag is omitted, then the default executable is a.out.


Learn more about modules commands


Example of compiling helloworld C program with gcc

 

[ccruser@rush:~]$ cat hello-world.c 
#include <stdio.h>

int main() {
   printf("Hello world!\n");
}

[ccruser@rush:~]$ gcc -o hello-gnu hello-world.c 
[ccruser@rush:~]$ ./hello-gnu 
Hello world!

 

Example of compiling helloworld C program with icc

 

[ccruser@rush:~]$ cat hello-world.c 
#include <stdio.h>

int main() {
   printf("Hello world!\n");
}

[ccruser@rush:~]$ module list
Currently Loaded Modulefiles:
  1) null      2) modules
[ccruser@rush:~]$ module avail intel

-------------------------- /util/Modules/modulefiles ---------------------------
intel/10.0          intel/9.0           intel-mpi/4.0
intel/10.1          intel/9.1           intel-mpi/4.0.1
intel/11.0          intel/9.1.040       intel-mpi/4.0.3
intel/11.1(default) intel-ipp/7.0.1     intel-tbb/3.0.3
intel/12.0          intel-mpi/3.1
intel/12.1          intel-mpi/3.2
[ccruser@rush:~]$ module load intel/12.1 
[ccruser@rush:~]$ icc -o hello-intel hello-world.c 
[ccruser@rush:~]$ ./hello-intel 
Hello world!

 

Learn more about GNU Compliers


Learn more about Intel Compilers


Learn more about PGI Compilers


Learn more about MPI and Multi-threading