[petsc-dev] Error during KSPDestroy

Alexander Grayver agrayver at gfz-potsdam.de
Sun May 6 06:28:55 CDT 2012


Hello,

I use KSP and random rhs to compute largest singular value:

   ! create solver and set options for singular value estimation
   call KSPCreate(MPI_COMM_WORLD,ksp,ierr);CHKERRQ(ierr)
   call KSPSetType(ksp,KSPGMRES,ierr);CHKERRQ(ierr)
   call 
KSPSetTolerances(ksp,solvertol,PETSC_DEFAULT_DOUBLE_PRECISION,PETSC_DEFAULT_DOUBLE_PRECISION,its,ierr);CHKERRQ(ierr)
   call KSPGMRESSetRestart(ksp, its, ierr);CHKERRQ(ierr)
   call KSPSetComputeSingularValues(ksp, flg, ierr);CHKERRQ(ierr)
   call KSPSetFromOptions(ksp,ierr);CHKERRQ(ierr)

   ! generate random RHS
   call PetscRandomCreate(PETSC_COMM_WORLD,rctx,ierr)
   call PetscRandomSetFromOptions(rctx,ierr)
   call VecSetRandom(b,rctx,ierr)

   !no preconditioning
   call KSPGetPC(ksp,pc,ierr);CHKERRQ(ierr)
   call PCSetType(pc,PCNONE,ierr);CHKERRQ(ierr)
   call KSPSetOperators(ksp,A,A,SAME_PRECONDITIONER,ierr);CHKERRQ(ierr)
   !solve system
   call KSPSolve(ksp,b,x,ierr);CHKERRQ(ierr)
   call KSPComputeExtremeSingularValues(ksp, smax, smin, ierr);CHKERRQ(ierr)

   call KSPDestroy(ksp,ierr);CHKERRQ(ierr)

However it crashes:

[1]PETSC ERROR: 
------------------------------------------------------------------------
[1]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, 
probably memory access out of range
[1]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[1]PETSC ERROR: or see 
http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[1]PETSC 
ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to 
find memory corruption errors
[1]PETSC ERROR: PetscMallocValidate: error detected at  
PetscDefaultSignalHandler() line 157 in 
/home/lib/petsc-dev1/src/sys/error/signal.c
[1]PETSC ERROR: Memory at address 0x4aa3f00 is corrupted
[1]PETSC ERROR: Probably write past beginning or end of array
[1]PETSC ERROR: Last intact block allocated in KSPSetUp_GMRES() line 73 
in /home/lib/petsc-dev1/src/ksp/ksp/impls/gmres/gmres.c
[1]PETSC ERROR: --------------------- Error Message 
------------------------------------
[1]PETSC ERROR: Memory corruption!
[1]PETSC ERROR:  !
[1]PETSC ERROR: 
------------------------------------------------------------------------
[1]PETSC ERROR: Petsc Development HG revision: 
f3c119f7ddbfee243b51907a90acab15127ccb39  HG Date: Sun Apr 29 21:37:29 
2012 -0500
[1]PETSC ERROR: See docs/changes/index.html for recent updates.
[1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[1]PETSC ERROR: See docs/index.html for manual pages.
[1]PETSC ERROR: 
------------------------------------------------------------------------
[1]PETSC ERROR: /home/prog on a openmpi-i named node207 by user Sun May  
6 12:58:24 2012
[1]PETSC ERROR: Libraries linked from 
/home/lib/petsc-dev1/openmpi-intel-complex-debug-f/lib
[1]PETSC ERROR: Configure run at Mon Apr 30 10:20:49 2012
[1]PETSC ERROR: Configure options 
--with-blacs-include=/opt/intel/Compiler/11.1/072/mkl/include 
--with-blacs-lib=/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_blacs_openmpi_lp64.a 
--with-blas-lapack-lib="[/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_lp64.a,/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_intel_thread.a,/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_core.a,/opt/intel/Compiler/11.1/072/lib/intel64/libiomp5.a]" 
--with-fortran-interfaces=1 --with-mpi-dir=/opt/mpi/intel/openmpi-1.4.2 
--with-petsc-arch=openmpi-intel-complex-debug-f --with-precision=double 
--with-scalapack-include=/opt/intel/Compiler/11.1/072/mkl/include 
--with-scalapack-lib=/opt/intel/Compiler/11.1/072/mkl/lib/em64t/libmkl_scalapack_lp64.a 
--with-scalar-type=complex --with-x=0 
PETSC_ARCH=openmpi-intel-complex-debug-f
[1]PETSC ERROR: 
------------------------------------------------------------------------
[1]PETSC ERROR: PetscMallocValidate() line 138 in 
/home/lib/petsc-dev1/src/sys/memory/mtr.c
[1]PETSC ERROR: PetscDefaultSignalHandler() line 157 in 
/home/lib/petsc-dev1/src/sys/error/signal.c


Call stack from debugger:

opal_memory_ptmalloc2_int_free, FP=7fffd4765300
opal_memory_ptmalloc2_free_hook, FP=7fffd4765330
PetscFreeAlign,      FP=7fffd4765370
PetscTrFreeDefault,  FP=7fffd4765520
KSPReset_GMRES,      FP=7fffd4765740
KSPReset,            FP=7fffd4765840
KSPDestroy,          FP=7fffd47659a0
kspdestroy_,         FP=7fffd47659d0


Any ideas?

Thanks.

-- 
Regards,
Alexander




More information about the petsc-dev mailing list