Application Development


Before using compilers on the system you must load the compiler module:

$ module load intelcomp

Compiling Fortran Code

Use the ifort command either on the command line or in a makefile to invoke the Intel Fortran compiler:

$ ifort myprog.f90

For more information see the Intel® Fortran Compiler User and Reference Guide.

Compiling C/C++ Code

You can invoke the C/C++ compiler on the command line with either icc or icpc. When you invoke the compiler with icc it compiles C source files using C libraries and C include files. If you use icc with a C++ source file, it is compiled as a C++ file.

$ icc myprog.c

When you invoke the compiler with icpc it compiles C++ source files using C++ libraries and C++ include files. If you use icpc with a C source file, it is compiled as a C++ file.

$ icpc myprog.cpp

For more information see the Intel® C++ Compiler User and Reference Guide.

Compiling and Linking MPI Programs

To compile and link MPI programs first load the mpt module

$ module load mpt

Commands to build MPI applications:

$ ifort myprog.f90 -lmpi                 # Fortran codes
$ icc myprog.c -lmpi                     # C codes
$ icpc myprog.cpp -lmpi++ -lmpi          # C++ codes

Compiling OpenMP Code

When compiling code using OpenMP ($OMP) directives include the -openmp option, e.g. C++ program:

$ icpc -openmp myprog.cpp

Recommended Compiler Options


This is the default opimization level including loop unrolling, inlining of intrinsics and dead-code elimination.
The -ftz option (see Gradual Underflow below) is enabled at -O1 and higher levels.


Generate optimized code specialized for the Sandy Bridge processor using Advanced Vector Extensions (AVX) instructions

Gradual Underflow

Underflow occurs when the result of an arithmetic operation is smaller than the smallest normal floating point number of the target datatype. Smaller numbers, subnormal or denormal numbers, can be represented but with fewer bits of precision. Production of a subnormal numbers is called gradual underflow. One way to deal with such underflow is to flush denormal results to zero. This will lead to some loss of precision when results are very small but may improve performance since frequent gradual underflow calculations consume a lot of system time. If subnormal values are critical to the behavior of your program you should add the -no-ftz option when using -O1 or higher optimization level.


Flush denormal results to zero. This is the default option with every optimization except -O0


Do not flush denormal results to zero


The Boost library version 1.61.0 includes bjam/b2 and the necessary files for building python extensions with Boost.Python. Boost.Python is a C++-library which enables interoperability between C++ and the Python programming language. Methods and abstracted data types implemented with C++ can be made availabe for use by Python.The Boost Web page lists what is supported by the library.

Example: Import methods to Python

Chapter 1 of Numerical Recipes implements three methods

  • flmoon() :: The method calculates the phases of the moon
  • julday() :: The method calculates the Julian Day Number
  • caldat() :: The method returnd the date based on the Julian Day Number as input

With this methods available in a python interactive session it is for example easier to search for future occurrences of a full moon on Friday 13th ( a suggested exercise at the end of Chapter 1 of Numerical Recipes.)

Note that this page do not show the implementation of these methods. You need to go to Numerical Recipes to see the implementation

The interfaces

Let us first look at the methods interfaces

Method interfaces
void flmoon(const Int n, const Int nph, Int &jd, Doub &frac);
Int julday(const Int mm, const Int id, const Int iyyy);
void caldat(const Int julian, Int &mm, Int &id, Int &iyyy);

Both flmoon() and caldat() having arguments passing by reference. The results of the calculations are returned through these. This is not doable in Python. One way to get around this is by defining local variables and let the functions return a tuple. Note that the implementations in Numerical Recipes use defined types (Int and Doub). This example will use built-in types (int and double).

#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/tuple.hpp>
// function definitions
boost::python::tuple flmoon(const int n, const int nph)
  int jd;
  double frac;
  // Implementation, see Numerical Recipes.
  return boost::python::make_tuple(jd,frac);
boost::python::tuple caldat(const int julian)
  int mm,id,iyyy;
  // Implementation, se Numerical Recipes.
  return boost::python::make_tuple(mm,id,iyyy);
int julday(const int mm, const int id, const int iyyy) {
  // Implementation, see Numerical Recipes.
  using namespace boost::python;
  def("flmoon", flmoon);
  def("caldat", caldat);
  def("julday", julday);

After the function decfini

# Copyright David Abrahams 2006. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at

import python ;

path-constant MHOME : /Users/blin ;

import os ;
local BOOST_ROOT = [ os.environ BOOST_ROOT ] ;

if ! [ python.configured ]
    ECHO "notice: no Python configured in user-config.jam" ;
    ECHO "notice: will use default configuration" ;
    using python ;

# Specify the path to the Boost project.  If you move this project,
# adjust this path to refer to the Boost root directory.
use-project boost
   : $(BOOST_ROOT) ;
#  : ../../../.. ;

# Set up the project-wide requirements that everything uses the
# boost_python library from the project whose global ID is
# /boost/python.
  : requirements <library>/boost/python//boost_python 
  : usage-requirements <implicit-dependency>/boost//headers 

# Declare the extension module.  You can specify multiple
# source files after the colon separated by spaces.
python-extension flmoon_ext : flmoon.cpp ;

# Put the extension and Boost.Python DLL in the current directory, so
# that running script by hand works.
install convenient_copy 
  : flmoon_ext 

Our directory have the following contents:

Directory content
blin@service0:/work/blin/flmoon> ls
flmoon.cpp  Jamroot

We now execute b2 or bjam (they are equivalent) in the directory containing flmoon.cpp. b2/bjam will build a debug version of the flmoon extension, which we can load into a python interpreter. We need to set the necessary environmental variables to have access to the Intel compiler, boost library and python - note the module loads before executing b2/bjam.

blin@service0:/work/blin> module list
Currently Loaded Modulefiles:
 1) intelcomp/16.0.1   2) mpt/2.14           3) python/2.7.12      4) boost/1.61.0
blin@service0:/work/blin> cd flmoon/
blin@service0:/work/blin/flmoon> b2
Performing configuration checks
    - 32-bit                   : no
    - 64-bit                   : yes
    - arm                      : no
    - mips1                    : no
    - power                    : no
    - sparc                    : no
    - x86                      : yes
    - symlinks supported       : yes
...found 166 targets...
...updating 5 targets...
common.mkdir bin/intel-linux-16.0.1
common.mkdir bin/intel-linux-16.0.1/debug
intel-linux.compile.c++ bin/intel-linux-16.0.1/debug/flmoon.o bin/intel-linux-16.0.1/debug/
...updated 5 targets...

We start a python interpreter and load the extension library.

blin@service0:/work/blin/flmoon> ls
bin  flmoon.cpp  Jamroot
blin@service0:/work/lin/flmoon> python
Python 2.7.12 (default, Aug 15 2016, 22:53:59)
[GCC Intel(R) C++ gcc 4.3 mode] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flmoon_ext as flm
>>> flm.flmoon(1445,2)
(2457707, 0.06376649226149311)
>>> flm.caldat(2457707)
(11, 14, 2016)

Math Libraries

Intel Math Kernel Library (MKL)

See the MKL page.


See the GSL page.


See the FFTW page.

Scientific Data Libraries


See the NetCDF page.


See the HDF5 page.