[petsc-users] DAGlobalToLocalBegin()

(Rebecca) Xuefei YUAN xy2102 at columbia.edu
Wed Mar 24 15:01:15 CDT 2010


Dear Jed and Matt,

Yes, X and F are global and localFIELD is serial. I ran with np=2.

The error I get is:


**************************************************
   0 SNES Function norm 1.095445115010e+01
[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)
[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)


from gdb, I get:


Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb7c396b0 (LWP 6301)]
0xb7f09410 in __kernel_vsyscall ()
(gdb) where
#0  0xb7f09410 in __kernel_vsyscall ()
#1  0xb7c89085 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7c8aa01 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0x087d591d in PetscAbortErrorHandler (line=1538,
     fun=0x88fe26d "VecScatterBegin", file=0x88fd9f7 "vscat.c",
     dir=0x88fd9ff "src/vec/vec/utils/", n=60, p=1,
     mess=0xbfd31124 "Vector wrong size 100 for scatter 60 (scatter  
forward and v
ector from != ctx from size)", ctx=0x0) at errabort.c:62
#4  0x0874a88e in PetscError (line=1538, func=0x88fe26d "VecScatterBegin",
     file=0x88fd9f7 "vscat.c", dir=0x88fd9ff "src/vec/vec/utils/", n=60, p=1,
     mess=0x88fe3a0 "Vector wrong size %D for scatter %D (scatter  
forward and vec
tor from != ctx from size)") at err.c:482
#5  0x086558cc in VecScatterBegin (inctx=0x8a393b0, x=0x8b39cc0, y=0x8b3b310,
     addv=INSERT_VALUES, mode=SCATTER_FORWARD) at vscat.c:1538
#6  0x0828b54c in DAGlobalToLocalBegin (da=0x8a2d360, g=0x8b39cc0,
     mode=INSERT_VALUES, l=0x8b3b310) at dagtol.c:50
#7  0x080f1b25 in FormFunction (snes=0x8a47840, X=0x8b39cc0, F=0x8adb2f0,
     dummg=0x8a2b810) at twgcqt2unffnictv.c:8382
#8  0x0860c63d in MatFDColoringApply_AIJ (J=0x8a6bbb0, coloring=0x8aa7b40,
     x1=0x8b12a60, flag=0xbfd32164, sctx=0x8a47840) at fdmatrix.c:680
#9  0x0860abaf in MatFDColoringApply (J=0x8a6bbb0, coloring=0x8aa7b40,
     x1=0x8b12a60, flag=0xbfd32164, sctx=0x8a47840) at fdmatrix.c:521
#10 0x08122e45 in SNESDefaultComputeJacobianColor (snes=0x8a47840,
---Type <return> to continue, or q <return> to quit---
     x1=0x8b12a60, J=0x8a47910, B=0x8a47914, flag=0xbfd32164, ctx=0x8aa7b40)
     at snesj2.c:49
#11 0x0811c7cf in DMMGComputeJacobianWithFD (snes=0x8a47840, x1=0x8a39c20,
     J=0x8a47910, B=0x8a47914, flag=0xbfd32164, ctx=0x8a2b810) at  
damgsnes.c:365
#12 0x0811a883 in DMMGComputeJacobian_Multigrid (snes=0x8a47840, X=0x8a39c20,
     J=0x8a47910, B=0x8a47914, flag=0xbfd32164, ptr=0x8a2b6b0) at damgsnes.c:60
#13 0x080fc610 in SNESComputeJacobian (snes=0x8a47840, X=0x8a39c20,
     A=0x8a47910, B=0x8a47914, flg=0xbfd32164) at snes.c:1188
#14 0x08124471 in SNESSolve_LS (snes=0x8a47840) at ls.c:189
#15 0x08103fac in SNESSolve (snes=0x8a47840, b=0x0, x=0x8a39c20) at  
snes.c:2242
#16 0x0811db31 in DMMGSolveSNES (dmmg=0x8a2b6b0, level=0) at damgsnes.c:510
#17 0x08117029 in DMMGSolve (dmmg=0x8a2b6b0) at damg.c:313
#18 0x08052ecc in Solve (dmmg=0x8a2b6b0) at twgcqt2unffnictv.c:679
#19 0x0804def5 in main (argc=Cannot access memory at address 0x189d
) at twgcqt2unffnictv.c:303


Same things happened to ex25.c from

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


with

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


Thanks a lot!

Rebecca




Quoting Jed Brown <jed at 59A2.org>:

> On Wed, 24 Mar 2010 15:41:38 -0400, "(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
>
> Is this run in parallel?  Note that the sizes of X and F are global,
> while localFIELD is serial.  What error did you get?
>
>
> Matt, it's clearly FormFunction and not FormFunctionLocal because the
> function prototype has the SNES.
>
> Jed
>
>



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