[petsc-users] Values of PETSC_DECIDE

Barry Smith bsmith at mcs.anl.gov
Sat Dec 3 12:46:01 CST 2016


> On Dec 3, 2016, at 12:36 PM, Massoud Rezavand <msdrezavand at gmail.com> wrote:
> 
> Thanks Matt,
> 
> the local "m" and "n" are calculated based on the number of processors, right?
> 
> how about for the case where m and n are not equal for all processors (like the example presented in MatMPIAIJSetPreallocation)? how can I find the local m and n for each processor?
> 
> I need the m and n for each processor to calculate the entries for d_nnz and o_nnz and then preallocate the matrix.

  You can't do this. By the time the local sizes are determined it is to late to set d_nnz and o_nnz

  You should call PetscSplitOwnership() once for rows and once for columns to get the local sizes from your global sizes and then use MatMPIAIJSetPreallocation()  in the normal way.

   Barry

> 
> Best
> Massoud
> 
> 
> 
> On Sat, Dec 3, 2016 at 6:37 PM, Matthew Knepley <knepley at gmail.com> wrote:
> On Sat, Dec 3, 2016 at 11:33 AM, Massoud Rezavand <msdrezavand at gmail.com> wrote:
> Dear PETSc team,
> 
> Supposing to have a dynamic Mat and Vec, if I let PETSc to decide the number of local rows and local columns, i.e 
> 
> MatSetSizes(A, PETSC_DECIDE, PETSC_DECISDE, M, N)
> 
> How can I get these numbers from PETSc?
> 
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecGetLocalSize.html
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSize.html#MatGetLocalSize
> 
>    Matt
>  
> Thanks,
> 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
> 



More information about the petsc-users mailing list