Re: [petsc-users] Advice on small block matrix vector multiplication

2023-06-18 Thread Matthew Knepley
On Sun, Jun 18, 2023 at 2:49 PM Duan Junming  wrote:

> *From:* knep...@gmail.com 
> *Sent:* Sunday, June 18, 2023 20:35
> *To:* Duan Junming
> *Cc:* petsc-users@mcs.anl.gov
> *Subject:* Re: [petsc-users] Advice on small block matrix vector
> multiplication
>
>
> On Sun, Jun 18, 2023 at 2:13 PM Duan Junming via petsc-users <
> petsc-users@mcs.anl.gov> wrote:
>
>> Dear all,
>>
>
>> I am using DMPlex to manage the unknowns, two fields, one for pressure,
>> and one for velocities with two/three components, defined in each cell.
>> They're represented by polynomials, with N (10~50) dofs for each component.
>>
> I have an operator which can be written in a matrix form (N-by-N, dense),
>> to be applied on the pressure field or each component of the velocities in
>> each cell (the same for each cell and also for each component).
>>
> I was wondering which matrix should be defined to implement the block
>> matrix-vector multiplication, here block means the pressure or the
>> component of the velocities. Maybe a sequential block mat? Could you
>> recommend any example?
>>
> Or I just implement this matrix-vector multiplication by hand?
>>
>
> Dear Matt,
>
> Thank you for your quick reply!
>
>
> 1) It sounds like you have a collocated discretization, meaning p,u,v,w
> are all at the same spots. Is this true?
>
> You're right. They're collocated at the same position.
>
>
> 2) You have a dense operator, like FFT, that can act on each component
>
> Right, a dense operator applied on each component.
>
>
> 3) I think you should make a vector with blocksize d+1 and extract the
> components with
>
>   https://petsc.org/main/manualpages/Vec/VecStrideGather/
>
> then act on them, then restore with
>
>   https://petsc.org/main/manualpages/Vec/VecStrideScatter/
>
> You can use the *All() versions to do all the components at once.
>
> Does this function work with the global/local vector generated from DMPlex?
>

It should. By default, Plex orders all unknowns on a mesh point by field.


> Now the vector is like: p_1, p_2, ..., p_N, u_1, v_1, w_1, ..., u_N, v_N,
> w_N.
>

When you extract a component, it will have one field in order, as above.

  Thanks,

Matt


>   Thanks,
>
>  Matt
>
>
> Thanks!
>> Junming
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> 
>


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

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] Advice on small block matrix vector multiplication

2023-06-18 Thread Duan Junming via petsc-users
From: knep...@gmail.com 
Sent: Sunday, June 18, 2023 20:35
To: Duan Junming
Cc: petsc-users@mcs.anl.gov
Subject: Re: [petsc-users] Advice on small block matrix vector multiplication

On Sun, Jun 18, 2023 at 2:13 PM Duan Junming via petsc-users 
mailto:petsc-users@mcs.anl.gov>> wrote:
Dear all,

I am using DMPlex to manage the unknowns, two fields, one for pressure, and one 
for velocities with two/three components, defined in each cell. They're 
represented by polynomials, with N (10~50) dofs for each component.
I have an operator which can be written in a matrix form (N-by-N, dense), to be 
applied on the pressure field or each component of the velocities in each cell 
(the same for each cell and also for each component).
I was wondering which matrix should be defined to implement the block 
matrix-vector multiplication, here block means the pressure or the component of 
the velocities. Maybe a sequential block mat? Could you recommend any example?
Or I just implement this matrix-vector multiplication by hand?

Dear Matt,

Thank you for your quick reply!

1) It sounds like you have a collocated discretization, meaning p,u,v,w are all 
at the same spots. Is this true?

You're right. They're collocated at the same position.

2) You have a dense operator, like FFT, that can act on each component

Right, a dense operator applied on each component.

3) I think you should make a vector with blocksize d+1 and extract the 
components with

  https://petsc.org/main/manualpages/Vec/VecStrideGather/

