[petsc-users] Freeing Preconditioner Matrix Space

Gaetan Kenway kenway at utias.utoronto.ca
Sun Aug 21 15:24:25 CDT 2011


Hello

I am attempting to implement a "hack" that was posted on the list a while
back. I'm working with the adjoint linear system solver for a CFD solver.
I'm using the ASM (or Block Jacobi) preconditioner with ILU(p) on each of
the sub-domains. I use a different Preconditioner matrix (Pmat) than the
actual jacobian. What I want to do is destroy the Pmat memory after the ILU
factorization is performed. The hack that was posted is copied below:

* PCASMFreeSpace(PC pc)
**   {
**  PC_ASM         *osm = (PC_ASM*)pc->data;
**  PetscErrorCode ierr;
**
**     if (osm->pmat) {
**    if (osm->n_local_true > 0) {
**      ierr = MatDestroyMatrices(osm->n_local_true,&osm->pmat);CHKERRQ(ierr);
**    }
**  osm->pmat = 0;
**  }
**  if (pc->pmat) {ierr = MatDestroy(pc->pmat);CHKERRQ(ierr); pc->pmat = 0;}
**  return 0;
** }
*


However, I've had no luck actually getting the function compiled into petsc.
There are no erorrs reported with i type "make" in the asm directory, but
when I try to use the function in my application it can't find the symbol
while linking. Where does it go in the asm.c file? Does it use "static
PetscErrorCode" or "PetscErrorCode PETSCKSP_DLLEXPORT"? Does it have to be
added to the .h include files? What has to be done for it work with Fortran?


Any suggestions would be greatly appreciated.  This represents a significant
chunk of my application's memory (10%-30%) and as such its too much to
ignore.   Also is there any chance something like this would make it into an
actual PETSc release?

Gaetan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110821/5b272217/attachment.htm>


More information about the petsc-users mailing list