[petsc-users] a crash due to memory issue
Dave May
dave.mayhem23 at gmail.com
Sat Apr 30 10:12:41 CDT 2016
On 30 April 2016 at 16:04, Ilyas YILMAZ <ilyascfd at gmail.com> wrote:
> 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,
>
I'd strongly suggest updating to version 3.7 before proceeding any further.
> 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/f9d629b1/attachment-0001.html>
More information about the petsc-users
mailing list