then act on them, then restore with

  https://petsc.org/main/manualpages/Vec/VecStrideScatter/

You can use the *All() versions to do all the components at once.

Does this function work with the global/local vector generated from DMPlex? Now 
the vector is like: p_1, p_2, ..., p_N, u_1, v_1, w_1, ..., u_N, v_N, w_N.

  Thanks,

 Matt

Thanks!
Junming


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

https://www.cse.buffalo.edu/~knepley/


Re: [petsc-users] IS natural numbering to global numbering

2023-06-18 Thread Matthew Knepley
On Sun, Jun 18, 2023 at 2:21 PM YuSh Lo  wrote:

> Hi Matthew,
>
> Yes, I have called DMPlexDistribute().
>
> so what I do is:
>
> CALL DMSetUseNatural(serialDM, PETSC_TRUE, errorCode)
> CALL DMPlexDistribute(serialDM, 0, migrationSF, distributedDM, errorCode)
> CALL DMPlexGetGlobalToNaturalSF(serialDM, naturalSF, errorCode)
> CALL PetscSFView(naturalSF, PETSC_VIEWER_STDOUT_WORLD, errorCode)
>
> The naturalSF is null.
>

You can see here:


https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexdistribute.c#L1836

that the natural SF is created when you distribute. Are you running in
serial?


https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexdistribute.c#L1715

No SF is created in serial because we do not reorder unless distributing.

  Thanks,

 Matt


> Thanks,
> Josh
>
>
>
> Matthew Knepley  於 2023年6月18日 週日 上午7:42寫道:
>
>> On Sun, Jun 18, 2023 at 2:12 AM YuSh Lo  wrote:
>>
>>> I am getting a null PetscSF after calling DMPlexGetGlobalToNatural
>>>
>>
>> Did you call DMDIstribute()? This is where the map is created because
>> until then, the map is identity.
>>
>>   Thanks,
>>
>>  Matt
>>
>>
>>> YuSh Lo  於 2023年6月18日 週日 上午12:18寫道:
>>>
 Hi Matthew,

 After setting DMSetUseNatural to true and calling
 DMPlexGetGlobalToNatural,
 I call PestcSFView right away, it gives segmentation fault.
 I have also tried DMGetNaturalSF, it also gives segmentation fault when
 calling PetscSFView.
 I use PETSC_VIEWER_STDOUT_WORLD as PetscViewer

 Thanks,
 Josh


 Matthew Knepley  於 2023年6月9日 週五 下午1:04寫道:

> On Fri, Jun 9, 2023 at 1:46 PM YuSh Lo  wrote:
>
>> Hi Barry,
>>
>> Is there any way to use the mapping generated by DMPlexDistribute
>> along with AO?
>>
>
> For Plex, if you turn on
>
>   https://petsc.org/main/manualpages/DM/DMSetUseNatural/
>
> before DMPlexDistribute(), it will compute and store a GlobalToNatural
> map. This can be
> used to map vectors back and forth, but you can extract the SF
>
>   DMPlexGetGlobalToNaturalSF
> 
>
> and use that to remap your IS, by extracting the indices.
>
>   THanks,
>
>  Matt
>
>
>> Thanks,
>> Josh
>>
>>
>> Barry Smith  於 2023年6月9日 週五 上午10:42寫道:
>>
>>>
>>>   You might be looking for
>>> https://petsc.org/release/manualpages/AO/AO/#ao
>>>
>>>
>>> On Jun 9, 2023, at 11:02 AM, Mark Adams  wrote:
>>>
>>> An IS is just an array of integers. We need your context.
>>> Is this question for sparse matrices? If so look at the
>>> documentation on the AIJ matrix construction and the global vertex
>>> numbering system.
>>>
>>> Mark
>>>
>>> On Thu, Jun 8, 2023 at 1:15 PM YuSh Lo  wrote:
>>>
 Hi,

 I have an IS that contains some vertex that is in natural
 numbering. How do I map them to global numbering without being 
 distributed?

 Thanks,
 Josh

