Installation

Building with Meson:

We now support building with the Meson Build system. Under Linux, or macOS, or Windows:

# Setup SPRAL
meson setup builddir -Dexamples=true -Dtests=true -Dlibblas=openblas -Dliblapack=openblas

# Compile SPRAL
meson compile -C builddir

# Install SPRAL
meson install -C builddir

# Test SPRAL
meson test -C builddir

Options to meson

In particular, the following options may be of interest:

  • --prefix=PREFIX specifies the installation path prefix (by default /usr/local/ under Linux).

  • -Dtests=true whether to generate the tests.

  • -Dlibblas=blas BLAS library against which to link.

  • -Dliblapack=lapack LAPACK library against which to link.

  • -Dlibhwloc=hwloc HWLOC library against which to link.

  • -Dlibmetis=metis METIS library against which to link.

  • -Dlibmetis_version=5 Version of the METIS library to use.

  • -Dmetis64=true option to use METIS compiled with 64bit integer support.

For more options (including how to specify paths to the above libraries) please see meson_options.txt.

Building with Autotools:

Under Linux, or macOS:

# Get latest development version from github and run dev scripts
git clone --depth=1 https://github.com/ralna/spral.git
cd spral
./autogen.sh

# Build and install library
BUILDDIR=build; mkdir $BUILDDIR; cd $BUILDDIR
cp ../nvcc_arch_sm.c . # If building for GPU
../configure --with-metis="-L/path/to/metis -lmetis"
make
sudo make install # Optional

# Link against library
cd /path/to/your/code
gfortran -o myprog myobj.o -lspral -lmetis -lblas

Notes

  • The above instructions perform an out-of-path build: we recommend you change the value of $BUILDDIR to reflect the compiler used, for example BUILDDIR=build-gfortran-13.2.

  • The above will build the SPRAL library and a number of driver programs. To build the example and test codes, use make check.

  • Installation is not required: in many cases it will be sufficient to just link against the static library found in the .libs subdirectory.

Third-party libraries

METIS

Many of our packages use the METIS graph partitioning library to find good orderings. You can obtain a copy of METIS from http://www.cs.umn.edu/~metis. We support both version 4 and version 5 (the latter is available under the open source Apache Licence). If the METIS library is not available on the default link path, the --with-metis option to configure should be used to specify how to link against METIS. For example, if libmetis.a is in the directory /usr/local/metis-4.0, use:

../configure --with-metis="-L/usr/local/metis-4.0 -lmetis"

BLAS

Many of our packages require a high performance BLAS library to efficiently perform dense linear algebra operations. For best performance, please use the library recommended by your computer manufacturer (normally the Intel MKL). If this is not available, use an optimized alternative, such as OpenBLAS. The reference BLAS from netlib are at least an order of magnitude slower than modern optimized BLAS, and should be avoided. If bit-compatible results are desired, a bit-compatible BLAS library must be used.

If the BLAS library is not available on the default link path, or if configure detects the wrong BLAS library, the --with-blas option to configure should be used to specify how to link against the BLAS library. For example, to link against the Intel MKL using the GNU compiler suite, use:

../configure --with-blas="-L/opt/intel/mkl/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core"

Compilers and compiler options

If no compiler is specified, configure will pick a default compiler to use. If configure cannot find an appropriate compiler, or you wish to specify a different compiler you can do so by setting the following variables:

CC

specifies the C compiler to use.

FC

specifies the Fortran 90/95/2003/2008/2018 compiler to use.

NVCC

specifies the CUDA compiler to use.

Additionally, compiler flags can be specified using the following variables:

CFLAGS

specifies options passed to the C compiler.

FCFLAGS

specifies options passed to the Fortran compiler

NVCCFLAGS

specifies options passed to the CUDA compiler.

For example, to compile with ifort -g -O3 -ip we could use:

../configure FC=ifort FCFLAGS="-g -O3 -ip"

Other options to configure

The configure script is generated by autoconf, and hence offers many standard options that can be listed using the command configure --help.

In particular, the following options may be of interest:

  • --prefix=PREFIX specifies the installation path prefix (by default /usr/local/ under Linux).

Citing SPRAL or SSIDS

If you write a paper using software from SPRAL, please cite an appropriate paper (a list can usually be found in the method section of the user documentation).

J. Hogg, E. Ovtchinnikov, and J. Scott (2016). A sparse symmetric indefinite direct solver for GPU architectures. ACM Transactions on Mathematical Software (TOMS), 42(1), 1-25, https://dx.doi.org/10.1145/275654

If no paper is listed, a citation of the SPRAL GitHub website should be used, for example:

SPRAL: an open-source library for sparse linear algebra, Version 2024-01-18, http://www.numerical.rl.ac.uk/spral, January 2024.

Support

Feeback may be sent to hsl@stfc.ac.uk or by filing an issue on our github: https://github.com/ralna/spral/issues.

Licence

Copyright (c) 2014-2023, The Science and Technology Facilities Council (STFC) All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the STFC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STFC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.