f.gallardo
f.gallardo

Reputation: 41

FLOPS in Python using a Haswell CPU (Intel Core Processor (Haswell, no TSX))

I need to measure the FLOPS for analyzing a Python program I did.

Based on what I found on the Internet it seems like there are two main options:

  1. Including counters in the program (which, I understand, it may make sense if the program is very simple and you are able to get access to a very atomized computations).
  2. Using libraries that access the CPU counters to derive the number of FLOPS. Like this one: http://www.bnikolic.co.uk/blog/python/flops/2019/09/27/python-counting-events.html

Sadly, the installation fails and, on top of that, the website clearly states that the Haswell CPUs are not supported because they don't have counters for floating point calculations. It turns out my server has this CPU. Hence I am stuck over there.

Nonetheless, I was thinking about including a system call to use perf (maybe os.system("perf --event event_for_flops "))

The problem is I have no clue about what is the proper event to monitor for the FLOPS information (assuming there is one, which, based on the "python-papi" library seems quite unlikely).

I listed all the possible events, but I am quite lost there. I tried to find some information on the Internet, but it was not helpful.

Any idea on what is the proper event to monitor (if any)? Or how to do this, without manually adding a counter at the very low level of the code, which for my case is directly unfeasible.

Please find here the full list of events:

List of events of Haswell CPU obtained with perf list command

Upvotes: 1

Views: 812

Answers (0)

Related Questions