>>>
>>>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> 
>

>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> 
>>
>

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

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] Advice on small block matrix vector multiplication

2023-06-18 Thread Matthew Knepley
On Sun, Jun 18, 2023 at 2:13 PM Duan Junming via petsc-users <
petsc-users@mcs.anl.gov> wrote:

> Dear all,
>
> I am using DMPlex to manage the unknowns, two fields, one for pressure,
> and one for velocities with two/three components, defined in each cell.
> They're represented by polynomials, with N (10~50) dofs for each component.
> I have an operator which can be written in a matrix form (N-by-N, dense),
> to be applied on the pressure field or each component of the velocities in
> each cell (the same for each cell and also for each component).
> I was wondering which matrix should be defined to implement the block
> matrix-vector multiplication, here block means the pressure or the
> component of the velocities. Maybe a sequential block mat? Could you
> recommend any example?
> Or I just implement this matrix-vector multiplication by hand?
>

1) It sounds like you have a collocated discretization, meaning p,u,v,w are
all at the same spots. Is this true?

2) You have a dense operator, like FFT, that can act on each component

3) I think you should make a vector with blocksize d+1 and extract the
components with

  https://petsc.org/main/manualpages/Vec/VecStrideGather/

then act on them, then restore with

  https://petsc.org/main/manualpages/Vec/VecStrideScatter/

You can use the *All() versions to do all the components at once.

  Thanks,

 Matt


> Thanks!
> Junming
>


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

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] IS natural numbering to global numbering

2023-06-18 Thread YuSh Lo
Hi Matthew,

Yes, I have called DMPlexDistribute().

so what I do is:

CALL DMSetUseNatural(serialDM, PETSC_TRUE, errorCode)
CALL DMPlexDistribute(serialDM, 0, migrationSF, distributedDM, errorCode)
CALL DMPlexGetGlobalToNaturalSF(serialDM, naturalSF, errorCode)
CALL PetscSFView(naturalSF, PETSC_VIEWER_STDOUT_WORLD, errorCode)

The naturalSF is null.

Thanks,
Josh



Matthew Knepley  於 2023年6月18日 週日 上午7:42寫道:

> On Sun, Jun 18, 2023 at 2:12 AM YuSh Lo  wrote:
>
>> I am getting a null PetscSF after calling DMPlexGetGlobalToNatural
>>
>
> Did you call DMDIstribute()? This is where the map is created because
> until then, the map is identity.
>
>   Thanks,
>
>  Matt
>
>
>> YuSh Lo  於 2023年6月18日 週日 上午12:18寫道:
>>
>>> Hi Matthew,
>>>
>>> After setting DMSetUseNatural to true and calling
>>> DMPlexGetGlobalToNatural,
>>> I call PestcSFView right away, it gives segmentation fault.
>>> I have also tried DMGetNaturalSF, it also gives segmentation fault when
>>> calling PetscSFView.
>>> I use PETSC_VIEWER_STDOUT_WORLD as PetscViewer
>>>
>>> Thanks,
>>> Josh
>>>
>>>
>>> Matthew Knepley  於 2023年6月9日 週五 下午1:04寫道:
>>>
 On Fri, Jun 9, 2023 at 1:46 PM YuSh Lo  wrote:

> Hi Barry,
>
> Is there any way to use the mapping generated by DMPlexDistribute
> along with AO?
>

 For Plex, if you turn on

   https://petsc.org/main/manualpages/DM/DMSetUseNatural/

 before DMPlexDistribute(), it will compute and store a GlobalToNatural
 map. This can be
 used to map vectors back and forth, but you can extract the SF

   DMPlexGetGlobalToNaturalSF
 

 and use that to remap your IS, by extracting the indices.

   THanks,

  Matt


