forked from devinmcgloin/MPI_Linear_Equations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
summarize.py
43 lines (35 loc) · 1.04 KB
/
summarize.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
import os
timeFile = open("time.txt", "r")
trialCount = 0;
summaryData = {};
headerString = "";
def makeKey(header):
headerArr = header.split(" ")
returnStr = ""
for i in range(0, 4):
returnStr += headerArr[i]
return returnStr
def addToDict(time, header):
if (summaryData.get(makeKey(header))):
summaryData[makeKey(header)] = summaryData[makeKey(header)]+time/5
else:
summaryData[makeKey(header)] = time/5
def getTime(line):
timeString = line.split("m")[1]
timeString = timeString.replace("s", "")
return float(timeString)
def readSummary():
for line in timeFile:
if "ROWS" in line:
headerString = line
if "real" in line:
++trialCount
time = getTime(line)
addToDict(time, headerString)
def writeSummary():
summaryFile = open("summary.txt", "w")
for key, value in summaryData.items():
valueString = str(round(value, 5))
summaryFile.write(key + ": " + valueString + "\n")
readSummary()
writeSummary()