Skip to content

Compiling code in Linux

Bodhinanda Chandra edited this page Sep 20, 2022 · 7 revisions

Download and Installation

In order to obtain the source code, you will need to clone the repository using git. You can install git through the following command in Linux Ubuntu:

sudo apt-get install git

Once git is installed you can fetch the code by using this command in a terminal:

git clone https://github.com/geomechanics/mpm.git mpm

Alternatively, one can go to our GitHub, click the green "Code" button, and "Download ZIP" to manually download the compressed .zip folder.

Compile

  1. Go to the downloaded mpm folder and run mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=g++ -DNO_KAHIP=True ..

  2. Run make clean && make -jN (where N is the number of cores).

Note: check number of cores with lscpu

Compile mpm or mpmtests

To compile either mpm, mpmtest_unit, or mpmtest_small alone, run make mpm -jN, make mpmtest_unit -jN, make mpmtest_small -jN (where N is the number of cores).

Advanced

Compile with Ninja build system

This is an alternative to make.

  1. Run mkdir build && cd build && cmake -GNinja -DCMAKE_CXX_COMPILER=g++ ...

  2. Run ninja

Compile with Partio viz support

Please include -DPARTIO_ROOT=/path/to/partio/ in the cmake command. A typical cmake command would look like cmake -DCMAKE_BUILD_TYPE=Release -DPARTIO_ROOT=~/workspace/partio/ ..