[petsc-users] Multiple Sparse Matrix Vector products

Matthew Knepley knepley at gmail.com
Sun Feb 19 11:33:23 CST 2012


On Sun, Feb 19, 2012 at 11:20 AM, Nun ion <m.skates82 at gmail.com> wrote:

> Hello i have a conceptual idea of a sparse matvec implementation where i
> have multiple matrices, how would i go about implementing something such as
>
> for i = ...
>    for k = ...
>       w_{ik} = K_i * u_k
>    end
> end
>
> Where each of the K_i are sparse matrices... the K_i are various stiffness
> matrices whose size can range (although they are all the same size).  The
> u_k are reused
>

I suspect that this reuse does not matter. You can do a back of the
envelope calculation for your matrices, using the
analysis method in http://www.mcs.anl.gov/~kaushik/Papers/pcfd99_gkks.pdf.
K_i is much bigger than u_k, and will
generally blow u_k right out of the cache. In fact, this is the
optimization that PETSc currently makes (see Prefetch code
in MatMult).

   Matt


> Thanks!
>
> Mark
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120219/9a7d2e15/attachment.htm>


More information about the petsc-users mailing list