[petsc-users] Block matrix data layout and access

Gregor.Matura at dlr.de Gregor.Matura at dlr.de
Thu Oct 25 08:43:24 CDT 2012


I'm rather new to PETSc and got along on my own so far. However, I've now run into the situation that the tutorial does not provide enough detail and on the other side going through every example found by grep with the possibly right command would take almost forever. So I would be very happy to get some hints where to start.

My problem: read in a matrix in a special format, partition and redistribute it, solve.

So far, I've read in my matrix, transformed it according to the input of MatCreateMPIAIJWithSplitArrays() and finally, for a start, KSPSolve.

Here comes the 'but': my matrix does have a "block" format:

|a ... a|
|a ... a|
|b ... b|
|b ... b|
|c ... c|
|c ... c|

The matrix is sparse (by far not every x is set), every a, b, c, ... is a small 5x5 block, each 25 double data values of a block are saved consecutively, processor 1 holds every a, #2 every b and so on.

PETSc tutorial says (as far as I understood) that PETSc's blocks are _logically_ different, but are stored just this way. And: in some sense DMDA could be the right way to access matrix data layout as PETSc uses it (would be good to achieve best possible performance).

This said, my precise questions are: Is DMDACreate2D the right way to go? Does it match my data layout best with PETSc's layout? Which example file is suited best to read up on? Does this really speeds up time to solution or should I stick with the transformed non-block variant?


Gregor Matura

Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)
German Aerospace Center
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121025/f7562161/attachment.html>

More information about the petsc-users mailing list