On Thu, Apr 22, 2010 at 9:22 AM, Jed Brown <span dir="ltr">&lt;<a href="mailto:jed@59a2.org">jed@59a2.org</a>&gt;</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;">
On Thu, 22 Apr 2010 15:15:12 +0100, &quot;Parker, Andrew (UK Filton)&quot; &lt;<a href="mailto:Andrew.Parker2@baesystems.com">Andrew.Parker2@baesystems.com</a>&gt; wrote:<br>
&gt; Well that&#39;s a worry, no error from:<br>
&gt; MatSetOption(_storage,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);<br>
&gt;<br>
&gt; Still slow as hell, same behaviour as before.  I&#39;m now using:<br>
&gt;<br>
&gt;   MatCreate(PETSC_COMM_SELF,&amp;_storage);<br>
&gt;   MatSetType(_storage, MATSEQBAIJ);<br>
&gt;   MatSetOption(_storage,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);<br>
&gt;<br>
&gt; MatSetSizes(_storage,PETSC_DECIDE,PETSC_DECIDE,numVars*numLocs,numVars*n<br>
&gt; umLocs);<br>
&gt;   MatSetFromOptions(_storage);<br>
&gt;   MatSeqBAIJSetPreallocation(_storage,numVars,PETSC_NULL,sparsityStart);<br></blockquote><div><br></div><div>Then there is something wrong in your code at large that we cannot</div><div>see from this small snippet. Can you change a PETSc example into</div>
<div>something that exhibits this behavior, like KSP ex2?</div><div><br></div><div>Also, you can go in with the debugger and see what is happening. I am guessing</div><div>you switch the matrix you are using (so options do not take effect), or recreate</div>
<div>it, etc.</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;">
This should work if you call both MatSetSizes and MatSetType before<br>
MatSetOption.  There are technical reasons for this, mostly that it&#39;s<br>
difficult to cache all the options and get them handled in a consistent<br>
and debuggable manner once the implementation is chosen.<br>
<br>
Unless someone disagrees, I&#39;ll make it an error to call MatSetOptions()<br>
before the implementation is available (so you would get a useful error<br>
with the usage above, instead of the option just being ignored).<br>
<font color="#888888"><br>
Jed<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>