Commit bb98d65d83affe49dff1f231c999204d6ae5ca65

Authored by Rizwana Begum
1 parent 9bb9ab8f

update

Showing 1 changed file with 26 additions and 13 deletions
figures/notuning_wtuning.py
@@ -63,14 +63,14 @@ def get_no_tuning_energy_performance(args, budget, bmark): @@ -63,14 +63,14 @@ def get_no_tuning_energy_performance(args, budget, bmark):
63 energy = energy/1e6 63 energy = energy/1e6
64 performance = performance/1e6 64 performance = performance/1e6
65 65
66 - return (energy, performance) 66 + return (optimal_point, energy, performance)
67 67
68 def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): 68 def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
69 dir_path = args.input_dir 69 dir_path = args.input_dir
70 output_dir_path = args.output_dir 70 output_dir_path = args.output_dir
71 71
72 benchmarks, labels = get_benchmarks(args) 72 benchmarks, labels = get_benchmarks(args)
73 -# benchmarks =['bzip2'] 73 +# benchmarks =['gobmk']
74 #plot constants 74 #plot constants
75 cpuflist = get_cpu_freq_plot_list(args) 75 cpuflist = get_cpu_freq_plot_list(args)
76 memflist = get_mem_freq_plot_list(args) 76 memflist = get_mem_freq_plot_list(args)
@@ -84,7 +84,7 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): @@ -84,7 +84,7 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
84 for budget_index, budget in enumerate(budget_list): 84 for budget_index, budget in enumerate(budget_list):
85 print "Inefficiency Budget: "+str(budget)+" Benchmark: "+bmark 85 print "Inefficiency Budget: "+str(budget)+" Benchmark: "+bmark
86 86
87 - energy_notuning, performance_notuning = get_no_tuning_energy_performance(args, budget, bmark) 87 + aggr_opt_point, energy_notuning, performance_notuning = get_no_tuning_energy_performance(args, budget, bmark)
88 print "no.tuning: performance (ms): "+str(performance_notuning)+" energy(mJ): "+str(energy_notuning) 88 print "no.tuning: performance (ms): "+str(performance_notuning)+" energy(mJ): "+str(energy_notuning)
89 89
90 bmarkDirPath = os.path.join(os.path.join(dir_path, "per_sample_data"), bmark) 90 bmarkDirPath = os.path.join(os.path.join(dir_path, "per_sample_data"), bmark)
@@ -123,6 +123,9 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): @@ -123,6 +123,9 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
123 memfpoints = [memf for memf in [data_to_plot[sample]["mem_freq"] for sample in range(len(data_to_plot))]] 123 memfpoints = [memf for memf in [data_to_plot[sample]["mem_freq"] for sample in range(len(data_to_plot))]]
124 samplepoints = sample_points 124 samplepoints = sample_points
125 125
  126 + #print cpufpoints
  127 + #print memfpoints
  128 + #print samplepoints
126 #Total number of transitions 129 #Total number of transitions
127 num_transitions = 0.0 130 num_transitions = 0.0
128 #Available settings for (CPU, MEM) 131 #Available settings for (CPU, MEM)
@@ -134,6 +137,9 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): @@ -134,6 +137,9 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
134 prev_tr_sample = 0 137 prev_tr_sample = 0
135 energy = 0 138 energy = 0
136 performance = 0 139 performance = 0
  140 + aggr_energy = 0
  141 + aggr_performance = 0
  142 + idx = 0
137 while index < len( samplepoints ): 143 while index < len( samplepoints ):
138 current_sample = samplepoints[index] 144 current_sample = samplepoints[index]
139 145
@@ -158,16 +164,19 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): @@ -158,16 +164,19 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
158 if point[1] > optimal_point[1]: 164 if point[1] > optimal_point[1]:
159 optimal_point = point 165 optimal_point = point
160 done = 0 166 done = 0
161 - idx = prev_tr_sample+1  
162 - while done == 0:  
163 - energy += get_energy(frontiers_data, optimal_point[0], optimal_point[1], idx)  
164 - performance += get_performance(frontiers_data, optimal_point[0], optimal_point[1], idx)  
165 - if idx == samplepoints[index-1]: 167 + while done == 0 or idx == len(samplepoints) -1:
  168 + energy += get_energy(frontiers_data,optimal_point[0], optimal_point[1], idx)
  169 + performance += get_performance(frontiers_data,optimal_point[0], optimal_point[1], idx)
  170 + aggr_energy += get_energy(frontiers_data, aggr_opt_point["cpu_freq"], aggr_opt_point["mem_freq"], idx)
  171 + aggr_performance += get_performance(frontiers_data, aggr_opt_point["cpu_freq"], aggr_opt_point["mem_freq"], idx)
  172 + if aggr_energy < energy:
  173 + 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]:
166 done = 1 176 done = 1
167 - else:  
168 - idx += 1 177 + idx += 1
169 178
170 - prev_tr_sample = samplepoints[index-1] 179 + prev_tr_sample = samplepoints[index-2]
171 180
172 # When there are no common points, transition 181 # When there are no common points, transition
173 if (len(common_points) == 0): 182 if (len(common_points) == 0):
@@ -192,13 +201,17 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): @@ -192,13 +201,17 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost):
192 performance = (performance +(num_transitions * perf_cost))/1e6 201 performance = (performance +(num_transitions * perf_cost))/1e6
193 energy_data[budget_index].append(energy) 202 energy_data[budget_index].append(energy)
194 performance_data[budget_index].append(performance) 203 performance_data[budget_index].append(performance)
  204 + aggr_energy = (aggr_energy + (num_transitions * energy_cost))/1e6
  205 + aggr_performance = (aggr_performance +(num_transitions * perf_cost))/1e6
  206 + print "no.tuning(cum): performance (ms): "+str(aggr_performance)+"energy(mJ): "+str(aggr_energy)
195 print "w.tuning: performance (ms): "+str(performance)+" energy(mJ): "+str(energy) +"\n" 207 print "w.tuning: performance (ms): "+str(performance)+" energy(mJ): "+str(energy) +"\n"
196 208
197 def main(argv): 209 def main(argv):
198 args = parse(argv) 210 args = parse(argv)
199 211
200 for thresh in [0.0]: 212 for thresh in [0.0]:
201 - energy_time(args, [1.0,1.1, 1.2, 1.3,1.6,3.0], thresh, 0, 0)  
202 - 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)
  215 +
203 if __name__ == "__main__": 216 if __name__ == "__main__":
204 main(sys.argv) 217 main(sys.argv)