[petsc-users] Reordering rows of parallel matrix across processors

Cyrill Vonplanta cyrill.von.planta at usi.ch
Fri Jul 8 02:14:39 CDT 2016


Trying to make a small example for reproducing I could figure out my mistake in the code (totally unrelated to the question). MatPermute(..) just works fine.

My apologies.
Cyrill

From: Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Date: Donnerstag, 7. Juli 2016 um 16:48
To: von Planta Cyrill <cyrill.von.planta at usi.ch<mailto:cyrill.von.planta at usi.ch>>
Cc: "petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>" <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Reordering rows of parallel matrix across processors

On Thu, Jul 7, 2016 at 3:37 AM, Cyrill Vonplanta <cyrill.von.planta at usi.ch<mailto:cyrill.von.planta at usi.ch>> wrote:
Dear all,

I would like to reorder the rows of a matrix across processors. Is this possible with MatPermute(…)?

Yes, this works with MatPermute().

Could you send this small example so I can reproduce it?

To illustrate here is how an index set would look like for a matrix with  M=35 on 2 CPU’s. Amongst other things I intend to swap the first and last row here.

[0] Number of indices in set 24
[0] 0 34
[0] 1 1
[0] 2 2
[0] 3 3
[0] 4 4
[0] 5 5
[0] 6 6
[0] 7 7
[0] 8 15
[0] 9 16
[0] 10 11
[0] 11 8
[0] 12 10
[0] 13 21
[0] 14 9
[0] 15 12
[0] 16 13
[0] 17 14
[0] 18 17
[0] 19 18
[0] 20 19
[0] 21 20
[0] 22 22
[0] 23 23
[1] Number of indices in set 11
[1] 0 24
[1] 1 25
[1] 2 26
[1] 3 27
[1] 4 28
[1] 5 29
[1] 6 30
[1] 7 31
[1] 8 32
[1] 9 33
[1] 10 0

Instead of exchanging the first and last row it seems to replace them with zeros only.
If this can’t be done with MatPermute how could it be done?

You could also use MatGetSubMatrix().

  Thanks,

    Matt

Thanks
Cyrill




--
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


More information about the petsc-users mailing list