--- /dev/null
+import numpy as np
+import matplotlib.pyplot as plt
+IMAGEDIR = "report/pics/"
+
+def generateHistograms(X, header):
+ global IMAGEDIR
+ for i, c in enumerate(X.T):
+ plt.hist(c)
+ plt.savefig(IMAGEDIR + header[i] + "-hist.pdf")
+ plt.clf()
+
+def generateScatterPlot(X, Y, header):
+ global IMAGEDIR
+ for i, feature in enumerate(X.T):
+ values = np.unique(feature)
+ values = np.sort(values)
+ geomean = []
+ for value in values:
+ a =Y[np.where(feature == value)]
+ a = np.array(map(lambda x : x**(1.0/len(a)), a))
+ geomean.append(a.prod())
+ plt.plot(feature, Y, 'r.')
+ for ii in range(0, len(geomean)-1):
+ print(values[ii:ii + 2])
+ print(geomean[ii:ii + 2])
+ plt.plot(values[ii:ii + 2], geomean[ii:ii + 2], 'bo-')
+ plt.savefig(IMAGEDIR + header[i] + "-scat.pdf")
+ plt.clf()
+
+def plot(data, header):
+ global IMAGEDIR
+ header=header[6:-1]
+ data = np.array(data)
+ X = data[:, 6:-4]
+ X[X==''] = '-1'
+ X = X.astype(np.float)
+ Y = data[:, -2]
+ Y = Y.astype(np.float)
+ generateHistograms(X, header)
+ generateScatterPlot(X, Y, header)
+
+
+
+
import argparse
import sys
import os
-
+import plot as pl
class AutoTunerArgParser:
def __init__(self):
def dump(file, row):
global TUNABLEHEADER
mystr=""
+ data = []
for i in range(len(TUNABLEHEADER)):
mystr += row[TUNABLEHEADER[i]]+ ","
- print "mystr is:"+ mystr
+ data.append(row[TUNABLEHEADER[i]])
+ print ("mystr is:"+ mystr)
print >>file, mystr
+ return data
def loadTunerInfo(row, filename):
with open(filename) as f:
argprocess = AutoTunerArgParser()
printHeader(file)
rows = []
+ data = []
for i in range(argprocess.getRunNumber()):
row = {"DECOMPOSEORDER" : "",
"MUSTREACHGLOBAL" : "",
loadTunerInfo(row, argprocess.getFolder()+"/tuner"+str(i)+"used")
loadSolverTime(row, argprocess.getFolder()+"/log"+str(i))
loadProblemName(row, argprocess.getFolder()+"/problem"+str(i))
- dump(file, row)
+ data.append(dump(file, row))
rows.append(row)
- return rows
+ return rows, data
def tunerNumberAnalysis(file, rows):
global TUNABLEHEADER
tunernumber[mystr] += "-" + str(row["TUNERNUMBER"])
problems = set(map(lambda x: x["PROBLEM"], rows))
- print "Number of repititive tuners"
+ print ("Number of repititive tuners")
for key in tunercount:
if tunercount[key] > 1:
- print key + "(ids:" + tunernumber[key] + ") = #" + str(tunercount[key])
-
+ print (key + "(ids:" + tunernumber[key] + ") = #" + str(tunercount[key]))
+def transformDataset(rows):
+ print(rows)
def main():
+ global TUNABLEHEADER
file = open("tuner.csv", "w")
- rows = analyzeLogs(file)
+ rows, data = analyzeLogs(file)
tunerNumberAnalysis(file, rows)
file.close()
+ #transformDataset(data)
+ pl.plot(data, TUNABLEHEADER)
return
if __name__ == "__main__":