Compiler Options

Shaheen II supports three different programming environments with Cray, Intel and GNU compilers. Below, you will find useful information on compilers.

  • For C code
 

 Compiler Options for MPI/Serial code  

 Compiler Options for OpenMP code  

 Compiler manual page  

PrgEnv-cray  

cc -o exe code.c

 cc -o exe -h omp code_mp.c

  man craycc

PrgEnv-intel

cc -o exe code.c

 cc -o exe -openmp code_mp.c

  man icc

PrgEnv-gnu

cc -o exe code.c

 cc -o exe -fopenmp code_mp.c

  man gcc

 

  • For C++
 

Compiler Options for MPI/Serial code

Compiler Options for OpenMP code

Compiler manual page

PrgEnv-cray

CC -o exe code.cpp

 CC -o exe -h omp code_mp.cpp

man crayCC

PrgEnv-intel

CC -o exe code.cpp

 CC -o exe -openmp code_mp.cpp

  man icpc

PrgEnv-gnu

CC -o exe code.cpp

 CC -o exe -fopenmp code_mp.cpp

  man g++

 

  • For C and C++

Once  you have validated the accuracy of your code, it may be worth trying a more aggressive set of options to improve performance. Compiler warnings can help you to identify errors at compile time, and full optimisation can introduce problems in some code. Therefore, verification should be done for each tested optimisation flag. Here are some suggestions:

 

  Options to generate warnings  

  To generate run time checks  

  For optimisation

PrgEnv-cray   

-h msglevel_3

-h bounds

  -O3 -hfp3

PrgEnv-intel

-w2

-check=stack

  -O2 -ipo

PrgEnv-gnu

-Wall

-fbounds-check

  -O3 -ffast-math -funroll-loops

 

  • For Fortran
 

Compiler Options for MPI/Serial code

Compiler Options for OpenMP code

Compiler manual page

PrgEnv-cray

ftn -o exe code.f90

 ftn -o exe -h omp code_mp.f90

  man crayftn

PrgEnv-intel

ftn -o exe code.f90

 ftn -o exe -openmp code_mp.f90

  man ifortran

PrgEnv-gnu

ftn -o exe code.f90

 ftn -o exe -fopenmp code_mp.f90

  man gfortan

 

 

Options to generate warnings

To generate run time checks

For optimisation

PrgEnv-cray

-m 3

-Rbcps

-O3 -hfp3

PrgEnv-intel

-warn all

-check all

  -O2 -ipo

PrgEnv-gnu

-Wall

-fcheck=bounds

  -O3 -ffast-math -funroll-loops