> Thanks,
> Josh
>
>
> Barry Smith  於 2023年6月9日 週五 上午10:42寫道:
>
>>
>>   You might be looking for
>> https://petsc.org/release/manualpages/AO/AO/#ao
>>
>>
>> On Jun 9, 2023, at 11:02 AM, Mark Adams  wrote:
>>
>> An IS is just an array of integers. We need your context.
>> Is this question for sparse matrices? If so look at the documentation
>> on the AIJ matrix construction and the global vertex numbering system.
>>
>> Mark
>>
>> On Thu, Jun 8, 2023 at 1:15 PM YuSh Lo  wrote:
>>
>>> Hi,
>>>
>>> I have an IS that contains some vertex that is in natural numbering.
>>> How do I map them to global numbering without being distributed?
>>>
>>> Thanks,
>>> Josh
>>>
>>
>>

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

 https://www.cse.buffalo.edu/~knepley/
 

>>>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> 
>


[petsc-users] Advice on small block matrix vector multiplication

2023-06-18 Thread Duan Junming via petsc-users
Dear all,

I am using DMPlex to manage the unknowns, two fields, one for pressure, and one 
for velocities with two/three components, defined in each cell. They're 
represented by polynomials, with N (10~50) dofs for each component.
I have an operator which can be written in a matrix form (N-by-N, dense), to be 
applied on the pressure field or each component of the velocities in each cell 
(the same for each cell and also for each component).
I was wondering which matrix should be defined to implement the block 
matrix-vector multiplication, here block means the pressure or the component of 
the velocities. Maybe a sequential block mat? Could you recommend any example?
Or I just implement this matrix-vector multiplication by hand?

Thanks!
Junming


Re: [petsc-users] Question about using MatCreateAIJ

2023-06-18 Thread Barry Smith

  I am concerned this is not good advice being provided.

  Let's back up and look more closely at your use case.

  * What is the ratio of new nonzero locations added compared to the initial 
number of nonzeros for your code, for each of your iterations?

  * Is it possible for many iterations, no or very few new nonzeros are being 
added?

  * Are many previous nonzero values becoming zero (or unneeded) later? Again 
as a ratio compared to the initial number of nonzeros?

  * Can you quantify the difference in time between initially filling the 
matrix and then refilling it using the reset preallocation and not using the 
reset preallocation?

The effect you report that resetting the preallocation results in slower code 
is possible if relatively few additional nonzero locations are being created.


  After a matrix is assembled with a given nonzero structure (regardless of how 
it was filled it, using preallocation or not), setting nonzero values into new 
locations will be slow due to needing to do possibly many mallocs() (as much as 
one for each new nonzero introduced). Resetting the initially provided 
preallocation removes the need for all the new mallocs(), but at the expense of 
needing additional bookkeeping while setting the values. If you did not 
preallocate originally, then there is no way to prevent the additional 
mallocs() the second time through, so if you never preallocate but need to add 
many new nonzero locations adding the new nonzeros will be time consuming; 
hence in that situation providing the initial preallocation (taking into 
account all future nonzeros appearing) will pay off in possibly a big way.

I will look at the bug you report for when MatResetPreallocation()is called 
before the first matrix assembly and see if it can be fixed.

Barry



