You are here

Compilation Guide

As a general recommendation, we suggest selecting the newest compilers available for a new project. For repeatability, you may not want to change compilers in the middle of an experiment.

Owens Compilers

The Haswell and Broadwell processors that make up Owens support the Advanced Vector Extensions (AVX2) instruction set, but you must set the correct compiler flags to take advantage of it. AVX2 has the potential to speed up your code by a factor of 4 or more, depending on the compiler and options you would otherwise use.

With the Intel compilers, use -xHost and -O2 or higher. With the gnu compilers, use -march=native and -O3. The PGI compilers by default use the highest available instruction set, so no additional flags are necessary.

This advice assumes that you are building and running your code on Owens. The executables will not be portable.

Intel (recommended)

NON-MPI

MPI

FORTRAN 90

ifort

mpif90

C

icc

mpicc

C++

icpc

mpicxx

Recommended Optimization Options

The -O2 -xHost options are recommended with the Intel compilers. (For more options, see the "man" pages for the compilers.

OpenMP

Add this flag to any of the above: -qopenmp or -openmp

PGI

NON-MPI

MPI

FORTRAN 90

pgfortran or pgf90

mpif90

C

pgcc

mpicc

C++

pgc++

mpicxx

Recommended Optimization Options

The -fast option is appropriate with all PGI compilers. (For more options, see the "man" pages for the compilers)

Note: The PGI compilers can generate code for accelerators such as GPUs. Description of these capabilities is beyond the scope of this guide.

OpenMP

Add this flag to any of the above: -mp

GNU

NON-MPI

MPI

FORTRAN 90

gfortran

mpif90

C

gcc

mpicc

C++

g++

mpicxx

Recommended Optimization Options

The -O2 -march=native options are recommended with the GNU compilers. (For more options, see the "man" pages for the compilers)

OpenMP

Add this flag to any of the above: -fopenmp

Ruby Compilers

Intel (recommended)

NON-MPI

MPI

FORTRAN 90

ifort

mpif90

C

icc

mpicc

C++

icpc

mpicxx

Recommended Optimization Options

The -O2 -xHost options are recommended with the Intel compilers. (For more options, see the "man" pages for the compilers.

OpenMP

Add this flag to any of the above: -qopenmp or -openmp

PGI

NON-MPI

MPI

FORTRAN 90

pgfortran or pgf90

mpif90

C

pgcc

mpicc

C++

pgc++

mpicxx

NOTE: The C++ compiler used to be pgCC, but newer versions of PGI do not support this name.

Recommended Optimization Options

The -fast option is appropriate with all PGI compilers. (For more options, see the "man" pages for the compilers)

Note: The PGI compilers can generate code for accelerators such as GPUs. Description of these capabilities is beyond the scope of this guide.

OpenMP

Add this flag to any of the above: -mp

GNU

NON-MPI

MPI

FORTRAN 90

gfortran

mpif90

C

gcc

mpicc

C++

g++

mpicxx

Recommended Optimization Options

The -O2 -march=native options are recommended with the GNU compilers. (For more options, see the "man" pages for the compilers)