<div dir="ltr"><div><div>Yes, being able to optionally turn off the full memory checking (either run time or via a configuration flag) in MatSetValues() would be good enough. Presumably when the full error checking wasn't being used, the error checking should revert to using the old style memory checking (e.g. <span dir="ltr" id=":125">ptr != 0</span>) as was used in version 3.2 (and maybe 3.3, I cannot recall).<br>
<br></div>Cheers,<br></div> Dave<br><div><div>
<br><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 11 September 2013 18:01, 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="im">Dave May <<a href="mailto:dave.mayhem23@gmail.com">dave.mayhem23@gmail.com</a>> writes:<br>
<br>
> Hey Jed,<br>
><br>
> The overhead is big.<br>
> Here are some numbers I generated which prompted Matt's email.<br>
><br>
> All the total run times reported are almost entirely associated with matrix<br>
> assembly.<br>
> All builds used --with-debugging=yes<br>
><br>
> Time (sec): 6.285e+00 [petsc v3.2]<br>
> Time (sec): 1.966e+02 [petsc v3.4]<br>
> Time (sec): 8.960e+00 [petsc v3.4 with a hacked checkptr.c which<br>
> skips the checking]<br>
><br>
> Calls to MatSetValue 5955066<br>
> Calls to MatSetValues 11910132<br>
<br>
</div>Would removing the check only in MatSetValues be good enough? Probably<br>
a better alternative to my earlier suggestion would be<br>
<br>
PetscCheckPointerPushFastRegion()<br>
all the normal checks, possibly nested<br>
PetscCheckPointerPopFastRegion()<br>
<br>
Those would be inline functions that just increment and decrement a<br>
global counter and PetscCheckPointer would only do the expensive check<br>
when the counter was equal to 0. And we can still have the run-time<br>
parameter that checks "always" or "never".<br>
</blockquote></div><br></div>