# Performance based on the Roofline model

To somewhat follow up on the question asked here, I have been told that the Roofline model is one way of assessing the performance of any scientific code. Basically I compute the Arithmetic Intensity (ratio of FLOPS over DRAM bytes) and multiply this by the STREAM bandwidth to obtain the ideal FLOPS/s. I could also use the AI to see how close I get to the maximum performance of my given machine.

That said, what is the easiest way to obtain this AI for finite element packages like FEniCS or Deal.II? To simply things for now, I am not too concerned with register/cache reuse or quantification of useful bandwidth sustained for some level of cache. If I wrote my own explicit finite element implementation using PETSc, I could simply count by hand the approximate number of FLOPS and approximate the number of load/stores from all vector operations and sparse matrix-vector multiply as outlined here. However, does anyone have any suggestions for doing this for any given implementation?

With the run times of each of these cases, you should be able to fit a polynomial or other complexity theory function to run time data thereby confirming that the method has the expected computational complexity and also estimating the various associated constants. I.e. if you expect $O(n^2)$, then you should get a good fit with a quadratic. You may need to ignore the small end of $n$ entirely. You should also be able to see which one is faster. Unless these curves cross multiple times (which they really shouldn't once you get into the asymptotic regime), the one that is fastest is the most efficient. Make sure you run large enough.