<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 22, 2016 at 9:25 AM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> writes:<br>
> Sweeping generalization not actually true. The wrappers do setup the<br>
> particular<br>
> keys we want inside PETSc,<br>
<br>
</span>All 3 invocations of KHASH_INIT amid 500 lines.</blockquote><div><br></div><div>You are wrong in this case. The HashIJ is not trivial, and cannot be done easily inline. What is the problem here?</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"><span class=""><br>
> and do bundle some multiple operation calls.<br>
<br>
</span>Some, yes, though some of that bundling produces demonstrably less<br>
efficient interfaces.<br>
<br>
commit da33aca0a8f0fe1631697dcf59d191f75b34b5c6<br>
Author: Matthew G. Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>><br>
Date: Fri Nov 8 15:40:59 2013 -0600<br>
<br>
Sys ex26: Jed is right that this is much faster<br>
<br>
Modified src/sys/examples/tests/ex26.c<br>
diff --git a/src/sys/examples/tests/ex26.c b/src/sys/examples/tests/ex26.c<br>
index e8cc50a..30ed523 100644<br>
--- a/src/sys/examples/tests/ex26.c<br>
+++ b/src/sys/examples/tests/ex26.c<br>
@@ -22,8 +22,13 @@ int main(int argc, char **argv)<br>
<br>
key.i = PetscMin(i, j);<br>
key.j = PetscMax(i, j);<br>
+#if 1<br>
+ khint_t ret, idx = kh_put(HASHIJ, table->ht, key, &ret);<br>
+ if (ret == 1) kh_val(table->ht, idx).n = newp++;<br>
+#else<br>
ierr = PetscHashIJGet(table, key, &p);CHKERRQ(ierr);<br>
if (p < 0) {ierr = PetscHashIJAdd(table, key, newp++);CHKERRQ(ierr);}<br>
+#endif<br>
}<br>
}<br>
ierr = PetscHashIJDestroy(&table);CHKERRQ(ierr);<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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</div>
</div></div>