Skip to content

General Build instructions

Aiden Woodruff edited this page Nov 11, 2023 · 54 revisions

The software can be built manually or via spack.

Table of Contents

Spack Install

Spack is a bit tricky to configure on a system with many pre-installed libraries/components that you wish to use (cmake, mpi, etc.). Thus, for folks new to Spack, using spack is not recommended for a workstation or cluster. This procedure is also not recommended for folks who wish to edit the PUMI source code. For developers, installing `zoltan` and `parmetis` through Spack is a good idea.

Download spack then run

   spack install pumi +zoltan ^zoltan +parmetis -fortran -shared

This breaks down as:

'pumi +zoltan' install pumi with zoltan support

'^zoltan +parmetis -fortran -shared' - install zoltan with parmetis support, disable the fortran interface, and disable shared libraries

Note, using zoltan shared libraries also works if needed; remove '-shared'.

Manual Install

Download the code

You will need `git` installed for this.

  git clone https://github.com/SCOREC/core.git core

Install dependencies

MPI is a required third-party library, there are two good implementations:

MPICH

OpenMPI

Note that when using the jessie version of mpich -lpthread has to be added directly via -D-DSCOREC_EXTRA_CXX_FLAGS.

Zoltan and ParMetis are strongly recommended third-party libraries. Note, Zoltan must be built against the ParMETIS install and they must both use the same size indices.

ParMetis

Zoltan

It is recommended that you add the installation paths of third-party libraries to the environment variable

  CMAKE_PREFIX_PATH

which will make the following step go a lot smoother

If core is built with SIMMETRIX_ENABLED than an install of Simmetrix's SimModSuite is required. As of SCOREC/core@88b247a SimModSuite version 11.0.170411dev (or newer) is required. If you want to build and install your own version of libSimPartitionWrapper-<suffix>.a then you need to (1) prepend CMAKE_PREFIX_PATH with the libraries parent directory (i.e., /path/to/code/PartitionWrapper/lib) and (2) set SIM_MPI to the chosen <suffix>.

If core is built with CAPSTONE_ENABLED then an install of CREATE-MG is required. You need to (1) append CMAKE_PREFIX_PATH with the libraries directory (i.e. /path/to/create/lib) and (2) may need to add -D_GLIBCXX_USE_CXX11_ABI=0 to SCOREC_EXTRA_CXX_FLAGS if you experience linker errors.

Configure

You will need `cmake` installed for this. An example configure script is provided

cd core
mkdir build
cd build
source ../example_config.sh

For more advanced configuration, here is a description of some available options:

  • Required: Set -DCMAKE_C_COMPILER to /path/to/C/mpi/compiler/wrapper
  • Required: Set -DCMAKE_CXX_COMPILER to /path/to/C++/mpi/compiler/wrapper
  • Optional: Set C and CXX compiler flags:
    • Note: -DCMAKE_C_FLAGS does not affect the build.
    • Note: -DCMAKE_CXX_FLAGS does not affect the build.
    • -DSCOREC_CXX_OPTIMIZE defaults to ON to set the cxx flag "-O2"
    • -DSCOREC_CXX_SYMBOLS defaults to ON to set the cxx flags "-g"
    • -DSCOREC_CXX_WARNINGS defaults to ON to set the cxx flags "-Werror -Wextra -Wall"
    • Set -DSCOREC_EXTRA_CXX_FLAGS to specify cxx flags in addition to the above
    • Set -DSCOREC_CXX_FLAGS to override all previously set cxx flags
  • Optional: Set -DCMAKE_INSTALL_PREFIX to the directory where headers, libs, and binary files are installed when 'make install' is ran.
  • Optional: Specifying CMake dependency install locations
    • Set -DCMAKE_PREFIX_PATH to the prefix directories for optional components instead of setting the INSTALL_PREFIX for each component.
  • Optional: Enable support for Simmetrix libraries
    • Set -DENABLE_SIMMETRIX=True
    • Set -DSIM_MPI="mpich3.1.2", this string depends on your Simmetrix installation
    • Set -DSIM_PARASOLID=True if the Simmetrix Parasolid interface is also desired
    • Set -DSIM_ACIS=True if the Simmetrix ACIS interface is also desired
  • Optional: Enable support for CREATE-MG libraries
    • Set -DENABLE_CAPSTONE=True
  • Optional: Disable building executables
    • Set -DBUILD_EXES=False
  • Optional: Build all executables and prepare for testing
    • Set -DIS_TESTING=True
  • Optional: Build shared libraries (static libs are built by default)
    • Set -DBUILD_SHARED_LIBS=True
  • Optional: Enable the FORTRAN interface for use with PHASTA-Chef (assuming use of GNU compilers)
    • Set -DPUMI_FORTRAN_INTERFACE=ON -DCMAKE_Fortran_COMPILER=gfortran
  • Optional: Specifying ParMETIS and ZOLTAN install locations
    • Set -DMETIS_LIBRARY to /path/to/lib/libmetis.a
    • Set -DPARMETIS_LIBRARY to /path/to/lib/libparmetis.a
    • Set -DPARMETIS_INCLUDE_DIR to /path/to/parmetis/include where parmetis.h is located
    • Set -DZOLTAN_LIBRARY to /path/to/lib/libzoltan.a
    • Set -DZOLTAN_INCLUDE_DIR to /path/to/zoltan/include where zoltan.h is located
  • Optional: Enable support for parts with more than ~30M elements
    • Set -DMDS_ID_TYPE='long'
  • Optional: Enable support for .smb compression through ZLib
    • Set -DPCU_COMPRESS=True
  • Optional: (For advanced usage) Maximum buffer size for adjacency computation
    • Set -DMDS_SET_MAX to the desired upper bound
  • Optional: (For advanced usage) Compile a "Release" build
    • Set -DSCOREC_CXX_FLAGS="-O3 -DNDEBUG -Wall -Wextra" or
    • Set -DCMAKE_BUILD_TYPE=Release
  • Optional: (For level 20 mesh masters) Disable VTK compression if you are working with a huge (> 20M ?) serial mesh
    • Set -DLION_COMPRESS=OFF

Compile

To compile all the libraries, use

  make -j 4

When IS_TESTING=True in CMake, all executables will build by default. Otherwise, only the "utility" executables such as partitioners and file converters are build by default.

The executables are then available in

  core/build/test/

To install the libraries and headers after defining CMAKE_INSTALL_PREFIX, run

  make install

Running tests

Download the test meshes

  git clone https://github.com/SCOREC/pumi-meshes.git

Reconfigure with MESHES and IS_TESTING defined

-DIS_TESTING=True
-DMESHES="/path/to/meshes"

Rebuild

  make -j 4

Run CTest

  ctest -VV