Installation and Requirements

The STRUMPACK package uses the CMake build system (CMake version >= 2.8) . The recommended way of building the STRUMPACK library is as follows:

> tar-xvzf strumpack-x.y.z.tar.gz
> cd strumpack-x.y.z
> mkdir build
> cd build
> cmake ../ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/path/to/install \
-DCMAKE_CXX_COMPILER=<C++ compiler> \ # this and below are optional, CMake will try to autodetect
-DCMAKE_Fortran_COMPILER=<Fortran77 compiler> \
-DTPL_SCALAPACK_LIBRARIES="/path/to/scalapack/libscalapack.a;/path/to/blacs/libblacs.a" \
-DTPL_METIS_INCLUDE_DIRS=/path/to/metis/include \
-DTPL_METIS_LIBRARIES=/path/to/metis/libmetis.a \
-DTPL_ENABLE_PARMETIS=ON \ # optional
-DTPL_PARMETIS_INCLUDE_DIRS=/path/to/parmetis/include \
-DTPL_PARMETIS_LIBRARIES=/path/to/parmetis/libparmetis.a \
-DTPL_ENABLE_SCOTCH=ON \ # optional
-DTPL_SCOTCH_INCLUDE_DIRS=/path/to/scotch/include \
-DTPL_SCOTCH_LIBRARIES="/path/to/ptscotch/libscotch.a;...libscotcherr.a;...libptscotch.a;...libptscotcherr.a"
> make
> make test # optional, takes a while
> make install

The above will only work if you have the following dependencies, and CMake can find them:

  • C++11, C and FORTRAN77 compilers. CMake looks for these compilers in the standard locations, if they are installed elsewhere, you can specify them as follows:
    > cmake ../ -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_CXX_COMPILER=g++ \
    -DCMAKE_C_COMPILER=gcc \
    -DCMAKE_Fortran_COMPILER=gfortran \
  • MPI (Message Passing Interface) library. Support for MPI is enabled by default in STRUMPACK, but can be disabled by adding
    -DSTRUMPACK_USE_MPI=OFF
    to the CMake command. You should not need to manually specify the MPI compiler wrappers. CMake will look for MPI options and libraries and set the appropriate compiler and linker flags.
  • OpenMP v3.1 support is required in the C++ compiler to use the shared-memory parallelism in the code. OpenMP support can be disabled by adding the CMake option
    -DSTRUMPACK_USE_OPENMP=OFF
    OpenMP v3.1 introduces task parallelism, which is used extensivelythroughout the code. STRUMPACK also uses tasks with dependencies, an OpenMP feauture introduced in version v4.0 as well as the taskloop construct, introduced in OpenMP 4.5. It is assumed you have at least OpenMP 3.1, and CMake will check whether your compiler supports task dependencies and the taskloop construct and enable those only if found.
  • BLAS and LAPACK libraries. For performance it is crucial to use optimized BLAS/LAPACK libraries like for instance Intel® MKL, AMD® ACML, Cray® LibSci or OpenBLAS. The default versions of the Intel® MKL and Cray® LibSci BLAS libraries will use multithreaded kernels, unless when they are called from within an OpenMP parallel region, in which case they run sequentially. This is the behavior STRUMPACK relies upon to achieve good performance when running in MPI+OpenMP hybrid mode.
  • ScaLAPACK (included in Intel® MKL or Cray® LibSci), is not required when compiling without MPI. ScaLAPACK depends on the BLACS communication library and on PBLAS (parallel BLAS), both of which are typically included with the ScaLAPACK installation (from ScaLAPACK 2.0.2, the blacs library is included in the ScaLAPACK library file). If CMake cannot locate these libraries, you can specify their path by setting the environment variable $SCALAPACKDIR ot by specifying the libraries manually:
    > cmake ../ -DCMAKE_BUILD_TYPE=Release \
    -DTPL_BLAS_LIBRARIES="..." \
    -DTPL_LAPACK_LIBRARIES="..." \
    -DTPL_SCALAPACK_LIBRARIES="..."
    Or one can also directly modify the linker flags to add for instance the ScaLAPACK and BLACS libraries:
    > cmake../ -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_EXE_LINKER_FLAGS="-L/usr/lib64/mpich/lib/ -lscalapack -lmpiblacs"
    When using Intel MKL we recommend using the the link advisor: https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
  • METIS (≥ 5.1.0 required) for the nested dissection matrix reordering. Metis can be obtained from: http://glaros.dtc.umn.edu/gkhome/metis/metis/download. CMake looks for the Metis inlude files the library in the default locations as well as in $METISDIR/include and $METISDIR/lib. Using the Bash shell, the METISDIR environment variable can be set as export METISDIR=/usr/local/metis/. Alternatively, you can specify the location of the header and library as follows:
    > cmake ../ -DCMAKE_BUILD_TYPE=Release \
    -DTPL_METIS_INCLUDE_DIRS=/usr/local/metis/include \
    -DTPL_METIS_LIBRARIES=/usr/local/metis/lib/libmetis.a
  • PARMETIS (optional, only used when compiling with MPI) for parallel nested dissection. ParMetis can be download from http://glaros.dtc.umn.edu/gkhome/metis/parmetis/download
    The steps to make sure CMake can find ParMetis are similar as for Metis. Enable with -DTPL_ENABLE_PARMETIS. The CMake variables are $PARMETISDIR or TPL_PARMETIS_INCLUDE_DIRS and TPL_PARMETIS_LIBRARIES.
  • SCOTCH and PT-SCOTCH (≥ 5.1.12) (optional) for matrix reordering. Scotch can be downloaded from: http://www.labri.fr/perso/pelegrin/scotch/ Configuring CMake to find (PT-)Scotch is similar to Metis. Enable with -DTPL_ENABLE_SCOTCH For (PT-)Scotch the CMake variables are $SCOTCHDIR or TPL_SCOTCH_INCLUDE_DIRS and TPL_SCOTCH_LIBRARIES. Make sure to specify all libraries: libscotch, libscotcherr, libptscotch and libptscotcherr.
  • getopt_long: This is a GNU extension to the POSIX getopt() C library function.
  • Combinatorial BLAS [1] (optional) can be used for parallel reordering for stability, i.e., to get nonzeros on the diagonal of the matrix, as an alternative to the sequential MC64 (included). Get it from: https://people.eecs.berkeley.edu/~aydin/CombBLAS/html/ Enable by specifying -DTPL_ENABLE_COMBBLAS and set TPL_COMBBLAS_INCLUDE_DIRS and TPL_COMBBLAS_LIBRARIES.
  • TCMalloc, TBB Malloc or jemalloc (optional): these can lead to dramatic performance improvements for multithreaded code that performs frequent memory allocations. Link with the one of these libraries, e.g.:
    -DCMAKE_EXE_LINKER_FLAGS="-ltcmalloc"
    to replace the default memory allocator (C++ new) with a more scalable implementation. See also Advanced Usage Tips.

The code was tested on GNU/Linux with the GNU and Intel® compilers and the OpenBLAS, Intel® MKL® and Cray® LibSci® numerical libraries. If you encounter issues on other platforms or with other BLAS/LAPACK implementations, please let us know. Successful compilation will create a libstrumpack.a file.