[petsc-users] a crash due to memory issue
Balay, Satish
balay at mcs.anl.gov
Sat Apr 30 10:12:51 CDT 2016
Also suggest using latest version 3.7.
Satish
________________________________
From: Ilyas YILMAZ<mailto:ilyascfd at gmail.com>
Sent: 4/30/2016 10:04 AM
To: PETSc users list<mailto:petsc-users at mcs.anl.gov>
Subject: [petsc-users] a crash due to memory issue
Hello,
The code segment I wrote based on "src/dm/da/examples/tutorials/ex2.c" crashes when destroying things / freeing memory as given below.
I can't figure out what I'm missing? Any comments are welcome. (Petsc 3.1.p8, intel fortran compiler). The code and error are below.
!...Create scatter from global DA parallel vector to local vector that contains all entries
call DAGlobalToNaturalAllCreate(da,tolocalall,ierr)
call DAGlobalToNaturalAllCreate(da,tolocalall2,ierr)
call DAGlobalToNaturalAllCreate(da,tolocalall3,ierr)
call VecCreateSeq(PETSC_COMM_SELF,im*jm*km,CSRENOMlocalall,ierr)
call VecScatterBegin(tolocalall,CSRENOM,CSRENOMlocalall,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterEnd( tolocalall,CSRENOM,CSRENOMlocalall,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecCreateSeq(PETSC_COMM_SELF,im*jm*km,CSDENOMlocalall,ierr)
call VecScatterBegin(tolocalall2,CSDENOM,CSDENOMlocalall,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterEnd( tolocalall2,CSDENOM,CSDENOMlocalall,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecCreateSeq(PETSC_COMM_SELF,im*jm*km,CSlocalall,ierr)
call VecScatterBegin(tolocalall3,CS,CSlocalall,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterEnd( tolocalall3,CS,CSlocalall,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecGetArray(CSRENOMlocalall,scaCSRENOMlocalall,idCSRENOMlocalall,ierr)
call VecGetArray(CSDENOMlocalall,scaCSDENOMlocalall,idCSDENOMlocalall,ierr)
call VecGetArray( CSlocalall,scaCSlocalall ,idCSlocalall ,ierr)
SOME WORK HERE
call VecRestoreArray(CSlocalall ,scaCSlocalall ,idCSlocalall,ierr)
call VecRestoreArray(CSRENOMlocalall,scaCSRENOMlocalall,idCSRENOMlocalall,ierr)
call VecRestoreArray(CSDENOMlocalall,scaCSDENOMlocalall,idCSDENOMlocalall,ierr)
!...scatter back to global vector
call DANaturalAllToGlobalCreate(da,fromlocalall,ierr)
call DANaturalAllToGlobalCreate(da,fromlocalall2,ierr)
call DANaturalAllToGlobalCreate(da,fromlocalall3,ierr)
call VecScatterBegin(fromlocalall,CSRENOMlocalall,CSRENOM,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterEnd( fromlocalall,CSRENOMlocalall,CSRENOM,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterBegin(fromlocalall2,CSDENOMlocalall,CSDENOM,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterEnd( fromlocalall2,CSDENOMlocalall,CSDENOM,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterBegin(fromlocalall3,CSlocalall,CS,INSERT_VALUES,SCATTER_FORWARD,ierr)
call VecScatterEnd( fromlocalall3,CSlocalall,CS,INSERT_VALUES,SCATTER_FORWARD,ierr)
!..free memory
call VecScatterDestroy(fromlocalall,ierr)
call VecScatterDestroy(fromlocalall2,ierr)
call VecScatterDestroy(fromlocalall3,ierr)
call VecScatterDestroy(tolocalall,ierr)
call VecScatterDestroy(tolocalall2,ierr)
call VecScatterDestroy(tolocalall3,ierr)
call VecDestroy(CSDENOMlocalall,ierr)
call VecDestroy(CSRENOMlocalall,ierr)
call VecDestroy(CSlocalall,ierr)
.
.
.
.
.
.
...................... SGS model is called
MUT computed
MUT computed
MUT computed
MUT computed
[1]PETSC ERROR: ------------------------------------------------------------------------
[1]PETSC ERROR: [0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Signal[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run
[0]PETSC ERROR: to get more information on the crash.
.
.
.
.
.
Thank you
Ilyas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160430/1d804336/attachment.html>
More information about the petsc-users
mailing list