> On Jun 18, 2023, at 9:01 AM, Junchao Zhang  wrote:
> 
> yeah,  see a C example at 
> https://gitlab.com/petsc/petsc/-/blob/main/src/mat/tests/ex259.c
> 
> I guess you can code in this outline with petsc-3.19
> 
> MatCreate
> MatSetSizes
> MatSetFromOptions
> iteration-loop start
> 
> MatResetPreallocation(A,...)
> 
> Fill Matrix A with MatSetValues
> 
> MatAssemblyXX(A_WAVE,MAT_FINAL_ASSEMBLY,IERR)
> 
>  iteration-loop end
> 
> 
> --Junchao Zhang
> 
> 
> On Sun, Jun 18, 2023 at 7:37 AM Matthew Knepley  > wrote:
>> On Sun, Jun 18, 2023 at 4:26 AM Karsten Lettmann 
>> > > wrote:
>>> Dear Matthew,
>>> 
>>> 
>>> 
>>> thanks for you help.
>>> 
>>> 
>>> 
>>> 1) I tested your suggestion to pass NULL as the arguments for the 
>>> MatXAIJSetPreallocation.
>>> 
>>> So the old version was:
>>> 
>>> CALL 
>>> MatCreateMPIAIJ(MPI_GROUP,N_local,N_local,N_global,N_global,0,DNNZ,0,ONNZ,A,IERR)
>>> 
>>> And after you suggestion it is now:
>>> 
>>>   CALL MatCreate(MPI_GROUP,A,IERR)
>>>   CALL MatSetType(A,MATAIJ,IERR)
>>>   CALL MatSetSizes(A,N_local,N_local,N_global,N_global,IERR)
>>>   CALL 
>>> MatXAIJSetPreallocation(A,1,DNNZ,ONNZ,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,IERR)
>>> 
>>> 
>>> 
>>>   Setting block-size = 1.
>>> 
>>> 
>>> 
>>> 2) Concerning the error with MatResetPreallocation:
>>> 
>>> We have an iterative loop, in which the matrix A is filled very often with 
>>> different non-zero structure.
>>> Further, I read in the manual pages that due to performance issues, one 
>>> should preallocate enough space, as operations as matsetvalues might be 
>>> time consuming due to additional 
>>> on-demand allocations.
>>> 
>>> 
>>> 
>>> So I did the following coding in principle:
>>> 
>>> 
>>> 
>>> Set matrix A the first time with preallocation
>>> 
>>> 
>>> 
>>> iteration-loop start
>>> 
>>> MatResetPreallocation(A,...)
>>> 
>>> MatZeroEntries (A)
>>> 
>>> Fill Matrix A
>>> 
>>> MatAssemblyXX(A_WAVE,MAT_FINAL_ASSEMBLY,IERR)
>>> 
>>> 
>>> 
>>> iteration-loop end
>>> 
>>> 
>>> 
>>> With these settings, the code run with 2 CPU.
>>> But with 1 CPU I got an error, which was in MatResetPreallocation.
>>> I could not understand, why the above code works with 2 CPU but not with 1 
>>> CPU.
>>> 
>>> At the moment, I believe the reason for this error seems to be a pre-check, 
>>> that is done in SeqAIJ but not in MPIAIJ fo a valid and present matrix A.
>>> 
>>> (Now, an image is included showing the codings of   :
>>> https://petsc.org/release/src/mat/impls/aij/seq/aij.c.html#MatResetPreallocation_SeqAIJ
>>> https://petsc.org/release/src/mat/impls/aij/mpi/mpiaij.c.html#MatResetPreallocation_MPIAIJ
>>>)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> So, it seems for me at the moment, that the first MatResetPreallocation 
>>> (when the iteration loop is entered the first time) is done on an 
>>> not-assembled matrix A.
>>> So for one CPU I got an error, while 2 CPUs seem to have been more tolerant.
>>> (I'm not sure, if this interpretation is correct.)
>>> 
>>> 
>>> 
>>> So, I changed the coding in that way, 

Re: [petsc-users] IS natural numbering to global numbering

2023-06-18 Thread Matthew Knepley
On Sun, Jun 18, 2023 at 2:12 AM YuSh Lo  wrote:

> I am getting a null PetscSF after calling DMPlexGetGlobalToNatural
>

Did you call DMDIstribute()? This is where the map is created because until
then, the map is identity.

  Thanks,

 Matt


> YuSh Lo  於 2023年6月18日 週日 上午12:18寫道:
>
>> Hi Matthew,
>>
>> After setting DMSetUseNatural to true and calling
>> DMPlexGetGlobalToNatural,
>> I call PestcSFView right away, it gives segmentation fault.
>> I have also tried DMGetNaturalSF, it also gives segmentation fault when
>> calling PetscSFView.
>> I use PETSC_VIEWER_STDOUT_WORLD as PetscViewer
>>
>> Thanks,
>> Josh
>>
>>
>> Matthew Knepley  於 2023年6月9日 週五 下午1:04寫道:
>>
>>> On Fri, Jun 9, 2023 at 1:46 PM YuSh Lo  wrote:
>>>
 Hi Barry,

 Is there any way to use the mapping generated by DMPlexDistribute along
 with AO?

>>>
>>> For Plex, if you turn on
>>>
>>>   https://petsc.org/main/manualpages/DM/DMSetUseNatural/
>>>
>>> before DMPlexDistribute(), it will compute and store a GlobalToNatural
>>> map. This can be
>>> used to map vectors back and forth, but you can extract the SF
>>>
>>>   DMPlexGetGlobalToNaturalSF
>>> 
>>>
>>> and use that to remap your IS, by extracting the indices.
>>>
>>>   THanks,
>>>
>>>  Matt
>>>
>>>
 Thanks,
 Josh


 Barry Smith  於 2023年6月9日 週五 上午10:42寫道:

>
>   You might be looking for
> https://petsc.org/release/manualpages/AO/AO/#ao
>
>
> On Jun 9, 2023, at 11:02 AM, Mark Adams  wrote:
>
> An IS is just an array of integers. We need your context.
> Is this question for sparse matrices? If so look at the documentation
> on the AIJ matrix construction and the global vertex numbering system.
>
> Mark
>
> On Thu, Jun 8, 2023 at 1:15 PM YuSh Lo  wrote:
>
>> Hi,
>>
>> I have an IS that contains some vertex that is in natural numbering.
>> How do I map them to global numbering without being distributed?
>>
>> Thanks,
>> Josh
>>
>
>
>>>
>>> --
>>> 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
>>>
>>> https://www.cse.buffalo.edu/~knepley/
>>> 
>>>
>>

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

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] IS natural numbering to global numbering

