[petsc-users] DAGlobalToLocalBegin()

(Rebecca) Xuefei YUAN xy2102 at columbia.edu
Wed Mar 24 14:57:30 CDT 2010


Dear Matt,

It is FormFunction(), not FormFunctionLocal().

I also checked ex25.c

http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex25.c.html

by commenting

   ierr = DMMGSetSNES(dmmg,FormFunction,0);CHKERRQ(ierr);
//  ierr =  
DMMGSetSNESLocal(dmmg,FormFunctionLocal,0,ad_FormFunctionLocal,0);CHKERRQ(ierr);

the same error happened to ex25 as


Breakpoint 1, FormFunction (snes=0x8a45890, T=0x8a923e0, F=0x8a7a1f0,
     ptr=0x8985760) at ex25.c:122
122       ierr =  
DAGlobalToLocalBegin((DA)dmmg->dm,T,INSERT_VALUES,localT);CHKER
RQ(ierr);
3: nF = 289
2: nT = 170
1: nlocalT = 170
(gdb) n

Program received signal SIGABRT, Aborted.
0xb7ee9410 in __kernel_vsyscall ()
(gdb) where
#0  0xb7ee9410 in __kernel_vsyscall ()
#1  0xb7c69085 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7c6aa01 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0x087306a1 in PetscAbortErrorHandler (line=1538,
     fun=0x88584bd "VecScatterBegin", file=0x8857c47 "vscat.c",
     dir=0x8857c4f "src/vec/vec/utils/", n=60, p=1,
     mess=0xbfbae664 "Vector wrong size 170 for scatter 153 (scatter  
forward and
vector from != ctx from size)", ctx=0x0) at errabort.c:62
#4  0x086a5612 in PetscError (line=1538, func=0x88584bd "VecScatterBegin",
     file=0x8857c47 "vscat.c", dir=0x8857c4f "src/vec/vec/utils/", n=60, p=1,
     mess=0x88585f0 "Vector wrong size %D for scatter %D (scatter  
forward and vec
tor from != ctx from size)") at err.c:482
#5  0x085b0650 in VecScatterBegin (inctx=0x89a0010, x=0x8a923e0, y=0x8a93c60,
     addv=INSERT_VALUES, mode=SCATTER_FORWARD) at vscat.c:1538
#6  0x081e62d0 in DAGlobalToLocalBegin (da=0x898ad80, g=0x8a923e0,
     mode=INSERT_VALUES, l=0x8a93c60) at dagtol.c:50
#7  0x0804c142 in FormFunction (snes=0x8a45890, T=0x8a923e0, F=0x8a7a1f0,
     ptr=0x8985760) at ex25.c:122
#8  0x085673c1 in MatFDColoringApply_AIJ (J=0x8a46b70, coloring=0x8a757c0,
     x1=0x8a8e560, flag=0xbfbaf354, sctx=0x8a45890) at fdmatrix.c:680
#9  0x08565933 in MatFDColoringApply (J=0x8a46b70, coloring=0x8a757c0,
     x1=0x8a8e560, flag=0xbfbaf354, sctx=0x8a45890) at fdmatrix.c:521
#10 0x0807dbc9 in SNESDefaultComputeJacobianColor (snes=0x8a45890,
---Type <return> to continue, or q <return> to quit---
     x1=0x8a8e560, J=0x8a45960, B=0x8a45964, flag=0xbfbaf354, ctx=0x8a757c0)
     at snesj2.c:49
#11 0x08077553 in DMMGComputeJacobianWithFD (snes=0x8a45890, x1=0x8988eb0,
     J=0x8a45960, B=0x8a45964, flag=0xbfbaf354, ctx=0x8985760) at  
damgsnes.c:365
#12 0x08075607 in DMMGComputeJacobian_Multigrid (snes=0x8a45890, X=0x8988eb0,
     J=0x8a45960, B=0x8a45964, flag=0xbfbaf354, ptr=0x8984f40) at damgsnes.c:60
#13 0x08057394 in SNESComputeJacobian (snes=0x8a45890, X=0x8988eb0,
     A=0x8a45960, B=0x8a45964, flg=0xbfbaf354) at snes.c:1188
#14 0x0807f1f5 in SNESSolve_LS (snes=0x8a45890) at ls.c:189
#15 0x0805ed30 in SNESSolve (snes=0x8a45890, b=0x0, x=0x8988eb0) at  
snes.c:2242
#16 0x080788b5 in DMMGSolveSNES (dmmg=0x8984f40, level=2) at damgsnes.c:510
#17 0x08071dad in DMMGSolve (dmmg=0x8984f40) at damg.c:313
#18 0x0804ba07 in main (argc=Cannot access memory at address 0x1792
) at ex25.c:84
(gdb)

So I am not sure how this is wrong.

Thanks a lot!

Rebecca

Quoting Matthew Knepley <knepley at gmail.com>:

> It really impossible to see what is happening in your code from this post.
> Is this
> FormFunction or FormFunctionLocal?
>
>   Matt
>
> On Wed, Mar 24, 2010 at 2:41 PM, (Rebecca) Xuefei YUAN
> <xy2102 at columbia.edu>wrote:
>
>> Hi,all,
>>
>> I have an error from
>>
>> ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD);
>> CHKERRQ(ierr);
>>
>> where
>>
>> ierr = DMMGSetSNES(dmmg, FormFunction,0);CHKERRQ(ierr); is used for set up
>> the SNES.
>>
>> So I check up the vector size of X, F, localFIELD where
>>        ierr = DAGetLocalVector(dafield,&localFIELD);CHKERRQ(ierr);
>>        PetscInt        nlocalFIELD,nX,nF;
>>        ierr = VecGetSize(localFIELD,&nlocalFIELD);CHKERRQ(ierr);
>>        ierr = VecGetSize(X,&nX);CHKERRQ(ierr);
>>        ierr = VecGetSize(F,&nF);CHKERRQ(ierr);
>>        ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD);
>> CHKERRQ(ierr);
>>        ierr =
>> DAGlobalToLocalEnd(dafield,X,INSERT_VALUES,localFIELD);CHKERRQ(ierr);
>>        ierr = DAVecGetArray(dafield,localFIELD,&localfield);CHKERRQ(ierr);
>>
>>
>> (gdb) disp nX
>> 1: nX = 120
>> (gdb) disp nF
>> 2: nF = 120
>> (gdb) disp nlocalFIELD
>> 3: nlocalFIELD = 100
>> (gdb) where
>> #0  FormFunction (snes=0x8a47840, X=0x8a39c20, F=0x8a37570,
>> dummg=0x8a2b810)
>>    at twgcqt2unffnictv.c:8382
>> #1  0x080fb28f in SNESComputeFunction (snes=0x8a47840, x=0x8a39c20,
>>    y=0x8a37570) at snes.c:1093
>> #2  0x08123d1b in SNESSolve_LS (snes=0x8a47840) at ls.c:159
>> #3  0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at
>> snes.c:2242
>> #4  0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at damgsnes.c:510
>> #5  0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313
>> #6  0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679
>> #7  0x0804def5 in main (argc=Cannot access memory at address 0x0
>> ) at twgcqt2unffnictv.c:303
>>
>> 3: nlocalFIELD = 100
>> 2: nF = 120
>> 1: nX = 100
>> (gdb) where
>> #0  FormFunction (snes=0x8a47840, X=0x8b39cc0, F=0x8adb2f0,
>> dummg=0x8a2b810)
>>    at twgcqt2unffnictv.c:8382
>> #1  0x0860c63d in MatFDColoringApply_AIJ (J=0x8a6bbb0, coloring=0x8aa7b40,
>>    x1=0x8b12a60, flag=0xbfbf4404, sctx=0x8a47840) at fdmatrix.c:680
>> #2  0x0860abaf in MatFDColoringApply (J=0x8a6bbb0, coloring=0x8aa7b40,
>>    x1=0x8b12a60, flag=0xbfbf4404, sctx=0x8a47840) at fdmatrix.c:521
>> #3  0x08122e45 in SNESDefaultComputeJacobianColor (snes=0x8a47840,
>>    x1=0x8b12a60, J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ctx=0x8aa7b40)
>>    at snesj2.c:49
>> #4  0x0811c7cf in DMMGComputeJacobianWithFD (snes=0x8a47840, x1=0x8a39c20,
>>    J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ctx=0x8a2b810) at
>> damgsnes.c:365
>> #5  0x0811a883 in DMMGComputeJacobian_Multigrid (snes=0x8a47840,
>> X=0x8a39c20,
>>    J=0x8a47910, B=0x8a47914, flag=0xbfbf4404, ptr=0x8a2b6b0) at
>> damgsnes.c:60
>> #6  0x080fc610 in SNESComputeJacobian (snes=0x8a47840, X=0x8a39c20,
>>    A=0x8a47910, B=0x8a47914, flg=0xbfbf4404) at snes.c:1188
>> #7  0x08124471 in SNESSolve_LS (snes=0x8a47840) at ls.c:189
>> #8  0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at
>> snes.c:2242
>> #9  0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at damgsnes.c:510
>> #10 0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313
>> #11 0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679
>> #12 0x0804def5 in main (argc=Cannot access memory at address 0x1
>> ) at twgcqt2unffnictv.c:303
>>
>> Why nX changes from 120 to 100? Is X a global vector or a local vector?
>>
>> Thanks very much!
>>
>>
>>
>> --
>> (Rebecca) Xuefei YUAN
>> Department of Applied Physics and Applied Mathematics
>> Columbia University
>> Tel:917-399-8032
>> www.columbia.edu/~xy2102
>>
>>
>
>
> --
> What most experimenters take for granted before they begin their experiments
> is infinitely more interesting than any results to which their experiments
> lead.
> -- Norbert Wiener
>



-- 
(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