possible bug in DMCompositeGetMatrix().
(Rebecca) Xuefei YUAN
xy2102 at columbia.edu
Sun Jul 26 18:51:36 CDT 2009
Hi,
I am working on an optimization problem, in which I would like to
assemble a Jacobian matrix. Thus
DMMGSetSNES(dmmg,FormFunction,FormJacobian) is called.
In damgsnes.c:637, in calling DMGetMatrix(), it calls
DMCompositeGetMatrix() where the temp matrix Atmp has been freed
before it passes any information to J at pack.c:1722 and 1774.
So after calling DMGetMatrix() in DMMGSetSNES, the stencil of the
dmmg[i]->B has unchanged, i.e.,
(gdb) p dmmg[0]->B->stencil
$107 = {dim = 0, dims = {0, 0, 0, 0}, starts = {0, 0, 0, 0}, noc =
PETSC_FALSE}
(gdb) where
#0 DMMGSetSNES (dmmg=0x8856208, function=0x804c84f <FormFunction>,
jacobian=0x8052932 <FormJacobian>) at damgsnes.c:641
#1 0x0804c246 in main (argc=Cannot access memory at address 0x0
) at tworeggt.c:126
I compare this with
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex18.c.html
and it shows that the stencil has been carried out and passed to
dmmg[0]->B as follows:
(gdb) p dmmg[i]->B->stencil
$80 = {dim = 2, dims = {5, 5, 1, 0}, starts = {0, 0, 0, 0}, noc = PETSC_TRUE}
(gdb) where
#0 DMMGSetSNES (dmmg=0x884b530, function=0x804c364 <FormFunction>,
jacobian=0x804d34d <FormJacobian>) at damgsnes.c:642
#1 0x0804b969 in main (argc=Cannot access memory at address 0x2
) at ex18.c:100
Because of this missing stencil of Jacobian matrix, I get the error
code as follows:
Program received signal SIGSEGV, Segmentation fault.
0x082447c2 in ISLocalToGlobalMappingApply (mapping=0x0, N=1, in=0xbff8f250,
out=0xbff8ce14) at /home/rebecca/soft/petsc-3.0.0-p1/include/petscis.h:129
129 PetscInt i,*idx = mapping->indices,Nmax = mapping->n;
(gdb) where
#0 0x082447c2 in ISLocalToGlobalMappingApply (mapping=0x0, N=1,
in=0xbff8f250, out=0xbff8ce14)
at /home/rebecca/soft/petsc-3.0.0-p1/include/petscis.h:129
#1 0x0824440c in MatSetValuesLocal (mat=0x88825e8, nrow=1, irow=0xbff8f250,
ncol=4, icol=0xbff8ee50, y=0xbff8f628, addv=INSERT_VALUES) at
matrix.c:1583
#2 0x08240aae in MatSetValuesStencil (mat=0x88825e8, m=1, idxm=0xbff8f6b8,
n=4, idxn=0xbff8f4b4, v=0xbff8f628, addv=INSERT_VALUES) at matrix.c:1099
#3 0x08053835 in FormJacobian (snes=0x8874700, X=0x8856778, J=0x88747d0,
B=0x88747d4, flg=0xbff8f8d4, ptr=0x8856338) at tworeggt.c:937
#4 0x0805a5cf in DMMGComputeJacobian_Multigrid (snes=0x8874700, X=0x8856778,
J=0x88747d0, B=0x88747d4, flag=0xbff8f8d4, ptr=0x8856208) at damgsnes.c:60
#5 0x0806b18a in SNESComputeJacobian (snes=0x8874700, X=0x8856778,
A=0x88747d0, B=0x88747d4, flg=0xbff8f8d4) at snes.c:1111
#6 0x08084945 in SNESSolve_LS (snes=0x8874700) at ls.c:189
#7 0x08073198 in SNESSolve (snes=0x8874700, b=0x0, x=0x8856778) at
snes.c:2221
#8 0x0805d5f9 in DMMGSolveSNES (dmmg=0x8856208, level=0) at damgsnes.c:510
#9 0x08056e38 in DMMGSolve (dmmg=0x8856208) at damg.c:372
#10 0x0804c3fe in main (argc=128, argv=0xbff90c04) at tworeggt.c:131
I think there might be a bug in DMCompositeGetMatrix().
Thanks very much!
Cheers,
--
(Rebecca) Xuefei YUAN
Department of Applied Physics and Applied Mathematics
Columbia University
Tel:917-399-8032
www.columbia.edu/~xy2102
More information about the petsc-users
mailing list