[firedrake] Counting FLOPS for assembling residual and Jacobian

Lawrence Mitchell lawrence.mitchell at imperial.ac.uk
Wed Aug 5 12:12:57 BST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/08/15 22:57, Justin Chang wrote:
> Hi all,
> 
> Is it possible to include manual/PETSc counts within the assembly
> of the FormResidual and FormJacobian routines? Because I think it
> would be nice to look at the performance of how firedrake is
> assembling these finite element discretization instead of always
> relying on hardware counters.

Hi Justin,

this is a good idea.  The question is how to provide the information
to PETSc.  We know how many times we execute an element-wise Kernel
(because we know how big the mesh is).  So calculating the number of
flops comes down to estimating the number of flops for a kernel.

I have added some code to do this in the log-flops branches of COFFEE
and PyOP2.  It seems to report reasonably sensible numbers (I haven't
compared with hardware counters).  Hopefully these will merge soon.

I use the same flop-counting approach as petsc, i.e. "effective double
precision flops", where each multiplication, division, addition or
subtraction counts as a single flop.  The approach is not perfect,
because I do not do this manually, so I'm currently assuming that any
function call I see in the code contributes zero flops.  This means
that I'm underestimating a little, since the (affine) Jacobian
computations are not counted.  However, it gives you a reasonable
estimate, and is better than laboriously counting by hand.

If you really want to count the flops by hand, we can have a look at
an example kernel.

Cheers,

Lawrence

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJVwe+xAAoJECOc1kQ8PEYv5aMIALlx+GPD3C51n81OUE8l8xuN
pAsT0tsBuditE//UIqqavDkOP92zn8GyQG5IVW5DNeMHY0x6a9wECEqxl4Otc8L1
6WuFXtuVg1g8UgKmsFzEuNH2/6VBPo7flGixe1be2sS+qFvpDKFnwJiKoUDAMjDa
Re5tfGBfo/DXrK4rv0enRRLlD0quzQO1PJBt8BmkyZmEL4jdBMdOKTRCRmSO3kTV
teNg/l30/SUhw8VV5VedW4wQop6QtK2XV6F/m1cYXTeXVPNAXHSAxmbG0zyj+LTI
3eP/96ISPRq6ctDMAKBHNNauiigCgeiuK+DBptR05lMPHx/cESO3tQPJuWE8o5c=
=COjj
-----END PGP SIGNATURE-----



More information about the firedrake mailing list