[petsc-users] local dimensions

Matthew Knepley knepley at gmail.com
Sun Dec 11 17:30:52 CST 2016


On Sun, Dec 11, 2016 at 5:19 PM, Massoud Rezavand <msdrezavand at gmail.com>
wrote:

> Dear PETSc team,
>
> What is the difference between the following two methods to get the local
> dimensions of a square matrix A? If they do the same, which one is
> recommended? Should I use MPI_Scan after both?
>
> 1)
>
> PetscInt local_size = PETSC_DECIDE;
>
> MatSetSizes(A, local_size, local_size, N, N);
>
>
> 2)
>
> PetscInt local_size = PETSC_DECIDE;
>
> PetscSplitOwnership(PETSC_COMM_WORLD, &local_size, &N);
>
> MPI_Scan(&local_size, &end_row, 1, MPIU_INT, MPI_SUM, PETSC_COMM_WORLD);
> begin_row = end_row - local_size;
>

They do the same thing. You only need to second if you want that
information before matrix setup happens, such as to preallocate.

   Matt


> Thanks in advance,
> Massoud
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20161211/7c6f8fd7/attachment.html>


More information about the petsc-users mailing list