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<br> IF (rank .eq. 0) THEN<br> 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.<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 class="im">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 class="im"><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>