[petsc-users] Question about MatCreateShell loca ros/colums

Sam Guo sam.guo at cd-adapco.com
Wed Apr 14 20:12:41 CDT 2021


Thanks, Matt.

On Wed, Apr 14, 2021 at 5:55 PM Matthew Knepley <knepley at gmail.com> wrote:

> On Wed, Apr 14, 2021 at 5:56 PM Sam Guo <sam.guo at cd-adapco.com> wrote:
>
>> Dear PETSc dev team,
>>    If I want PETSc to use my own parallel partition(instead of PETSc
>> "evenly" partition rows), I assume I can provide local rows/columns as
>> follows.
>>
>> MatCreateShell <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateShell.html#MatCreateShell>(MPI_Comm <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/MPI_Comm.html#MPI_Comm> comm,PetscInt <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt> m,PetscInt <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt> n,PetscInt <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt> M,PetscInt <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt> N,void *ctx,Mat <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/Mat.html#Mat> *A)
>>
>>   If that's the case, what role does local columns play? Memory
>> allocation? Should I use n (the global rows) or local rows or PETSC_DECIDE
>> in this case?
>>
>
> The only role played by n is to match this matrix with parallel vectors
> that you want it to act on. The local sizes should match. For square
> matrices, this usually
> means you match the local row size.
>
>   Thanks,
>
>      Matt
>
>
>> Thanks,
>> Sam
>>
>
>
> --
> 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/
> <http://www.cse.buffalo.edu/~knepley/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210414/774004a3/attachment-0001.html>


More information about the petsc-users mailing list