User Tools

Site Tools


guide:compiling

This is an old revision of the document!


Compiling

Compilers

The following is a list of C, C++ and Fortran compilers available on the SUN cluster and the M9000:

Intel

  • icc (for C and C++)
  • ifort

GNU

  • gcc
  • g++
  • gfortran

Sun Studio

  • cc
  • CC
  • f90/f95

Environment

module Command

The module command provides a convenient mechanism for managing which environment variables are set in your shell session. The following is a list of the basic usage of the module command:

  • Check which modules are available
    module avail
  • Add a module to the current environment
    module add <module>
  • Remove a module from the environment
    module remove <module>

Compiling

Example Code

C

#include <stdio.h>
 
int main()
{
    printf("Hello World");
    return 0;
}

Fortran

PROGRAM Hello
    PRINT *, "Hello World"
END PROGRAM Hello

GNU

The following code snippets demonstrate how to compile the above code examples use the GNU compiler suite:

C

gcc -o hello hello.c

Fortran

gfortran -o hello hello.f90

Sun Studio

The following code snippets demonstrate how to compile the above code examples use the Sun Studio compiler suite:

C

cc -fast -o hello hello.c

Fortran

f90 -fast -o hello hello.f90

OpenMP

The above compilers include support for OpenMP. To compile an OpenMP code add the -fopenmp option. For example:

gcc -o mp_hello -fopenmp mp_hello.c

Intel Compilers

The following code snippets demonstrate how to compile OpenMP examples with the Intel compilers:

C

icc -openmp omp_hello.c -o hello

Fortran

ifort -openmp omp_hello.f -o hello

MPI

MPI is provided using the OpenMPI libraries. To compile MPI code use the mpicc or mpif90 compilers.

To run an MPI job see the Moab guide.

/app/dokuwiki/data/attic/guide/compiling.1351791431.txt.gz · Last modified: 2021/12/09 16:42 (external edit)