[petsc-users] Scattering a vector to/from a subset of processors

Sreeram R Venkat srvenkat at utexas.edu
Wed Oct 4 18:02:37 CDT 2023


Suppose I am running on 12 processors, and I have a vector "v" of size 36
partitioned over the first 4. v still uses the PETSC_COMM_WORLD, so it has
a layout of (9, 9, 9, 9, 0, 0, ..., 0). Now, I would like to repartition it
over all 12 processors, so that the layout becomes (3, 3, 3, ..., 3). I've
been trying to use VecScatter to do this, but I'm not sure what IndexSets
to use for the sender and receiver.

The result I am trying to achieve is this:

Assume the vector is v = <0, 1, 2, ..., 35>

     Start                                Finish
Proc | Entries                 Proc | Entries
    0   |  0,...,8                     0   | 0, 1, 2
    1   |  9,...,17                   1   | 3, 4, 5
    2   |  18,...,26                 2   | 6, 7, 8
    3   |  27,...,35                 3   | 9, 10, 11
    4   |  None                     4   | 12, 13, 14
    5   |  None                     5   | 15, 16, 17
    6   |  None                     6   | 18, 19, 20
    7   |  None                     7   | 21, 22, 23
    8   |  None                     8   | 24, 25, 26
    9   |  None                     9   | 27, 28, 29
    10   |  None                   10 | 30, 31, 32
    11   |  None                   11  | 33, 34, 35

Appreciate any help you can provide on this.

Thanks,
Sreeram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20231004/1d2948d3/attachment.html>


More information about the petsc-users mailing list