Re: [ng-spice-devel] Ng-spice and SMP was: Re: [ng-spice-devel] Catching up
On Sun, 11 Feb 2001, Paolo Nenzi wrote:
> > The biggest difference is likely to be in how to interact with
> > it. This is why ACS uses its own sparse matrix package.
>
> Al, can you tell somenthing about the diffrences between SParse and
> ACS matrix package ?
Here are a few differences:
The ACS matrix package has 629 lines of code. (including comments)
Sparse has 11172.
The ACS matrix package works for all data types. Sparse works only
for double or its own "ComplexNumber" struct.
The ACS matrix package makes assumptions about the pattern of the
data stored in it. If these assumptions are not valid, you get less
than optimal performance. Sparse makes no such assumptions.
Instead, it attempts to reorder in the general case. This is one of
the reasons why the ACS package is smaller.
The ACS matrix package does not reorder the matrix. It expects it to
be properly ordered from the beginning, based on the assumption that
the caller knows more about the data than it does. Sparse reorders
the matrix, using the Markowitz algorithm, which in my tests (over 10
years ago) almost always produced worse ordering than I could do
manually. This ordering time dominated in the original Spice matrix
package, but is much better now, so it no longer dominates. This is
another reason why the ACS package is smaller.
The ACS matrix package uses a vector representation, so that the
innermost loop (most speed critical) is a vector operation,
minimizing the cache misses in the inner loop. Sparse uses linked
lists.
The ACS matrix package precomputes the parameters needed for
allocation, then allocates the entire matrix in a manner that tries
to keep it on a single memory page if possible. Sparse uses multiple
allocations, making it more likely to get cache misses.
The ACS matrix package allows you to make incremental changes to the
matrix, then solves only the parts of LU than are changed as a result
of the original change. This means that it is not necessary to
rebuild the matrix for every iteration. Sparse requires you to
rebuild and re-solve the whole thing.
As a side effect of the algorithm that lets you solve parts of the
matrix, the ACS matrix package finds hinge points in the matrix,
which should make it really easy to partition the matrix for solution
on parallel processors. Just break it everywhere that basenode[x]
== x. Global Markowitz ordering would destroy this ability to have
hinge points.
Partial thread listing:
- Re: [ng-spice-devel] Ng-spice and SMP was: Re: [ng-spice-devel] Catching up, (continued)
outitf.c,
Gillespie, Alan