-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphData.py
More file actions
89 lines (73 loc) · 3.03 KB
/
graphData.py
File metadata and controls
89 lines (73 loc) · 3.03 KB
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
89
import time
import matplotlib.pyplot as plt
import math
def main():
with open('ProblemScaling.txt', 'r+') as f:
lines = f.readlines()
timeL = []
for i in range(0,len(lines),2):
times = lines[i + 1].split(' ')
times = [[int(time) + 1,times[time]] for time in range(len(times)) if '\n' not in times[time]]
timeL += [[lines[i].replace('\n',''), times]]
plt.title("Weak Scaling Test")
print(timeL)
# plt.axis([1,5,0, 25])
for test in timeL:
print(test)
#Graphing strong scaling
newResult = [float(test[1][0][1])/ float(timing[1]) for timing in test[1]]
# print(newResult)
# newResult = [(float(timing[1])) for timing in test[1]]
newResult = [0] + newResult
print(newResult)
print(test[0])
plt.plot(newResult, linewidth = 2.0, label = test[0])
# plt.legend(bbox_to_anchor=(1.05, 1), loc=3, borderaxespad=0.)
plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=4,
ncol=1, borderaxespad=0.)
plt.xlabel("Problem Scale")
plt.ylabel('Runtime (s)')
plt.show()
def main2():
with open('ProcessorTimesFinal.txt', 'r+') as f:
lines = f.readlines()
timeL = []
for i in range(0,len(lines),2):
times = lines[i + 1].split(' ')
times = [[int(time) + 1,times[time]] for time in range(len(times)) if '\n' not in times[time]]
timeL += [[lines[i].replace('\n',''), times]]
#print(timeL)
print(timeL)
plt.title("Strong Scaling Efficiency vs Number of Processes")
plt.axis([1,5, 0, 1.6])
for timeResult in timeL:
# print(timeResult)
# print(timeResult[1][0][0])
#Scaling Efficiency Graph
newResult = [[float(timeResult[1][0][1])/(float(timing[1]) *float(timing[0]))] for timing in timeResult[1]]
newResult = [[0]] + newResult
#For percentage graph
# newResult = [[float(timing[1])/float(timeResult[1][0][1] *)] for timing in timeResult[1]]
# newResult = newResult
# newResult = [[0]] + newResult
#Sqrt magnitude plot
# newResult = [[math.sqrt(float(timing[1]))] for timing in timeResult[1]]
# newResult = newResult
# newResult = [[0]] + newResult
if timeResult[0] == 'allhomes' or timeResult[0] == 'homes17' or timeResult[0] == 'homes18':
plt.plot(newResult, linewidth = 2.0, label = timeResult[0])
plt.legend(bbox_to_anchor=(1.02, 0., 1.5, .102), loc=3,
ncol=1, borderaxespad=0.)
plt.xlabel("Number of Processors")
plt.ylabel("Strong Scaling Efficiency")
#log graph
# newResult = [[math.log(float(timing[1]))] for timing in timeResult[1]]
# newResult = [[0]] + newResult
# plt.plot(newResult, linewidth = 2.0)
#print(newResult)
# For real time plots
#newResult = [[float(timing[1])] for timing in timeResult[1]]
#plt.plot(timingResult[1], linewidth = 2.0)
plt.show()
if __name__ == '__main__':
main2()