CUSP is an open source C++ library of generic parallel algorithms for sparse linear algebra and graph computations on CUDA architecture GPUs. CUSP provides a flexible, high-level interface for manipulating sparse matrices and solving sparse linear systems.

     

Key Features

 
  • Support for a variety of sparse matrix operations including add, subtract, copy, convert, nrm1, nrmmax, maximal independent set graph, and polynomial relaxation
  • Preconditioners based on algebraic multigrid (AMG) and approximate inverse (AINV) methods
  • Support for COO, CSR, DIA, ELL, and HYB matric formats

Performance

*NEW* CUDA 5 Math Library Performance Report Now Available


 GPU: Tesla C2050 with CUDA 4.0  CPU: Core i7 950, Trlinos/ML v5.0 and MKL v10.3

Source code example

The following example loads a matrix from disk, transparently converts the matrix to the highly-efficient HYB format, and transfers the matrix to the GPU device. The linear system A*x = b is them solved on the device using the Conjugate Gradient method. Additional code samples are available on the  CUSP Google Code Project

#include<cusp/hyb_matrix.h>
#include<cusp/io/matrix_market.h>
#include<cusp/krylov/cg.h>
int main(void)
{
    // create an empty sparse matrix structure (HYB format)
    cusp::hyb_matrix<intfloat,cusp::device_memory>A;

    // load a matrix stored in MatrixMarket format
    cusp::io::read_matrix_market_file(A,"5pt_10x10.mtx");

    // allocate storage for solution (x) and right hand side (b)
    cusp::array1d<float, cusp::device_memory>x(A.num_rows,0);
    cusp::array1d<float, cusp::device_memory>b(A.num_rows,1);

    // solve the linear system A * x = b with the Conjugate Gradient method
    cusp::krylov::cg(A, x, b);
 
    return 0;
}

 

Availability

CUSP is available under the Apache 2.0 open source license on Google Code.

If you are looking for a production-tested sparse matrix library with a C API that supports sparse matrix operations and building blocks for sparse iterative solvers, learn more about cuSPARSE.

References