<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 21, 2015 at 10:54 AM, Justin Chang <span dir="ltr"><<a href="mailto:jychang48@gmail.com" target="_blank">jychang48@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>Matt,<br><br></div>Thank you for the clarification. Couple more questions:<br><br></div>1) Is there a difference between calling:<br><br></div>y = <some value>;<br><br></div>and<br></div>y = 0;<br></div>y+=<some value>;<br><br></div>that is, for the latter case it would require PetscLogFlop(1) and the former would not?<br></div></div></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">2) Looking through the source code of some of these PETSc functions, it seems the calculation of an index location for an array is not counted with PetscLogFlop(). For instance when I see:<br><br>for (d = 0; d < dim; d++) {<br> for (f = 0; f < dim; f++) {<br> J[d*dim+f] = 0.0;<br> for (g = 0; g < dim; g++) {<br> J[d*dim+f] += R[d*dim+g]*J0[g*dim+f];<br> }<br> }<br>}<br>PetscLogFlops(18.0);</div></blockquote><div><br></div><div>Flop is Floating Point Operation. The index calculation is an Integer Operation. I agree that we could probably start counting</div><div>those as well since in some sorts of applications its important, but right now we don't.</div><div><br></div><div> Thanks,</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"><div dir="ltr"><div>where R is a diagonal matrix and dim =3, the flops to document d*dim+f within J[...] is not accounted for within the 18 count (I think).<br><br></div><div>If I had done something like<br></div><div><br></div><div>pos = d*dim+f;<br></div><div>J[pos] = ...<br><br></div><div>wouldn't that be an extra 2 flops per loop iteration (excluding the zero off-diagonal parts)?<br><br></div><div>Thanks,<br></div><div>Justin<br></div><div><br><div><div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 21, 2015 at 5:33 AM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Tue, Apr 21, 2015 at 12:59 AM, Justin Chang <span dir="ltr"><<a href="mailto:jchang27@uh.edu" target="_blank">jchang27@uh.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi everyone,<br><br></div>I want to manually count the number of flops that take place within my user-defined functions. Say I have to calculate the following:<br><br></div>y = sqrt(pow(x[0],2)+pow(x[1],2)+pow(x[2],2));<br><br></div>What should the flop counter be for each call?<br></div></div></blockquote><div><br></div></span><div>1) I would use PetscSqr() instead of pow(*, 2) and PetscSqrtReal/Scalar()</div><div><br></div><div>2) Sqrt is obviously more expensive than a multiply, but there is no good standard, so we just count it as 1 flop</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div>Thanks,<span><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><br>-- <br><div><div dir="ltr"><div><div><div>Justin Chang<br></div>PhD Candidate, Civil Engineering - Computational Sciences<br></div>University of Houston, Department of Civil and Environmental Engineering<br></div>Houston, TX 77004<br><a href="tel:%28512%29%20963-3262" value="+15129633262" target="_blank">(512) 963-3262</a><br></div></div></font></span></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></span></div><span class="HOEnZb"><font color="#888888"><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>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>
</font></span></font></span></div></div>
</blockquote></div><br></div>
</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>