On Fri, Nov 5, 2010 at 4:22 PM, Li, Zhisong (lizs) <span dir="ltr"><<a href="mailto:lizs@mail.uc.edu">lizs@mail.uc.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;">
<div>
<div style="direction:ltr;font-family:Tahoma;color:rgb(0, 0, 0);font-size:13px">
<div> Hi, Petsc Team,<br>
<br>
I use DA object to create structured data array based on global vectors. Recently, I checked my code and found an array with index out of range. But the code can run without any warning or segmentation violation message. At first I thought this might be a cache
problem. But later I ran a simpler test code on another machine and it gave no error either. I did not use any periodic boundary setting.<br>
<br>
This never took place in the past from my experience, as Petsc could always detect any segmentation violation. So what's wrong with it this time? The following is the main part of my sequential test code:<br>
<br>
DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_BOX,m,n,q,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,PETSC_NULL,PETSC_NULL,PETSC_NULL,&da);
<br>
DACreateGlobalVector(da, &elev); <br>
VecSet(elev, 3.14159265); <br>
DAVecGetArray(da, elev, &ele);<br>
PetscPrintf(PETSC_COMM_WORLD, "ele[3][3][%D] is %4.3e\n", m+120, ele[3][3][m+120]);
<br>
DAVecRestoreArray(da, elev, &ele);<br>
VecDestroy(elev); <br>
DADestroy(daw);<br></div></div></div></blockquote><div><br></div><div>PETSc detects write errors that take place directly after an array by putting a sentinel value at the end. If it</div><div>is written over, CHKMEMQ will detect that. We have no way of checking for overwrites of random memory</div>
<div>locations. If you try to write in some other users space, the OS will use a SEGV signal, but you can freely</div><div>overwrite your own space.</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;">
<div><div style="direction:ltr;font-family:Tahoma;color:rgb(0, 0, 0);font-size:13px"><div>
Thank you very much.<br>
<br>
<br>
Zhisong Li<br>
</div>
</div>
</div>
</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>