[petsc-dev] DMDA_*PERIODIC and DMDA_XYZGHOSTED

Ethan Coon ecoon at lanl.gov
Thu Mar 10 16:37:37 CST 2011


> >
> > Will get patches for these (and the doc fix).
> >
> 
> Could you also consider the patch below? I think the CHKMEMQ macros
> should not be there, we are not calling "untrusted" user code, right?

Oh crap, thanks, there's a bit more cruft that I thought I had removed.

> And the missing free is causing the following output in petsc4py
> testsuite:
> 
> $ python test/runtests.py -i da
> [0 at nikola] Python 2.6 (/usr/bin/python)
> [0 at nikola] PETSc 3.1.0-p7 development (conf: 'arch-linux2-c-opt')
> [0 at nikola] petsc4py 1.1.2 (build/lib.linux-x86_64-2.6/petsc4py)
> [0]Total space allocated 123685312 bytes
> [ 0]10137008 bytes DMSetUp_DA_3D() line 1272 in
> /usr/local/petsc/dev/src/dm/impls/da/da3.c
> [ 0]1302848 bytes DMSetUp_DA_3D() line 1272 in
> /usr/local/petsc/dev/src/dm/impls/da/da3.c
> 
> 
> diff -r 3923fa35e382 src/dm/impls/da/da2.c
> --- a/src/dm/impls/da/da2.c	Thu Mar 10 15:03:35 2011 -0600
> +++ b/src/dm/impls/da/da2.c	Thu Mar 10 19:03:28 2011 -0300
> @@ -1734,7 +1734,6 @@
>    /*  ierr = PetscLogObjectMemory(da,nn*dof*sizeof(PetscInt));CHKERRQ(ierr);*/
>    ierr = ISGetIndices(ltogis, &idx_full);
>    ierr = PetscMemcpy(idx_cpy,idx_full,nn*dof*sizeof(PetscInt));CHKERRQ(ierr);
> -  CHKMEMQ;
>    ierr = ISRestoreIndices(ltogis, &idx_full);
>    ierr = ISLocalToGlobalMappingCreateIS(ltogis,&da->ltogmap);CHKERRQ(ierr);
>    ierr = PetscLogObjectParent(da,da->ltogmap);CHKERRQ(ierr);
> diff -r 3923fa35e382 src/dm/impls/da/da3.c
> --- a/src/dm/impls/da/da3.c	Thu Mar 10 15:03:35 2011 -0600
> +++ b/src/dm/impls/da/da3.c	Thu Mar 10 19:03:28 2011 -0300
> @@ -1273,7 +1273,6 @@
>    /* ierr = PetscLogObjectMemory(da,nn*dof*sizeof(PetscInt));CHKERRQ(ierr); */
>    ierr = ISGetIndices(ltogis, &idx_full);
>    ierr = PetscMemcpy(idx_cpy,idx_full,nn*dof*sizeof(PetscInt));CHKERRQ(ierr);
> -  CHKMEMQ;
>    ierr = ISRestoreIndices(ltogis, &idx_full);
>    ierr = ISLocalToGlobalMappingCreateIS(ltogis,&da->ltogmap);CHKERRQ(ierr);
>    ierr = PetscLogObjectParent(da,da->ltogmap);CHKERRQ(ierr);
> diff -r 3923fa35e382 src/dm/impls/da/dadestroy.c
> --- a/src/dm/impls/da/dadestroy.c	Thu Mar 10 15:03:35 2011 -0600
> +++ b/src/dm/impls/da/dadestroy.c	Thu Mar 10 19:03:28 2011 -0300
> @@ -106,6 +106,7 @@
>      ierr = AODestroy(dd->ao);CHKERRQ(ierr);
>    }
> 
> +  ierr = PetscFree(dd->idx);CHKERRQ(ierr);
>    ierr = PetscFree(dd->lx);CHKERRQ(ierr);
>    ierr = PetscFree(dd->ly);CHKERRQ(ierr);
>    ierr = PetscFree(dd->lz);CHKERRQ(ierr);
> 
> 

Hmm, I didn't add the dd->idx, so I'm suprised it wasn't free'd already.
I also wasn't sure when/if to log the memory, since it seemed to be in
there for some stuff and not for others in the previous code.

With the copy (your next email) to the IS, shouldn't that changeset leak
memory?  I think it also needs a PetscFree(idx) then as well...

Will get these fixes in,

Ethan

-- 
------------------------------------
Ethan Coon
Post-Doctoral Researcher
Applied Mathematics - T-5
Los Alamos National Laboratory
505-665-8289

http://www.ldeo.columbia.edu/~ecoon/
------------------------------------




More information about the petsc-dev mailing list