Building your own software

Modern compilers and development tools are available through the module system. It is highly recommended to always load a toolchain module, even if you are just using GCC, as the system compiler is very dated.

Intel compiler suite

The intel compiler toolchain includes:

  • icpc - C++ compiler
  • icc - C compiler
  • ifort - FORTRAN
  • imkl - Intel Math Kernel Library (BLAS, LAPACK, FFT, etc.)
  • impi - Intel MPI

Exactly how to instruct a build system to use these compilers varies from software to software.

In addition some tools are also available:

  • VTune - Visual profiling tool
  • Advisor - Code optimisation tool
  • Inspector - Memory and thread error detection tool

all of which you can find in the menu when logging in with over remote graphics.


The foss compiler toolchain includes:

  • g++ - C++ compiler
  • gcc - C compiler
  • gfortran - Fortran compiler
  • OpenBLAS - Efficient open source BLAS and LAPACK library
  • OpenMPI

Using a compiler with a build system

Common build systems (e.g. CMake) use cc, c++, or f95 for locating a compiler by default. These will point towards the very old system compilers.

With CMake, you will want to do

module load foss/2020b CMake
CC=gcc CXX=g++ FC=gfortran cmake path/to/src


module load intel/2020b CMake
CC=icc CXX=icpc FC=ifort cmake path/to/src

The variables CC, CXX, FC, are standard names that will work with other build systems as well (such as autoconf) However, some software relies on custom made build tools which makes things more difficult and will require custom solutions.

Additional libraries

We install many libraries which can greatly simplify Loading modules will set the CPATH and LIBRARY_PATH environment variables, which are usually picked up popular build systems. However, many build systems will fail to respect these general rules, and may require some tweaking to build correctly.

Every library is not installed for every toolchain version. If you are missing some dependency for your software, you can request an installation, or install it locally.

Building CUDA code

If you compile code for GPU:s using for example nvcc you must be aware that you need to make sure you not only build for the type of GPU on the system you are compiling with, but also other parts of the resource.

To do this please add the flags -gencode=arch=compute_XX,code=sm_XX for each compute capability XX you want to support to the nvcc commands.

  • For Vera, please replace XX with/add 61 (for frontend machines), 70 (for V100:s), 75 (for T4:s)
  • For Alvis, please replace XX with/add 70 (for V100:s), 75 (for T4:s), 80 (for A100:s)

See the CUDA best practices guide for more information.