Yes, but valgrind did not catch any errors.<br><br>I am having the same segfault issue when I use vectors which are "too big" and do the following:<br><br>!Initialize xtrue vector to random values (true solution of Ax=b):      <br>
      IF (rank .eq. 0) THEN<br>         allocate(xvec(N))         <br>         allocate(veci(N))             <br>         !Create list of indices (0-based for petsc)<br>         DO i=0,N-1<br>            veci(i+1) = i<br>
         END DO              <br>         call RANDOM_NUMBER(xvec)<br>         call VecSetValues(xtrue,N,veci,xvec,INSERT_VALUES,ierr)                  <br>         deallocate(veci)<br>      END IF   <br>      <br>      !Assemble the xtrue vector across all cores:<br>
      call VecAssemblyBegin(xtrue,ierr);<br>      call VecAssemblyEnd(xtrue,ierr);<br><br>This works on 1 processor but on multiple cores it segfaults if N is "too big" (around 3 million).   Is there an equivalent "flush" command for vectors to get around this?<br>
<br> - Ron <br><br><div class="gmail_quote">On Wed, Aug 1, 2012 at 11:36 AM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
We have to reproduce or at least get a debugger trace to speculate about what went wrong in your case. Have you tried running in valgrind?<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Wed, Aug 1, 2012 at 11:23 AM, Ronald M. Caplan <span dir="ltr"><<a href="mailto:caplanr@predsci.com" target="_blank">caplanr@predsci.com</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>Using FLUSH_ASSEMBLY periodically solved the segfault problem.  <br>I now use the following code to set the matrix:<br>

<br>DO i=1,N<div><br>        IF (rank .eq. 0) THEN<br></div>           DO j=CSR_AJ(i)+1,CSR_AJ(i+1)               <br>
              call MatSetValue(A,i-1,CSR_AI(j),CSR_A(j),INSERT_VALUES,ierr) <br>           END DO<br>        END IF<br>        !Need to send out matrix periodically otherwise get a segfault<br>        !(local buffer gets full? prob on mac only?)<br>


        IF (mod(i,100) .eq. 0) THEN<br>           call MatAssemblyBegin(A,MAT_FLUSH_ASSEMBLY,ierr)          <br>           call MatAssemblyEnd(A,MAT_FLUSH_ASSEMBLY,ierr)<br>        END IF<br>      END DO             <br>

      !Assemble final matrix A across all cores:<br>
      call MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY,ierr)          <br>      call MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY,ierr)<br><br>and everything works fine.  <br><br>I find the error strange since I am on a single quad-core MAC, the "buffer" should never get "full"...    Is this a bug?<br>


<br> - Ron C.<div><div><br><br><div class="gmail_quote">On Mon, Jul 30, 2012 at 3:09 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div>On Mon, Jul 30, 2012 at 3:04 PM, Ronald M. Caplan <span dir="ltr"><<a href="mailto:caplanr@predsci.com" target="_blank">caplanr@predsci.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>I seem to have solved the problem.<br><br>I was storing my entire matrix on node 0 and then calling MatAssembly (begin and end) on all nodes (which should have worked...).  <br><br>Apparently I was using too much space for the buffering or the like, because when I change the code so each node sets its own matrix values, than the MatAssemblyEnd does not seg fault. <br>



</div></blockquote><div><br></div></div><div>Can you send the test case. It shouldn't seg-fault unless the machine runs out of memory (and most desktop systems have overcommit, so the system will kill arbitrary processes, not necessarily the job that did the latest malloc.</div>



<div><br></div><div>In practice, you should call MatAssemblyBegin(...,MAT_FLUSH_ASSEMBLY) periodically.</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>
<br>Why should this be the case?   How many elements of a vector or matrix can a single node "set" before Assembly to distribute over all nodes?</div></blockquote></div></div><br><div><br></div>
</blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>