File: flops.m

package info (click to toggle)
papi 5.7.0+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,856 kB
  • sloc: ansic: 93,265; fortran: 3,338; xml: 2,460; makefile: 815; sh: 290
file content (46 lines) | stat: -rw-r--r-- 2,679 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% FLOPS Floating point operation count.
%    FLOPS returns the cumulative number of floating point operations.
%
%                    FLOPS(0) - Initialize PAPI library, reset counters
%                               to zero and begin counting.
%              ops = FLOPS    - Return the number of floating point 
%                               operations since the first call or last reset.
%    [ops, mflops] = FLOPS    - Return both the number of floating point 
%                               operations since the first call or last reset,
%                               and the incremental rate of floating point 
%                               execution since the last call.
%
%    DESCRIPTION
%    The PAPI flops function uses the PAPI Performance API to do the heavy
%    lifting. PAPI takes advantage of the fact that most modern microprocessors
%    have built-in hardware support for counting a variety of basic operations
%    or events. PAPI uses these counters to track things like instructions 
%    executed, cycles elapsed, floating point instructions performed and 
%    a variety of other events.
%    The first call to flops will initialize PAPI, set up the counters to 
%    monitor floating point instructions and total cpu cycles, and start 
%    the counters. Subsequent calls will return one or two values. The first 
%    value is the number of floating point operations since the first call or
%    last reset. The second optional value, the execution rate in mflops, can 
%    also be returned. The mflops rate is computed by dividing the operations 
%    since the last call by the cycles since the last call and multiplying by 
%    cycles per second:
%                   mflops = ((ops/cycles)*(cycles/second))/10^6
%    The cycles per second value is a derived number determined empirically
%    by counting cycles for a fixed amount of system time during the 
%    initialization of the PAPI library. Because of the way it is determined,
%    this value can be a small but consistent source of systematic error, 
%    and can introduce differences between rates measured by PAPI and those 
%    determined by other time measurements, for example, tic and toc. Also 
%    note that PAPI on Windows counts events on a system level rather than 
%    a process or thread level. This can lead to an over-reporting of cycles,
%    and typically an under-reporting of mflops.
%    The flops function continues counting after any call. A call with an 
%    input of 0 resets the counters and returns 0.

%   Copyright 2001 - 2004 The Innovative Computing Laboratory,
%                               University of Tennessee.
%   $Revision$  $Date$