First, create a directory where the dependencies will be compiled, e.g.,
mkdir -p ${HOME}/Software
The remainder of this guide assumes such a directory has been created.
Next, compile the COIN-OR version of METIS, e.g.,
cd ${HOME}/Software
git clone https://github.com/coin-or-tools/ThirdParty-Metis.git
cd ThirdParty-Metis && ./get.Metis
mkdir build
cd build
../configure --prefix=${PWD}
make && make install
export METISDIR=${PWD}
Next, ensure the hardware locality library is installed on your system. For example, on Ubuntu 20.04 LTS, this can be accomplished via
sudo apt-get install hwloc libhwloc-dev
A number of BLAS libraries can be used for compilation, including the proprietary Intel MKL. One open-source option is OpenBLAS, which can be installed on Ubuntu 20.04 LTS via
sudo apt install libopenblas-dev
This is the library used throughout the remainder of this guide.
If you're installing with NVIDIA CUDA GPU support, ensure it is installed and that the following environment variables are set:
export CUDA_HOME="/usr/local/cuda" # Change this to your system-specific path.
export PATH="${PATH}:${CUDA_HOME}/bin"
export LIBRARY_PATH="${LIBRARY_PATH}:${CUDA_HOME}/lib64"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${CUDA_HOME}/lib64"
export C_INCLUDE_PATH="${CPLUS_INCLUDE_PATH}:${CUDA_HOME}/include"
export CPLUS_INCLUDE_PATH="${CPLUS_INCLUDE_PATH}:${CUDA_HOME}/include"
export NVCC_INCLUDE_FLAGS="${NVCC_INCLUDE_FLAGS}:-I${CUDA_HOME}/include"
To compile with only multicore CPU support, execute
cd ${HOME}/Software
git clone https://github.com/ralna/spral.git
cd spral
./autogen.sh # If compiling from scratch.
mkdir build
cd build
CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC \
FCFLAGS=-fPIC ../configure --prefix=${PWD}/build \
--with-blas="-lopenblas" --with-lapack="-llapack" \
--with-metis="-L${METISDIR}/lib -lcoinmetis" \
--with-metis-inc-dir="${METISDIR}/include/coin-or/metis"
make && make install
To compile with multicore CPU and NVIDIA GPU support, execute
cd ${HOME}/Software
git clone https://github.com/ralna/spral.git
cd spral
./autogen.sh # If compiling from scratch.
mkdir build
cd build
CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC FFLAGS=-fPIC \
FCFLAGS=-fPIC NVCCFLAGS="-shared -Xcompiler -fPIC" \
../configure --prefix=${PWD}/build \
--with-blas="-lopenblas" --with-lapack="-llapack" \
--with-metis="-L${METISDIR}/lib -lcoinmetis" \
--with-metis-inc-dir="${METISDIR}/include/coin-or/metis"
make && make install
If your GPUs are not being recognized, consider uncommenting line 91 and commenting line 92 of src/hw_topology/hwloc_wrapper.hxx
, then recompiling.
The methods for recognizing GPUs do not seem to function independently of the type of system being used.
For future use, set the SPRAL directory environment variable via
export SPRALDIR=${PWD}/build
from the ${HOME}/Software/spral
directory.
Also, ensure the following environment variables are set when using the library:
export OMP_CANCELLATION=TRUE
export OMP_PROC_BIND=TRUE