← Back to team overview

dolfin team mailing list archive

Re: PDE<->ODE interface

 

On Tue, Nov 08, 2005 at 09:58:46AM +0100, Johan Hoffman wrote:

...

> 
> I believe you Johan estimated the work for a matrix-free approach based on
> the action of f(u), to be favourable to forming the matrix A and using
> matrix-vector multiplication Ax? In general?
> 
> /Johan
> 

Well, I speculated that it would be favorable :). I made a simple test
with the form for linear elasticty once, and I ran it again now also
with a mass form to compare. The mesh is a unit cube with 162k cells
and I perform each operation (assemble or multiply) 10 times. "Matrix"
is assembly of a matrix, "Action" is the assembly of the action vector
and "Mult" is matrix-vector multiplication with the assembled
matrix. Here are the results:

Elasticity:

Matrix: 31s
Action: 10s
Mult:   0.53s

Mass:

Matrix: 28s
Action: 3.1s
Mult:   0.53s


I'm not sure why the Matrix time only goes up 3 seconds while the
Action time goes up 6 seconds between the mass and elasticity forms,
that should be investigated. The extra work going from mass to
elasticity should be the same for both cases. Perhaps there is room
for optimization there.

But we can clearly see that the sparse matrix overhead dominates the
matrix assembly for these forms. But that overhead becomes less
relevant for more complicated forms.

If you need to re-assemble the matrix for every matrix-vector
multiplication (i.e. every iteration of some algorithm), then it's
clearly favorable to assemble the action instead. But if you are
allowed to reuse the matrix for several iterations, then it seems to
be faster to assemble the matrix and then do matrix-vector
multiplication.

But I think it's pretty interesting that assembling the action of the
mass form is only a factor 6 slower than performing the matrix-vector
multiplication (which assumes you already have the matrix). We could
probably make the assembly even faster, but I doubt the matrix-vector
multiplication time could be significantly reduced.

  Johan



Follow ups

References