Skip to content
Thomas Zwinger edited this page Feb 2, 2020 · 8 revisions

Compilation

Here you can find step by step instructions how to download and compile the development version of elmer.

Linux/*NIX

  1. You need the following packages installed:

    1. a compiler suite providing C,C++ and Fortran 95 compiler (e.g. GNU gcc, g++, gfortran)
    2. cmake
    3. optimally, one provides a fast installation of BLAS and Lapack (e.g., MKL, or OpenBlas)
    4. a MPI (e.g., OpenMPI) is needed to enable parallel MPI runs
    5. optionally, solver libraries (need version with headers), such as MUMPS and Hypre can be added
  2. Retrieve the source and unpack it. Here we clone the whole repository:

    $ git clone https://www.github.com/ElmerCSC/elmerfem
  3. Create build directory

$ mkdir elmer-build

Elmer compilation system is built upon CMake which utilizes out of source builds strongly.

  1. Create pre-cache file, and save it as, f.ex, elmer-opts.cmake for CMake which contains something like this:

    SET(CMAKE_INSTALL_PREFIX "$ENV{PWD}/../elmer-install" CACHE PATH "")
    SET(CMAKE_C_COMPILER "gcc" CACHE STRING "")
    SET(CMAKE_CXX_COMPILER "g++" CACHE STRING "")
    SET(CMAKE_Fortran_COMPILER "gfortran" CACHE STRING "")

    In a pre-cache file the user can choose the installation directory for Elmer as well by modifying variable the CMAKE_INSTALL_PREFIX to change the default installation path (/usr/local/elmer). In order to enable MPI (parallel runs) in Elmer, one should include the following line

    SET(WITH_MPI TRUE CACHE BOOL "")

    and to enable threading (including SIMD)

    SET(WITH_OpenMP TRUE CACHE BOOL "")

    One might also include the lately introduced interface to Lua

    SET(WITH_LUA  TRUE  CACHE BOOL "") 
  2. Generate build scripts

    $ cd elmer-build
    $ cmake -C ../elmer-opts.cmake ../elmerfem

    The cmake tool will now inform if any libraries are missing. The build configuration can be further edited using e.g. ccmake tool or cmake-gui application.

  3. Build and install

    $ make -jN install

    Where N is the number of threads to be used.

  4. Set environment variable ELMER_HOME point to installation directory and add $ELMER_HOME/bin to PATH.

Clone this wiki locally