2023-06-18 Thread YuSh Lo
I am getting a null PetscSF after calling DMPlexGetGlobalToNatural

YuSh Lo  於 2023年6月18日 週日 上午12:18寫道:

> Hi Matthew,
>
> After setting DMSetUseNatural to true and calling DMPlexGetGlobalToNatural,
> I call PestcSFView right away, it gives segmentation fault.
> I have also tried DMGetNaturalSF, it also gives segmentation fault when
> calling PetscSFView.
> I use PETSC_VIEWER_STDOUT_WORLD as PetscViewer
>
> Thanks,
> Josh
>
>
> Matthew Knepley  於 2023年6月9日 週五 下午1:04寫道:
>
>> On Fri, Jun 9, 2023 at 1:46 PM YuSh Lo  wrote:
>>
>>> Hi Barry,
>>>
>>> Is there any way to use the mapping generated by DMPlexDistribute along
>>> with AO?
>>>
>>
>> For Plex, if you turn on
>>
>>   https://petsc.org/main/manualpages/DM/DMSetUseNatural/
>>
>> before DMPlexDistribute(), it will compute and store a GlobalToNatural
>> map. This can be
>> used to map vectors back and forth, but you can extract the SF
>>
>>   DMPlexGetGlobalToNaturalSF
>> 
>>
>> and use that to remap your IS, by extracting the indices.
>>
>>   THanks,
>>
>>  Matt
>>
>>
>>> Thanks,
>>> Josh
>>>
>>>
>>> Barry Smith  於 2023年6月9日 週五 上午10:42寫道:
>>>

   You might be looking for
 https://petsc.org/release/manualpages/AO/AO/#ao


 On Jun 9, 2023, at 11:02 AM, Mark Adams  wrote:

 An IS is just an array of integers. We need your context.
 Is this question for sparse matrices? If so look at the documentation
 on the AIJ matrix construction and the global vertex numbering system.

 Mark

 On Thu, Jun 8, 2023 at 1:15 PM YuSh Lo  wrote:

> Hi,
>
> I have an IS that contains some vertex that is in natural numbering.
> How do I map them to global numbering without being distributed?
>
> Thanks,
> Josh
>


>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> 
>>
>