Commit 40efbe7a13a0adafd9135e4256c71492b09a1aa7

Authored by Rizwana Begum
1 parent bb98d65d

fixed no/wtuning

Showing 1 changed file with 29 additions and 15 deletions
figures/notuning_wtuning.py
... ... @@ -38,7 +38,7 @@ def get_no_tuning_energy_performance(args, budget, bmark):
38 38 dir_path = args.input_dir
39 39  
40 40 # finding points with 3% threshold of target budget/inefficiency
41   - thresh = 3
  41 + thresh = 3
42 42  
43 43 bmarkDirPath = os.path.join(os.path.join(dir_path, "aggr_data"), bmark)
44 44 frontiers_file = os.path.join(bmarkDirPath, "frontiers.json")
... ... @@ -70,17 +70,16 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
70 70 output_dir_path = args.output_dir
71 71  
72 72 benchmarks, labels = get_benchmarks(args)
73   -# benchmarks =['gobmk']
  73 +# benchmarks = ['bzip2']
74 74 #plot constants
75 75 cpuflist = get_cpu_freq_plot_list(args)
76 76 memflist = get_mem_freq_plot_list(args)
77 77  
78 78 # finding points with 3% threshold of target budget/inefficiency
79   - thresh = 3
80   - energy_data = [ [] for thresh in budget_list]
81   - performance_data = [ [] for thresh in budget_list]
  79 + thresh = 3
  80 + energy_data = [ [] for bgt in budget_list]
  81 + performance_data = [ [] for bgt in budget_list]
82 82 for bmark in benchmarks:
83   - data = []
84 83 for budget_index, budget in enumerate(budget_list):
85 84 print "Inefficiency Budget: "+str(budget)+" Benchmark: "+bmark
86 85  
... ... @@ -109,12 +108,19 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
109 108 if point["speedup"] > optimal_point["speedup"]:
110 109 optimal_point = point
111 110  
  111 +# if frontiers_data["data"].index(data) == 5:
  112 +# print filtered_data
  113 +# print optimal_point
  114 +
112 115 local_rect_points=[]
113 116 for point in filtered_data:
114 117 if (optimal_point["speedup"] - point["speedup"]) < 0:
115 118 print "something is wrong!"
116 119  
117 120 if (optimal_point["speedup"] - point["speedup"]) * 100 / optimal_point["speedup"] <= cluster_thresh:
  121 + # if optimal_point != point:
  122 + # print optimal_point
  123 + # print point
118 124 data_to_plot.append(point)
119 125 sample_points.append(frontiers_data["data"].index(data))
120 126 local_rect_points.append(point)
... ... @@ -145,13 +151,16 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
145 151  
146 152 #Construct the current settings
147 153 current_settings = Set()
  154 + #print "current sample: "+str(current_sample)
148 155 while index < len( samplepoints ) and samplepoints[index] == current_sample:
  156 + #print "index: "+str(index)
149 157 current_settings.add((cpufpoints[index],memfpoints[index]))
150 158 index = index + 1
151 159  
152 160 #Compute the common points between current and what is available
153 161 common_points = current_settings.intersection(settings_available)
154 162  
  163 + #print "sp = " + str(samplepoints[-1])
155 164 if (len(common_points) == 0 or index == len( samplepoints )):
156 165 # find the point with highest cpu and mem freq
157 166 if (current_sample !=0 ):
... ... @@ -164,20 +173,26 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
164 173 if point[1] > optimal_point[1]:
165 174 optimal_point = point
166 175 done = 0
167   - while done == 0 or idx == len(samplepoints) -1:
  176 + #print samplepoints[-1]
  177 + while done == 0 or idx == samplepoints[-1]:
  178 + #print idx
168 179 energy += get_energy(frontiers_data,optimal_point[0], optimal_point[1], idx)
169 180 performance += get_performance(frontiers_data,optimal_point[0], optimal_point[1], idx)
170 181 aggr_energy += get_energy(frontiers_data, aggr_opt_point["cpu_freq"], aggr_opt_point["mem_freq"], idx)
171 182 aggr_performance += get_performance(frontiers_data, aggr_opt_point["cpu_freq"], aggr_opt_point["mem_freq"], idx)
172 183 if aggr_energy < energy:
173 184 print "unexpected!"
174   - # print "("+str(optimal_point[0])+", "+str(optimal_point[1])+", "+str(energy)+", "+str(performance)+") "+"("+str(aggr_opt_point["cpu_freq"])+", "+str(aggr_opt_point["mem_freq"])+", "+str(aggr_energy)+", "+str(aggr_performance)+") "
175   - if idx == samplepoints[index-2]:
176   - done = 1
  185 + # print "("+str(optimal_point[0])+", "+str(optimal_point[1])+", "+str(energy)+", "+str(performance)+") "+"("+str(aggr_opt_point["cpu_freq"])+", "+str(aggr_opt_point["mem_freq"])+", "+str(aggr_energy)+", "+str(aggr_performance)+") --- " + str((energy - aggr_energy) * 100 / aggr_energy) +" " +str((performance - aggr_performance) * 100 / aggr_performance)
  186 + if index < len(samplepoints):
  187 + if idx == samplepoints[index]-2:
  188 + done = 1
  189 + prev_tr_sample = samplepoints[index]-2
  190 + else:
  191 + if idx == samplepoints[-2]:
  192 + done = 1
  193 + prev_tr_sample = samplepoints[-2]
177 194 idx += 1
178 195  
179   - prev_tr_sample = samplepoints[index-2]
180   -
181 196 # When there are no common points, transition
182 197 if (len(common_points) == 0):
183 198 settings_available = current_settings #all current settings are now available
... ... @@ -204,14 +219,13 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
204 219 aggr_energy = (aggr_energy + (num_transitions * energy_cost))/1e6
205 220 aggr_performance = (aggr_performance +(num_transitions * perf_cost))/1e6
206 221 print "no.tuning(cum): performance (ms): "+str(aggr_performance)+"energy(mJ): "+str(aggr_energy)
207   - print "w.tuning: performance (ms): "+str(performance)+" energy(mJ): "+str(energy) +"\n"
  222 + print "w.tuning: performance (ms): "+str(performance)+" energy(mJ): "+str(energy) + " "+ str((energy - aggr_energy) * 100 / aggr_energy) +"% " +str((performance - aggr_performance) * 100 / aggr_performance)+"%\n"
208 223  
209 224 def main(argv):
210 225 args = parse(argv)
211 226  
212 227 for thresh in [0.0]:
213   - energy_time(args, [1.0], thresh, 0, 0)
214   -# energy_time(args, [1.0,1.1, 1.2, 1.3,1.6,3.0], thresh, 0, 0)
  228 + energy_time(args, [1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,3.0], thresh, 0, 0)
215 229  
216 230 if __name__ == "__main__":
217 231 main(sys.argv)
... ...