-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHPLResult.py
88 lines (74 loc) · 2.54 KB
/
HPLResult.py
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# maps command line names to displayable names for the graph
NameToDisplayName = {
"encodedTime": "Encoded time",
"n": "Problem size",
"nb": "Block size",
"p": "Number of matrix rows",
"q": "Number of matrix columns",
"time": "Time to solve",
"gflops": "GigaFLOPS",
None: "nothing"
}
class HPLResult:
"""
Stores data about an HPL result from a run.
"""
def __init__(self, encodedTime, n, nb, p, q, time, gflops, start, end):
self.encodedTime = encodedTime
self.n = n
self.nb = nb
self.p = p
self.q = q
self.time = time
self.gflops = gflops
self.startTime = start
self.endTime = end
def __str__(self):
output = (
"T/V N NB P Q Time Gflops\n"
"--------------------------------------------------------------------------------\n"
"{} {} {} {} {} {} {}\n"
"start time {}\n"
"end time {}\n"
).format(self.encodedTime, self.n, self.nb, self.p, self.q, self.time, self.gflops, self.startTime, self.endTime)
return output
def __repr__(self):
return "HPLResult({}, {}, {}, {}, {}, {}, {}, {})".format(
self.encodedTime, self.n, self.nb, self.p, self.q, self.time, self.gflops, self.startTime, self.endTime
)
"""
The following getters are meant to be used for organizing HPLResults into bins.
This is meant to provide a cleaner way to get attributes dynamically versus getattr(obj, "attribute")
There are no corresponding setters - set the values directly instead if you must.
"""
def getEncodedTime(self):
return self.encodedTime
def getN(self):
return self.n
def getNB(self): # rights
return self.nb
def getP(self):
return self.p
def getQ(self):
return self.q
def getTime(self):
return self.time
def getGflops(self):
return self.gflops
def getStartTime(self):
return self.startTime
def getEndTime(self):
return self.endTime
# maps names of properties of HPLResult to getters for HPLResult.
NameToGetter = {
"encodedtime": HPLResult.getEncodedTime,
"n": HPLResult.getN,
"nb": HPLResult.getNB,
"p": HPLResult.getP,
"q": HPLResult.getQ,
"time": HPLResult.getTime,
"gflops": HPLResult.getGflops,
None: lambda x: 0
}
GetterCommandLineNames = list(NameToGetter.keys())
GetterCommandLineNames.remove(None)