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

Fabian.Jakub Fabian.Jakub at physik.uni-muenchen.de
Tue Jul 8 07:39:56 CDT 2014


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