MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / plotFromDataFile

Function plotFromDataFile

src/scripts/perf/plotPerformance.py:69–260  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67
68######## plotFromDataFile() Function to plot from data file begins ########
69def plotFromDataFile():
70 data = []
71 """
72 read in table(s) from file(s)
73 """
74 for thisFile in args.datafile:
75 if not os.path.isfile(thisFile):
76 print 'No file with the name \'{}\' exists. Please indicate another filename.'.format(thisFile)
77 quit()
78
79 results = open(thisFile, 'r')
80 resultsContents = results.read()
81 resultsContents = resultsContents.rstrip().split('\n')
82
83 firstRow = resultsContents.pop(0)
84 if firstRow != tableHeader:
85 print 'ERROR: input file \'{}\' does not match expected format.'.format(thisFile)
86 quit()
87
88 for row in resultsContents:
89 row = row.split(',')
90 row = TableRow(TestCombination(row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[9]), row[10])
91 data.append(GraphPoint(row.parameters.x, row.parameters.y, row.parameters.z, row.parameters.batchsize, row.parameters.precision, row.parameters.device, row.parameters.label, row.gflops))
92
93 """
94 data sanity check
95 """
96 # if multiple plotvalues have > 1 value among the data rows, the user must specify which to plot
97 multiplePlotValues = []
98 for option in plotvalues:
99 values = []
100 for point in data:
101 values.append(getattr(point, option))
102 multiplePlotValues.append(len(set(values)) > 1)
103 if multiplePlotValues.count(True) > 1 and args.plot == None:
104 print 'ERROR: more than one parameter of {} has multiple values. Please specify which parameter to plot with --plot'.format(plotvalues)
105 quit()
106
107 # if args.graphxaxis is not 'problemsize', the user should know that the results might be strange
108 if args.graphxaxis != 'problemsize':
109 xaxisvalueSet = []
110 for option in xaxisvalues:
111 if option != 'problemsize':
112 values = []
113 for point in data:
114 values.append(getattr(point, option))
115 xaxisvalueSet.append(len(set(values)) > 1)
116 if xaxisvalueSet.count(True) > 1:
117 print 'WARNING: more than one parameter of {} is varied. unexpected results may occur. please double check your graphs for accuracy.'.format(xaxisvalues)
118
119 # multiple rows should not have the same input values
120 pointInputs = []
121 for point in data:
122 pointInputs.append(point.__str__().split(';')[0])
123 if len(set(pointInputs)) != len(data):
124 print 'ERROR: imported table has duplicate rows with identical input parameters'
125 quit()
126

Callers 1

plotPerformance.pyFile · 0.85

Calls 6

TableRowClass · 0.85
TestCombinationClass · 0.85
GraphPointClass · 0.85
DataForOnePlotClass · 0.85
indexMethod · 0.80
__str__Method · 0.45

Tested by

no test coverage detected