[petsc-users] Error when using PCDestroy

TAY wee-beng zonexo at gmail.com
Thu Sep 27 03:31:59 CDT 2012


On 26/9/2012 11:04 PM, Barry Smith wrote:
> On Sep 26, 2012, at 4:03 PM, TAY wee-beng <zonexo at gmail.com> wrote:
>
>> Hi,
>>
>> When I run a code in debug mode with -log_summary, there is no problem. However, in optimized mode, I encounter error "Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range"
>>
>> It happens at :
>>
>> call PCDestroy(pc_semi_x,ierr)
>>
>> Is there any reason why it works well in debug mode but not in optimized mode?
>     Memory corruption. Run first debug then optimized version under valgrind.
I ran valgrind in debug mode and found:

/==4977== Invalid read of size 4//
//==4977==    at 0x5D4A8E7: PetscCheckPointer (petscimpl.h:219)//
//==4977==    by 0x5D4997A: PCDestroy (precon.c:112)//
//==4977==    by 0x5B96AB9: pcdestroy_ (preconf.c:162)//
//==4977==    by 0x4A02E8: global_data_mp_de_ini_var_ (global.F90:1362)//
//==4977==    by 0xD2D2E0: MAIN__ (ibm3d_high_Re.F90:1140)//
//==4977==    by 0x4335CB: main (in /home/wtay/Results/10/a.out)//
//==4977==  Address 0xba21430 is 1,872 bytes inside a block of size 
2,452 free'd//
//==4977==    at 0x4C263CF: free (vg_replace_malloc.c:427)//
//==4977==    by 0x4FC2B84: PetscFreeAlign (mal.c:75)//
//==4977==    by 0x4FC5BB1: PetscTrFreeDefault (mtr.c:322)//
//==4977==    by 0x5D4A059: PCDestroy (precon.c:121)//
//==4977==    by 0x5E30990: KSPDestroy (itfunc.c:786)//
//==4977==    by 0x5B98FCB: kspdestroy_ (itfuncf.c:236)//
//==4977==    by 0x4A020D: global_data_mp_de_ini_var_ (global.F90:1360)//
//==4977==    by 0xD2D2E0: MAIN__ (ibm3d_high_Re.F90:1140)//
//==4977==    by 0x4335CB: main (in /home/wtay/Results/10/a.out)//
//
//[0]PETSC ERROR: --------------------- Error Message 
------------------------------------//
//[0]PETSC ERROR: Invalid argument!//
//[0]PETSC ERROR: Wrong type of object: Parameter # 1!//
//[0]PETSC ERROR: 
------------------------------------------------------------------------//
//[0]PETSC ERROR: Petsc Development HG revision: 
3675b37c376d9b5704273c07c9eacb10845dbbe9  HG Date: Thu Jul 05 23:16:22 
2012 -0500//
//[0]PETSC ERROR: See docs/changes/index.html for recent updates.//
//[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.//
//[0]PETSC ERROR: See docs/index.html for manual pages.//
//[0]PETSC ERROR: 
------------------------------------------------------------------------//
//[0]PETSC ERROR: ./a.out on a petsc-3.3 named hpc12 by wtay Thu Sep 27 
10:04:56 2012//
//[0]PETSC ERROR: Libraries linked from 
/home/wtay/Lib/petsc-3.3-dev_shared_debug/lib//
//[0]PETSC ERROR: Configure run at Fri Jul  6 16:18:04 2012//
//[0]PETSC ERROR: Configure options --with-mpi-dir=/opt/openmpi-1.5.3/ 
--with-blas-lapack-dir=/opt/intelcpro-11.1.059/mkl/lib/em64t/ 
--with-debugging=1 --download-hypre=1 
--prefix=/home/wtay/Lib/petsc-3.3-dev_shared_debug --known-mpi-shared=1 
--with-shared-libraries//
//[0]PETSC ERROR: 
------------------------------------------------------------------------//
//[0]PETSC ERROR: PCDestroy() line 112 in 
/home/wtay/Codes/petsc-dev/src/ksp/pc/interface/precon.c//
//[0]PETSC ERROR: --------------------- Error Message 
------------------------------------/

Does it mean that the pc_semi_x has already been freed when I call 
KSPDestroy(ksp_semi_x,ierr) earlier on? It's strange that I do not get 
this error if I just run the code in debug mode without valgrind.
>
>> -- 
>> Yours sincerely,
>>
>> TAY wee-beng
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120927/12ad2ae7/attachment.html>


More information about the petsc-users mailing list