[petsc-users] PetscLogFlop for a sqrt()

Matthew Knepley knepley at gmail.com
Tue Apr 21 05:33:05 CDT 2015


On Tue, Apr 21, 2015 at 12:59 AM, Justin Chang <jchang27 at uh.edu> wrote:

> Hi everyone,
>
> I want to manually count the number of flops that take place within my
> user-defined functions. Say I have to calculate the following:
>
> y = sqrt(pow(x[0],2)+pow(x[1],2)+pow(x[2],2));
>
> What should the flop counter be for each call?
>

1) I would use PetscSqr() instead of pow(*, 2) and PetscSqrtReal/Scalar()

2) Sqrt is obviously more expensive than a multiply, but there is no good
standard, so we just count it as 1 flop

  Thanks,

     Matt


> Thanks,
>
>
> --
> Justin Chang
> PhD Candidate, Civil Engineering - Computational Sciences
> University of Houston, Department of Civil and Environmental Engineering
> Houston, TX 77004
> (512) 963-3262
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150421/2477adb6/attachment.html>


More information about the petsc-users mailing list