This is an old revision of the document!
The following is a list of C, C++ and Fortran compilers available on the SUN cluster and the M9000:
icc (for C and C++)ifortgccg++gfortran
Sun Studio
ccCCf90/f95The 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:
module avail
module add <module>
module remove <module>
#include <stdio.h> int main() { printf("Hello World"); return 0; }
#include <stdlib.h> #include <stdio.h> #include <mpi.h> int main(argc, argv) int argc; char *argv[]; { int rank, size, len; char name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Get_processor_name(name, &len); printf ("Hello world! I'm %d of %d on %s\n", rank, size, name); MPI_Finalize(); exit(0); }
PROGRAM Hello PRINT *, "Hello World" END PROGRAM Hello
The following code snippets demonstrate how to compile the above code examples use the GNU compiler suite:
gcc -o hello hello.c
gfortran -o hello hello.f90
The following code snippets demonstrate how to compile the above code examples use the Sun Studio compiler suite:
cc -fast -o hello hello.c
f90 -fast -o hello hello.f90
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
code from https://computing.llnl.gov/tutorials/openMP/samples/C/omp_hello.c
The following code snippets demonstrate how to compile OpenMP examples with the Intel compilers:
icc -openmp omp_hello.c -o hello
ifort -openmp omp_hello.f -o hello
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.