I'm sorry, I just remembered... this may be important to know...

call KSPCreate(imp_comm,ksp,ierr)

call KSPSetOperators(ksp,A,A,ierr)
call KSPSetDM(ksp,C%da,ierr)
call KSPSetDMActive(ksp,PETSC_FALSE,ierr)

call KSPSetFromOptions(ksp,ierr)
call KSPSetUp(ksp,ierr)

Thanks again...


Am 08.07.2014 14:39, schrieb Fabian.Jakub:
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








Reply via email to