-
Notifications
You must be signed in to change notification settings - Fork 319
Compilation
Here you can find step by step instructions how to download and compile the development version of elmer.
-
You need the following packages installed:
- a compiler suite providing C,C++ and Fortran 95 compiler (e.g. GNU gcc, g++, gfortran)
- cmake
- optimally, one provides a fast installation of BLAS and Lapack (e.g., MKL, or OpenBlas)
- a MPI (e.g., OpenMPI) is needed to enable parallel MPI runs
- optionally, solver libraries (need version with headers), such as MUMPS and Hypre can be added
-
Retrieve the source and unpack it. Here we clone the whole repository:
$ git clone https://www.github.com/ElmerCSC/elmerfem
-
Create build directory
$ mkdir elmer-build
Elmer compilation system is built upon CMake which utilizes out of source builds strongly.
-
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 lineSET(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 "")
-
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 orcmake-gui
application. -
Build and install
$ make -jN install
Where
N
is the number of threads to be used. -
Set environment variable
ELMER_HOME
point to installation directory and add$ELMER_HOME/bin
toPATH
.