apmpi-analysis.py 2.02 KB
Newer Older
Kevin Harms's avatar
Kevin Harms committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
import argparse
import darshan

# base counter names
cnames = ['MPI_SEND',
          'MPI_RECV',
          'MPI_ALLREDUCE']

def main():
  
  parser = argparse.ArgumentParser()
  parser.add_argument('--quiet', dest='quiet', action='store_true', default=False, help='Surpress zero count calls')
  parser.add_argument('logname', metavar="logname", type=str, nargs=1, help='Logname to parse')
  args = parser.parse_args()

  report = darshan.DarshanReport(args.logname[0], read_all=False)
  report.info()

  if ('APMPI' not in report.modules):
    print ("This log does not contain AutoPerf MPI data")
    return

24
  hdr = darshan.backend.cffi_backend.log_get_apmpi_record(report.log)
Kevin Harms's avatar
Kevin Harms committed
25
26
27

  print("{:<8}{:<16}{:<10}{:<15}{:<18}{:<10}{:<10}{:<10}{:<10}{:<10}{:<10}\n{}".format(
     "Rank","Call", "Count", "Total Bytes", "Total Time", "0-256", "256-1K", "1K-8K", "8K-256K", "256K-1M", "1M+", "="*120))
28
29
30

  r = darshan.backend.cffi_backend.log_get_apmpi_record(report.log)
  while (r):
Kevin Harms's avatar
Kevin Harms committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    for c in cnames:
      # counter fields for each base type
      ncall  = c
      ncount = c + '_CALL_COUNT'
      nsize  = c + '_TOTAL_BYTES'
      ntime  = c + '_TOTAL_TIME'
      h0     = c + '_MSG_SIZE_AGG_0_256'
      h1     = c + '_MSG_SIZE_AGG_256_1K'
      h2     = c + '_MSG_SIZE_AGG_1K_8K'
      h3     = c + '_MSG_SIZE_AGG_8K_256K'
      h4     = c + '_MSG_SIZE_AGG_256K_1M'
      h5     = c + '_MSG_SIZE_AGG_1M_PLUS'

      if (r['counters'][ncount] > 0 or not args.quiet):
        print("{rank:<8}{call:<16}{count:<10}{size:<15}{time:<18.6f}{h0:<10}{h1:<10}{h2:<10}{h3:<10}{h4:<10}{h5:<10}".format(
        rank=r['rank'],
        call=ncall,
        count=r['counters'][ncount],
        size=r['counters'][nsize],
        time=r['fcounters'][ntime],
        h0=r['counters'][h0],
        h1=r['counters'][h1],
        h2=r['counters'][h2],
        h3=r['counters'][h3],
        h4=r['counters'][h4],
        h5=r['counters'][h5])) 
57
    r = darshan.backend.cffi_backend.log_get_apmpi_record(report.log)
Kevin Harms's avatar
Kevin Harms committed
58
59
60
61
62

  return

if __name__ == '__main__':
  main()