BYU

Office of Research Computing

Compilers

Compiled code

Here are our currently recommended compiler versions.

Provider Version Module Name Language Command Comment
GNU 9 gcc/9 C gcc
C++ g++
Fortran 77/90 gfortran gfortran has replaced g77 and handles both Fortran 77 and Fortran 90
Intel 19 intel-compilers/2019 C icc
C++ icpc
Fortran 77/90 ifort
LLVM 7 llvm/7 C clang
C++ clang++

Recommended Compiler Optimizations

We recommend compiling at high optimization levels. For the above compilers, -O3 is recommended. We do not recommend -march=native as we have many different hardware generations; if you compile with -march=native on m8 the program may error with an illegal instruction if you run it on m7.

The following table outlines some recommended compiler optimizations for each compiler provider in general and for specific FSL systems. The general flags are applicable on all of our systems.

Compiler Recommend optimization flags for FSL
GNU -O3 -mavx
Intel -O3 -fp-model precise -axCORE-AVX2 -xAVX
LLVM -O3 -mavx
Portland Group -O3 -tp sandybridge

For more information about compiler flags and compiler optimizations, the manual page for the specific compiler can sometimes be a useful resource. For example, you may type man icc to learn more about the compiler flags available to the Intel C compiler. If you cannot find the information you need in manual pages, you might do a little research using your favorite search engine.

MPI

The MPI libraries and compiler wrappers are tied to particular compilers. Load the compiler you want first, then run one of these commands to see which MPI implementations are available:

module avail openmpi
module avail intel-mpi

For example, the output of module load gcc/7 ; module avail openmpi currently looks like this:

------------------------------------- /apps/modulefiles/.gcc/7 --------------------------------------
   openmpi/2.1    openmpi/3.1 (D)

This means the module openmpi/3.1 is available and can be loaded.

Intel Math Kernel Libraries

The Intel Math Kernel Libraries are a suite of libraries that provide highly optimized versions of common math routines. If your application needs to use a linear algebra package, such as LAPACK or BLAS, fast fourier transforms, or other common math routines, you may benefit by linking against the Intel MKL. The Intel MKL can be found in intel-mkl modules.

The Intel® Math Kernel Library Link Line Advisor is the recommended place to get the flags needed to link any given application with the Intel MKL, including if you are using the MKL as a BLAS or LAPACK drop-in.

Generally, the Intel MKL should either be statically linked or have a RUNPATH set in the library/executables that need it. We set the LD_RUN_PATH environment variable, which many tools will use to automatically set the RPATH/RUNPATH. If that does not work you may need to add flags such as -Wl,--enable-new-dtags,-rpath,$MKLROOT/lib/intel64.