[petsc-users] DMDA3D with custom preallocation leads to MAT_NEW_NONZERO_ALLOCATION_ERR when using pc_gamg

Barry Smith bsmith at mcs.anl.gov
Tue Jul 8 10:14:27 CDT 2014


   GAMG should not give a preallocation error regardless of the preallocation of the original matrix; so presumably you’ve hit on an error in GAMG. What version of PETSc are you using and what is the ENTIRE error message from GAMG?  If you are using PETSc 3.4 please upgrade to 3.5 and see if GAMG still produces an error.

   Barry



On Jul 8, 2014, at 7:39 AM, Fabian.Jakub <Fabian.Jakub at physik.uni-muenchen.de> wrote:

> Hi,
> I have a question regarding gamg where I get a wrong preallocation i.e. a  MAT_NEW_NONZERO_ALLOCATION_ERR **.
> 
> I use a 3d DMDA with 10 dof but the coupling only ever needs 2 dof on a star stencil.
> 
> The code to setup the matrix is like this:
> 
> call DMSetMatrixPreallocateOnly(C%da, PETSC_TRUE,ierr)
> call DMCreateMatrix(C%da, A, ierr)
> call MatSetFromOptions(A,ierr)
> 
> call MatMPIAIJSetPreallocation(A, PETSC_NULL_INTEGER,d_nnz, PETSC_NULL_INTEGER, o_nnz, ierr)
> 
> insert matrix values & assemble
> 
> then solve.
> 
> If I solve the system with any ''normal'' KSP/PC there is no problem and matrix info actually confirms that the preallocation is good.
> However if I use gamg I get an allocation error when it tries to create a coarse grid.
> 
> If I use the DMDA preallocation, it works but uses way more memory...
> 
> Is there a possibility to use custom preallocation and at the same time let gamg create the coarse grid?
> Is that even the problem or am I missing something?
> 
> Thank you so very much.
> 
> Sincerely,
> Fabian
> 
> 
> 
> 
> 
> 
> 



More information about the petsc-users mailing list