SPM: SParse Matrix package

pipeline status coverage report coverity report

SPM (SParse Matrix package) is a scientific library that provides basic operation coverage to manipulate sparse matrices in CSC, CSR, and IJV format. The functionalities covered are:

  • sparse matrix -by- dense matrix products
  • sparse matrix -by- vector products
  • norm computations
  • matrix and vector scaling
  • sort functions
  • graph symmetrization and merge of duplicate entries
  • random generators for right hand sides
  • check routines for linear solvers
  • In-place format conversion routines
  • drivers to read matrices from files (MatrixMarket, Harwell-Boeing/RSA, IJV, …)
  • Laplacian generators for stencils
  • multi-dof and variadic dof as input

Python, Julia and Fortran90 wrappers are included in the package.

Warning: This package do not intent to provide performance for now, but a portable API and simple interface to manipulate sparse matrices both in shared or distributed memory. This is somehow similar to what has been proposed in the GNU Sparse Library in parallel of this project for the shared memory aspects.


To use last development state of SPM, please clone the master branch. Note that SPM contains a git submodule morse_cmake. To get sources please use these commands:

# if git version >= 1.9
  git clone --recursive git@gitlab.inria.fr:solverstack/spm.git
  cd spm
# else
  git clone git@gitlab.inria.fr:solverstack/spm.git
  cd spm
  git submodule init
  git submodule update


The latest Doxygen documentation is available here.

The main functionalities are listed here.


Build and install with CMake

SPM can be built using CMake. This installation requires to have some library dependencies already installed on the system:

  • BLAS (MKL, OpenBlas, …) and CBLAS (sequential version required)
  • Python and Fortran compiler for wrappers and examples (optional)

For instance, on debian-like systems, dependencies can be installed with the following command:

  sudo apt-get install cmake gcc gfortran libopenblas-dev liblapacke-dev python-numpy

The main options to configure the SPM configuration build are:

  • Classic cmake options:
    • CMAKE_BUILD_TYPE: Debug, RelWithDebInfo, Release, MinSizeRel; we recommend to use the Release, or RelWithDebInfo, for performance.
    • CMAKE_INSTALL_PREFIX: Specify the prefix directory to install the library
    • BUILD_SHARED_LIBS=[OFF]: Enable the shared libraries build. This option needs to be enabled for the Python wrapper.
  • Integer type:
    • SPM_INT64[=ON]: Enable/disable int64_t for integer arrays.
  • Documentation:
    • BUILD_DOCUMENTATION[=OFF] to enable the Doxygen documentation generation

Get involved!

Reporting an issue

We strongly recommend all users to use the issue tracker to report any problems with the software, or for any feature request. We will try our best to answer them in a short time frame.




The following people contribute or contributed to the development of SPM:

  • Mathieu Faverge
  • Matthieu Kuhn
  • Xavier Lacoste
  • Selmane Lebdaoui
  • GrĂ©goire Pichon
  • Florent Pruvost
  • Pierre Ramet
  • Theophile Terraz
  • Tony Delarue

If we forgot your name, please let us know that we can fix that mistake.



Full Professor of Computer Science

My interests span high-performance computing, focusing on sparse linear algebra. I am the developer of PaStiX, a high-performance sparse direct solver.