If you do your own partitioning, you need to use VecLoadIntoVector() with a<div>Vec you get from the DA.</div><div><br></div><div> Matt<br><br><div class="gmail_quote">On Tue, Mar 9, 2010 at 5:16 PM, (Rebecca) Xuefei YUAN <span dir="ltr"><<a href="mailto:xy2102@columbia.edu">xy2102@columbia.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
I ran np=4 for a small (-da_grid_x 6, -da_grid_y 5) problem, with PETSC_STENCIL_BOX and width=2, dof = 4.<br>
<br>
When I use vecLoad() to load the binary file with the following set:<br>
<br>
PetscViewerBinaryOpen(PETSC_COMM_WORLD,fileName,FILE_MODE_READ,&viewer);<br>
VecLoad(viewer,PETSC_NULL,&FIELD);<br>
ierr = DAVecGetArray(da2_4,FIELD,&field);CHKERRQ(ierr);<br>
<br>
ierr = DAVecRestoreArray(da2_4,FIELD,&field);CHKERRQ(ierr);<br>
ierr = VecDestroy(FIELD);CHKERRQ(ierr);<br>
ierr = DADestroy(da2_4);CHKERRQ(ierr);<br>
ierr = PetscViewerDestroy(viewer);CHKERRQ(ierr);<br>
<br>
However, I got the error messages as below:<br>
<br>
[0]PETSC ERROR: DAVecGetArray() line 53 in src/dm/da/src/dagetarray.c Vector local size 32 is not compatible with DA local sizes 36 100<br>
<br>
[1]PETSC ERROR: DAVecGetArray() line 53 in src/dm/da/src/dagetarray.c Vector local size 32 is not compatible with DA local sizes 36 100<br>
<br>
[2]PETSC ERROR: DAVecGetArray() line 53 in src/dm/da/src/dagetarray.c Vector local size 28 is not compatible with DA local sizes 24 80<br>
<br>
[3]PETSC ERROR: DAVecGetArray() line 53 in src/dm/da/src/dagetarray.c Vector local size 28 is not compatible with DA local sizes 24 80<br>
<br>
Then I tracked down and tried to find how this 32,32,28,28 coming from.<br>
<br>
It turns out that my da2_4 has the parameters at each processor:<br>
<br>
<br>
xs xe ys ye x y Xs Xe Ys Ye Nl base nlocal Nlocal<br>
p0: 0 12 0 3 12 3 0 20 0 5 100 0 100 36<br>
p1: 12 24 0 3 12 3 4 24 0 5 100 36 100 36<br>
p2: 0 12 3 5 12 2 0 20 1 5 80 72 80 24<br>
p3: 12 24 3 5 12 2 4 24 1 5 80 96 80 24<br>
<br>
and deep in<br>
<br>
#0 PetscSplitOwnership (comm=-2080374782, n=0x8a061b4, N=0x8a061b8)<br>
at psplit.c:81<br>
#1 0x08628384 in PetscLayoutSetUp (map=0x8a061b0) at pmap.c:140<br>
#2 0x08618320 in VecCreate_MPI_Private (v=0x8a05c50, alloc=PETSC_TRUE,<br>
nghost=0, array=0x0) at pbvec.c:182<br>
#3 0x08618ba7 in VecCreate_MPI (vv=0x8a05c50) at pbvec.c:232<br>
#4 0x085f1554 in VecSetType (vec=0x8a05c50, method=0x885dd0b "mpi")<br>
at vecreg.c:54<br>
#5 0x085ec4f0 in VecSetTypeFromOptions_Private (vec=0x8a05c50)<br>
at vector.c:1335<br>
#6 0x085ec909 in VecSetFromOptions (vec=0x8a05c50) at vector.c:1370<br>
#7 0x085d7a7e in VecLoad_Binary (viewer=0x89f70b0, itype=0x885ce3d "mpi",<br>
newvec=0xbfe148e4) at vecio.c:228<br>
#8 0x085d70e4 in VecLoad (viewer=0x89f70b0, outtype=0x885ce3d "mpi",<br>
newvec=0xbfe148e4) at vecio.c:134<br>
#9 0x0804f140 in FormInitialGuess_physical (dmmg=0x89a2880, X=0x89b34f0)<br>
at vecviewload_out.c:390<br>
#10 0x08052ced in DMMGSolve (dmmg=0x89a2720) at damg.c:307<br>
#11 0x0804d479 in main (argc=-1, argv=0xbfe14cd4) at vecviewload_out.c:186<br>
<br>
it says that<br>
<br>
*n = *N/size + ((*N % size) > rank);<br>
<br>
where *N = 30; size = 4; rank = 0,1,2,3, in such a case, this gives me<br>
<br>
*n = 32,32,28,28 for pro0,1,2,3, separately.<br>
<br>
Where could be wrong with this mismatch of the local vector size and da local size(excluding ghost pts or including ghost pts)?<br>
<br>
Thanks so much!<br><font color="#888888">
<br>
Rebecca<br>
<br>
</font></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>
</div>