[petsc-users] Ordering with MatCreateNest and MPI

Jed Brown jed at jedbrown.org
Thu Apr 7 08:25:47 CDT 2016


FRANCAVILLA MATTEO ALESSANDRO <d019598 at polito.it> writes:

> Hi,
>
> I'm trying to use a matrix composed of different sub-matrix blocks; I create 
> the matrix with MatCreateNest(). I'm finding it hard to understand the 
> ordering (in MPI applications) of the result of MatMult operations. 
> Apparently the result of the multiplication is correct, except that both 
> input and output vectors go through some sort of permutation. How should I 
> use the MatMult routine, i.e. how to pass the input vector with the correct 
> ordering and how to get the correct ordering of the result?
>
> Below a simple Fortran example to demonstrate what I'm trying to do (running 
> the example with 1 process works fine, with  2 or more processes I don't 
> understand how to get the correct ordering). When using standard matrices 
> (i.e., not MatNest) I've never had to care about orderings.

MatNest is semantically identical to other matrix formats.  In fact, we
strongly recommend that you write your code so that your assembly and
all subsequent operations do not depend in any way on the matrix being
MATNEST of some other format.  See src/snes/examples/tutorials/ex28.c
for an example of this.

But anyway, you can use VecGetSubVector to separate out the components
(MatNestGetISs to get the index sets if you don't already have them).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160407/0bd46c37/attachment.pgp>


More information about the petsc-users mailing list