No description, website, or topics provided.
Clone or download
Latest commit 419a359 May 23, 2016
Failed to load latest commit information.
examples Small changes Apr 12, 2016
sap More May 23, 2016
LICENSE Added license file (Modified BSD License a.k.a. BSD 3-clause license) Sep 10, 2013 Modify the README file Aug 31, 2015

SaPGPU Library version 1.0.0

SaPGPU is a C++ template library which provides a SPIKE-based preconditioner for the solution of large-scale sparse linear solvers using Krylov-space iterative solvers on CUDA architecture GPUs.

The SaPGPU library is built on top of CUSP and Thrust.

Additional information available at

Directory structure

There are two top-level directories:

contains the library's header files.
provides several example programs using the SaPGPU solver.


SaPGPU requires CUDA and the CUSP library, available from

Example Usage

#include <sap/solver.h>
#include <sap/spmv.h>
#include <sap/exception.h>

typedef typename cusp::csr_matrix<int, double, cusp::device_memory> Matrix;
typedef typename cusp::array1d<double, cusp::device_memory>         Vector;

int main(int argc, char** argv) 
  // ...
  // Read the matrix and right-hand side vector from disk files.
  Matrix A;
  Vector b;
  cusp::io::read_matrix_market_file(A, "matrix.mtx");
  cusp::io::read_matrix_market_file(b, "rhs.mtx");
  // Create the SaP solver object and the SPMV functor. In the solver constructor,
  // specify the number of partitions and a structure with optional inputs.
  sap::Options               options;
  sap::Solver<Vector, float> sapGPU(10, options);
  sap::SpmvCusp<Matrix>      spmv(A);
  // Set the solution initial guess to zero.
  Vector x(A.num_rows, 0.0);
  // Solve the problem.
  bool success = sapGPU.solve(spmv, b, x);
  // Extract solver statistics.
  sap::Stats stats = sapGPU.getStats();
  // ...

Building and running the example drivers

Use CMake to configure the provided example drivers:

  • driver_mm - sample program for using SaPGPU with a matrix read from a Matrix Market file.
  • driver_seq - sample program illustrating the use of SaPGPU on a sequence of matrices with the same sparsity pattern.
  • driver_views - sample program illustrating the use of SaPGPU with CUSP array views.
  • driver_banded - sample program illustrating the use of SaPGPU to solve banded systems.

To see a full list of the arguments for driver_mm as an example, use driver_mm -h


Submit bug reports and feature requests at

Feel free to fork the github repository and submit pull requests.


The code is available from under a BSD-3 license. See the file LICENSE.