source: doc/theses/colby_parsons_MMAth/benchmarks/channels/plotData.py @ 4eebbcc

ADTast-experimental
Last change on this file since 4eebbcc was 2f6a9391, checked in by caparsons <caparson@…>, 15 months ago

added first channel bench and copied over scripts that will need to be edited for channel usage. intermediate commit so that benchmarks can be pulled and run on another server

  • Property mode set to 100644
File size: 3.1 KB
Line 
1import os
2import sys
3import time
4import matplotlib.pyplot as plt
5import matplotlib.ticker as ticks
6import math
7from scipy import stats as st
8import numpy as np
9from enum import Enum
10from statistics import median
11
12import matplotlib
13matplotlib.use("pgf")
14matplotlib.rcParams.update({
15    "pgf.texsystem": "pdflatex",
16    'font.family': 'serif',
17    'text.usetex': True,
18    'pgf.rcfonts': False,
19})
20
21readfile = open(sys.argv[1], "r")
22
23machineName = ""
24
25if len(sys.argv) > 2:
26    machineName = sys.argv[2]
27
28# first line has num times per experiment
29line = readfile.readline()
30numTimes = int(line)
31
32# second line has processor args
33line = readfile.readline()
34procs = []
35for val in line.split():
36    procs.append(int(val))
37
38# 3rd line has num locks args
39line = readfile.readline()
40locks = []
41for val in line.split():
42    locks.append(int(val))
43
44# 4th line has number of variants
45line = readfile.readline()
46names = line.split()
47numVariants = len(names)
48
49lines = (line.rstrip() for line in readfile) # All lines including the blank ones
50lines = (line for line in lines if line) # Non-blank lines
51
52nameSet = False
53currLocks = -1 # default val
54count = 0
55procCount = 0
56currVariant = 0
57name = "Aggregate Lock"
58var_name = ""
59sendData = [0.0 for j in range(numVariants)]
60data = [[0.0 for i in range(len(procs))] for j in range(numVariants)]
61bars = [[[0.0 for i in range(len(procs))],[0.0 for k in range(len(procs))]] for j in range(numVariants)]
62tempData = [0.0 for i in range(numTimes)]
63for idx, line in enumerate(lines):
64    # print(line)
65   
66    if currLocks == -1:
67        lineArr = line.split()
68        currLocks = lineArr[-1]
69        continue
70
71    if line[0:5] == "cores":
72        continue
73
74    if not nameSet:
75        nameSet = True
76        continue
77   
78    lineArr = line.split()
79    tempData[count] = float(lineArr[-1])
80    count += 1
81    if count == numTimes:
82        currMedian = median( tempData )
83        data[currVariant][procCount] = currMedian
84        lower, upper = st.t.interval(0.95, numTimes - 1, loc=np.mean(tempData), scale=st.sem(tempData))
85        bars[currVariant][0][procCount] = currMedian - lower
86        bars[currVariant][1][procCount] = upper - currMedian
87        count = 0
88        procCount += 1
89
90        if procCount == len(procs):
91            procCount = 0
92            nameSet = False
93            currVariant += 1
94
95            if currVariant == numVariants:
96                fig, ax = plt.subplots()
97                plt.title(name + " Benchmark: " + str(currLocks) + " Locks")
98                plt.ylabel("Throughput (entries)")
99                plt.xlabel("Cores")
100                for idx, arr in enumerate(data):
101                    plt.errorbar( procs, arr, [bars[idx][0], bars[idx][1]], capsize=2, marker='o' )
102                plt.yscale("log")
103                plt.xticks(procs)
104                ax.legend(names)
105                # fig.savefig("plots/" + machineName + "Aggregate_Lock_" + str(currLocks) + ".png")
106                plt.savefig("plots/" + machineName + "Aggregate_Lock_" + str(currLocks) + ".pgf")
107                fig.clf()
108
109                # reset
110                currLocks = -1
111                currVariant = 0
Note: See TracBrowser for help on using the repository browser.