Which library for sparse matrix structures?

Status
Not open for further replies.

tonymac

Ars Tribunus Militum
2,178
I'm getting ready to start working on a C/C++ project that will be building and solving large tri-diagonal, block tri-diagonal and triangular matrices. I know there are a lot of libraries available for handling linear algebra, but all of them having a learning curve, and I'd like to avoid false-starts.

Eventually, I'll be parallelizing the code, so that may also be a factor.

Suggestions?
 

davechen

Ars Tribunus Militum
2,981
Subscriptor
Back when I used to do this sort of stuff, I used SuiteSparse, by Tim Davis at the U of Florida:

http://www.cise.ufl.edu/research/sparse/SuiteSparse/

It has a whole collection of sparse matrix solvers. The one I used was CHOLMOD, which is the one used in MatLab IIRC. Which solver to choose depends on the nature of your matrix.

SuiteSparse is built on top of LAPACK and BLAS, which are pretty low level and FORTRAN-y. As far as parallelization, I just used the version of BLAS included in OS X's Accelerate framework, so it came for free. I think it's pretty common to find parallel, finely tuned versions of the BLAS library.
 

ShuggyCoUk

Ars Legatus Legionis
10,388
Subscriptor++
Decide early on if you want full low level control (in which case target LAPACK or BLAS) or use someone elses library that wraps/reimplements them. There are quite a few, some free, some cost money.

I have not used any personally but I know people who like Intel's MKL

A free implementation of lapack is netlib, this is... fun ... to work with, and is extremely 'fortran-y' since it is in fact written in fortran.

When you say you want to parallelize it you need to state *how*
CUDA/OpenCL like offloading? multiple threads? tuned SIMD? beowulf like stuff?

If you want to do that start taking a look at vendors support for various modes and the user's lists for issues.
 

MilleniX

Ars Tribunus Angusticlavius
8,141
Subscriptor++
As far as solvers go, Trilinos and Hypre are good-quality packages with top-notch people working on them.

What sorts of problem sizes and desired solution times are you looking at? How big you expect things to get should drive how far toward the distributed-memory parallelism end of the spectrum you should plan for up front.
 

tonymac

Ars Tribunus Militum
2,178
How big you expect things to get should drive how far toward the distributed-memory parallelism end of the spectrum you should plan for up front.
I'm going to be solving the Euler equations in 2D and 3D on meshes with upwards of 1-2 million nodes.
When you say you want to parallelize it you need to state *how* CUDA/OpenCL like offloading? multiple threads? tuned SIMD? beowulf like stuff?
Primarily MPI, possible OpenCL
Check out PETSc.
I've been looking at this one. I also found libMesh which combines a 2D/3D geometry library with PETSc based solvers. It looks like it will be useful.
 
Status
Not open for further replies.