[petsc-users] Setting Pmat for an ASM subksp

Luc Berger-Vergiat lb2653 at columbia.edu
Thu May 14 14:17:33 CDT 2015


Hi all,
I am using the ASM preconditioner and it works fine with regular options.
However I am having difficulties setting the Pmat operator for on of my 
ASM domain.
Here is what I coded:

          call PCASMSetLocalSubdomains(pcdd,2,isddi,isddi,ierr)
          call PetscOptionsGetInt(PETSC_NULL_CHARACTER,
      &        '-n_overlap',n_ol,chk,ierr)
          if (chk.eqv.PETSC_TRUE) then
             call PCASMSetOverlap(pcdd,n_ol,ierr)
          endif
          call PCSetUp(pcdd,ierr)
          call KSPSetUp(schurKSP,ierr)
          call PCASMGetSubKSP(pcdd,nddl,fbl,ddsubksp, ierr)

          do i = 1,nddl
             if(i.eq.1) then
                if( (nstep.eq.1).and.(niter.eq.0) ) then
                   call KSPGetOperators(ddsubksp(i),HKmat,
      &                 HPmat,ierr)
                else
                   call KSPGetOperators(ddsubksp(i),HKmat,
      &                 PETSC_NULL_OBJECT,ierr)
                endif
                call PetscObjectReference(HKmat, ierr)
                call PetscObjectReference(HPmat, ierr)
                call KSPSetOperators(ddsubksp(i),HKmat,HPmat,ierr)
                call PetscObjectDereference(HKmat, ierr)
                call PetscObjectDereference(HPmat, ierr)
             endif
             call KSPGetPC(ddsubksp(i),ddsubpc(i),ierr)
             call PCSetType(ddsubpc(i),PCLU,ierr)
             call KSPSetType(ddsubksp(i),KSPPREONLY,ierr)
          enddo

I am suspecting that the PetscObjectReference is not working well based 
on the following output from valgrind:

==24001== Invalid read of size 4
==24001==    at 0x8EDC69: PetscObjectReference (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x8F5778: petscobjectreference_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4331A2: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD9BAE3: PCApply_Shell (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD74AC3: PCApply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFD7E3: KSPSolve (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41BEC: kspsolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4288ED: usolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x460179: psolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==  Address 0x802ea30 is 64 bytes inside a block of size 1,072 free'd
==24001==    at 0x4C2BDEC: free (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24001==    by 0xA66C4C: PetscFreeAlign (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x95A5F6: MatDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x9672BC: MatDestroyMatrices (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDDD221: PCReset_ASM (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73A26: PCReset (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73BB7: PCDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFFF53: KSPDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41C1F: kspdestroy_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x432F00: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==
==24001== Invalid read of size 4
==24001==    at 0x8EDC69: PetscObjectReference (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD76924: PCSetOperators (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xE045DD: KSPSetOperators (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41B40: kspsetoperators_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4331C4: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD9BAE3: PCApply_Shell (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD74AC3: PCApply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFD7E3: KSPSolve (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41BEC: kspsolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==  Address 0x802ea30 is 64 bytes inside a block of size 1,072 free'd
==24001==    at 0x4C2BDEC: free (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24001==    by 0xA66C4C: PetscFreeAlign (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x95A5F6: MatDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x9672BC: MatDestroyMatrices (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDDD221: PCReset_ASM (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73A26: PCReset (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73BB7: PCDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFFF53: KSPDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41C1F: kspdestroy_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x432F00: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==
==24001== Invalid read of size 8
==24001==    at 0x96999F: MatGetNullSpace (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xE0468C: KSPSetOperators (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41B40: kspsetoperators_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4331C4: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD9BAE3: PCApply_Shell (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD74AC3: PCApply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFD7E3: KSPSolve (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41BEC: kspsolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4288ED: usolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==  Address 0x802ed98 is 936 bytes inside a block of size 1,072 
free'd
==24001==    at 0x4C2BDEC: free (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24001==    by 0xA66C4C: PetscFreeAlign (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x95A5F6: MatDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x9672BC: MatDestroyMatrices (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDDD221: PCReset_ASM (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73A26: PCReset (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73BB7: PCDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFFF53: KSPDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41C1F: kspdestroy_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x432F00: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==
==24001== Invalid read of size 8
==24001==    at 0x8EDC90: PetscObjectDereference (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x8F5798: petscobjectdereference_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4331EB: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD9BAE3: PCApply_Shell (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD74AC3: PCApply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFD7E3: KSPSolve (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41BEC: kspsolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4288ED: usolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x460179: psolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==  Address 0x802e9f8 is 8 bytes inside a block of size 1,072 free'd
==24001==    at 0x4C2BDEC: free (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24001==    by 0xA66C4C: PetscFreeAlign (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x95A5F6: MatDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x9672BC: MatDestroyMatrices (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDDD221: PCReset_ASM (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73A26: PCReset (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD73BB7: PCDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFFF53: KSPDestroy (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41C1F: kspdestroy_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x432F00: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==
==24001== Invalid read of size 8
==24001==    at 0x8EDC94: PetscObjectDereference (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x8F5798: petscobjectdereference_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4331EB: reuseschur_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4297F5: feapuserpcapply_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA3FB56: ourshellapply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD9BAE3: PCApply_Shell (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xD74AC3: PCApply (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xDFD7E3: KSPSolve (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0xA41BEC: kspsolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x4288ED: usolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==    by 0x460179: psolve_ (in 
/home/luc/research/feap_repo/ShearBands/parfeap/feap)
==24001==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
==24001==

Can you let me know how I should issue the PetscObejctReference 
subroutine call?
If PetscObejctReference is not fully working in FORTRAN (that's always a 
possibility), I assume that I cannot do the following:

       call MatGetSubMatrix(Kmat, isddi(1), isddi(1), 
MAT_INITIAL_MATRIX, DDPMat, ierr)
       call KSPSetOperators(ddsubksp(i),DDPMat,DDPMat,ierr)

because of the overlap that is set after I computed issddi(1), is there 
a way to get an updated isddi(1) that contain the overlap created by 
PCASMSetOverlap?

-- 
Best,
Luc

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150514/5219696c/attachment-0001.html>


More information about the petsc-users mailing list