On Wed, Mar 24, 2010 at 3:01 PM, (Rebecca) Xuefei YUAN <span dir="ltr"><<a href="mailto:xy2102@columbia.edu">xy2102@columbia.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Dear Jed and Matt,<br></blockquote><div><br></div><div>This is a genuine bug. It is in DMMGComputeJacobianWithFD() and only occurs when</div><div>IS_COLORING_GHOSTED is true. So, using IS_COLORING_GLOBAL would probably</div>
<div>work here (can't look up the option right now).</div><div><br></div><div>Barry, what is supposed to happen here? Clearly a local vector is being passed where</div><div>a global vector is expected (at least part of the time).</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Yes, X and F are global and localFIELD is serial. I ran with np=2.<br>
<br>
The error I get is:<br>
<br>
<br>
**************************************************<br>
0 SNES Function norm 1.095445115010e+01<br>
[1]PETSC ERROR: VecScatterBegin() line 1538 in src/vec/vec/utils/vscat.c Vector wrong size 100 for scatter 60 (scatter forward and vector from != ctx from size)<br>
[0]PETSC ERROR: VecScatterBegin() line 1538 in src/vec/vec/utils/vscat.c Vector wrong size 100 for scatter 60 (scatter forward and vector from != ctx from size)<br>
<br>
<br>
from gdb, I get:<br>
<br>
<br>
Program received signal SIGABRT, Aborted.<br>
[Switching to Thread 0xb7c396b0 (LWP 6301)]<br>
0xb7f09410 in __kernel_vsyscall ()<br>
(gdb) where<br>
#0 0xb7f09410 in __kernel_vsyscall ()<br>
#1 0xb7c89085 in raise () from /lib/tls/i686/cmov/libc.so.6<br>
#2 0xb7c8aa01 in abort () from /lib/tls/i686/cmov/libc.so.6<br>
#3 0x087d591d in PetscAbortErrorHandler (line=1538,<br>
fun=0x88fe26d "VecScatterBegin", file=0x88fd9f7 "vscat.c",<br>
dir=0x88fd9ff "src/vec/vec/utils/", n=60, p=1,<br>
mess=0xbfd31124 "Vector wrong size 100 for scatter 60 (scatter forward and v<br>
ector from != ctx from size)", ctx=0x0) at errabort.c:62<br>
#4 0x0874a88e in PetscError (line=1538, func=0x88fe26d "VecScatterBegin",<br>
file=0x88fd9f7 "vscat.c", dir=0x88fd9ff "src/vec/vec/utils/", n=60, p=1,<br>
mess=0x88fe3a0 "Vector wrong size %D for scatter %D (scatter forward and vec<br>
tor from != ctx from size)") at err.c:482<br>
#5 0x086558cc in VecScatterBegin (inctx=0x8a393b0, x=0x8b39cc0, y=0x8b3b310,<br>
addv=INSERT_VALUES, mode=SCATTER_FORWARD) at vscat.c:1538<br>
#6 0x0828b54c in DAGlobalToLocalBegin (da=0x8a2d360, g=0x8b39cc0,<br>
mode=INSERT_VALUES, l=0x8b3b310) at dagtol.c:50<br>
#7 0x080f1b25 in FormFunction (snes=0x8a47840, X=0x8b39cc0, F=0x8adb2f0,<br>
dummg=0x8a2b810) at twgcqt2unffnictv.c:8382<br>
#8 0x0860c63d in MatFDColoringApply_AIJ (J=0x8a6bbb0, coloring=0x8aa7b40,<br>
x1=0x8b12a60, flag=0xbfd32164, sctx=0x8a47840) at fdmatrix.c:680<br>
#9 0x0860abaf in MatFDColoringApply (J=0x8a6bbb0, coloring=0x8aa7b40,<br>
x1=0x8b12a60, flag=0xbfd32164, sctx=0x8a47840) at fdmatrix.c:521<br>
#10 0x08122e45 in SNESDefaultComputeJacobianColor (snes=0x8a47840,<br>
---Type <return> to continue, or q <return> to quit---<br>
x1=0x8b12a60, J=0x8a47910, B=0x8a47914, flag=0xbfd32164, ctx=0x8aa7b40)<br>
at snesj2.c:49<br>
#11 0x0811c7cf in DMMGComputeJacobianWithFD (snes=0x8a47840, x1=0x8a39c20,<br>
J=0x8a47910, B=0x8a47914, flag=0xbfd32164, ctx=0x8a2b810) at damgsnes.c:365<br>
#12 0x0811a883 in DMMGComputeJacobian_Multigrid (snes=0x8a47840, X=0x8a39c20,<br>
J=0x8a47910, B=0x8a47914, flag=0xbfd32164, ptr=0x8a2b6b0) at damgsnes.c:60<br>
#13 0x080fc610 in SNESComputeJacobian (snes=0x8a47840, X=0x8a39c20,<br>
A=0x8a47910, B=0x8a47914, flg=0xbfd32164) at snes.c:1188<br>
#14 0x08124471 in SNESSolve_LS (snes=0x8a47840) at ls.c:189<br>
#15 0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at snes.c:2242<br>
#16 0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at damgsnes.c:510<br>
#17 0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313<br>
#18 0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679<br>
#19 0x0804def5 in main (argc=Cannot access memory at address 0x189d<br>
) at twgcqt2unffnictv.c:303<br>
<br>
<br>
Same things happened to ex25.c from<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex25.c.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex25.c.html</a><br>
<br>
<br>
with<br>
<br>
ierr = DMMGSetSNES(dmmg,FormFunction,0);CHKERRQ(ierr);<br>
// ierr = DMMGSetSNESLocal(dmmg,FormFunctionLocal,0,ad_FormFunctionLocal,0);CHKERRQ(ierr);<br>
<br>
<br>
Thanks a lot!<br>
<br>
Rebecca<br>
<br>
<br>
<br>
<br>
Quoting Jed Brown <jed@59A2.org>:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, 24 Mar 2010 15:41:38 -0400, "(Rebecca) Xuefei YUAN" <<a href="mailto:xy2102@columbia.edu" target="_blank">xy2102@columbia.edu</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,all,<br>
<br>
I have an error from<br>
<br>
ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD);<br>
CHKERRQ(ierr);<br>
<br>
where<br>
<br>
ierr = DMMGSetSNES(dmmg, FormFunction,0);CHKERRQ(ierr); is used for<br>
set up the SNES.<br>
<br>
So I check up the vector size of X, F, localFIELD where<br>
ierr = DAGetLocalVector(dafield,&localFIELD);CHKERRQ(ierr);<br>
PetscInt nlocalFIELD,nX,nF;<br>
ierr = VecGetSize(localFIELD,&nlocalFIELD);CHKERRQ(ierr);<br>
ierr = VecGetSize(X,&nX);CHKERRQ(ierr);<br>
ierr = VecGetSize(F,&nF);CHKERRQ(ierr);<br>
ierr = DAGlobalToLocalBegin(dafield,X,INSERT_VALUES,localFIELD);<br>
CHKERRQ(ierr);<br>
ierr = DAGlobalToLocalEnd(dafield,X,INSERT_VALUES,localFIELD);CHKERRQ(ierr);<br>
ierr = DAVecGetArray(dafield,localFIELD,&localfield);CHKERRQ(ierr);<br>
<br>
<br>
(gdb) disp nX<br>
1: nX = 120<br>
(gdb) disp nF<br>
2: nF = 120<br>
(gdb) disp nlocalFIELD<br>
3: nlocalFIELD = 100<br>
</blockquote>
<br>
Is this run in parallel? Note that the sizes of X and F are global,<br>
while localFIELD is serial. What error did you get?<br>
<br>
<br>
Matt, it's clearly FormFunction and not FormFunctionLocal because the<br>
function prototype has the SNES.<br>
<br>
Jed<br>
<br>
<br>
</blockquote>
<br>
<br>
<br>
-- <br>
(Rebecca) Xuefei YUAN<br>
Department of Applied Physics and Applied Mathematics<br>
Columbia University<br>
Tel:917-399-8032<br>
<a href="http://www.columbia.edu/~xy2102" target="_blank">www.columbia.edu/~xy2102</a><br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>