Commit 40efbe7a13a0adafd9135e4256c71492b09a1aa7
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,7 +38,7 @@ def get_no_tuning_energy_performance(args, budget, bmark): | ||
| 38 | dir_path = args.input_dir | 38 | dir_path = args.input_dir |
| 39 | 39 | ||
| 40 | # finding points with 3% threshold of target budget/inefficiency | 40 | # finding points with 3% threshold of target budget/inefficiency |
| 41 | - thresh = 3 | 41 | + thresh = 3 |
| 42 | 42 | ||
| 43 | bmarkDirPath = os.path.join(os.path.join(dir_path, "aggr_data"), bmark) | 43 | bmarkDirPath = os.path.join(os.path.join(dir_path, "aggr_data"), bmark) |
| 44 | frontiers_file = os.path.join(bmarkDirPath, "frontiers.json") | 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,17 +70,16 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): | ||
| 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 =['gobmk'] | 73 | +# benchmarks = ['bzip2'] |
| 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) |
| 77 | 77 | ||
| 78 | # finding points with 3% threshold of target budget/inefficiency | 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 | for bmark in benchmarks: | 82 | for bmark in benchmarks: |
| 83 | - data = [] | ||
| 84 | for budget_index, budget in enumerate(budget_list): | 83 | for budget_index, budget in enumerate(budget_list): |
| 85 | print "Inefficiency Budget: "+str(budget)+" Benchmark: "+bmark | 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,12 +108,19 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): | ||
| 109 | if point["speedup"] > optimal_point["speedup"]: | 108 | if point["speedup"] > optimal_point["speedup"]: |
| 110 | optimal_point = point | 109 | optimal_point = point |
| 111 | 110 | ||
| 111 | +# if frontiers_data["data"].index(data) == 5: | ||
| 112 | +# print filtered_data | ||
| 113 | +# print optimal_point | ||
| 114 | + | ||
| 112 | local_rect_points=[] | 115 | local_rect_points=[] |
| 113 | for point in filtered_data: | 116 | for point in filtered_data: |
| 114 | if (optimal_point["speedup"] - point["speedup"]) < 0: | 117 | if (optimal_point["speedup"] - point["speedup"]) < 0: |
| 115 | print "something is wrong!" | 118 | print "something is wrong!" |
| 116 | 119 | ||
| 117 | if (optimal_point["speedup"] - point["speedup"]) * 100 / optimal_point["speedup"] <= cluster_thresh: | 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 | data_to_plot.append(point) | 124 | data_to_plot.append(point) |
| 119 | sample_points.append(frontiers_data["data"].index(data)) | 125 | sample_points.append(frontiers_data["data"].index(data)) |
| 120 | local_rect_points.append(point) | 126 | local_rect_points.append(point) |
| @@ -145,13 +151,16 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): | @@ -145,13 +151,16 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): | ||
| 145 | 151 | ||
| 146 | #Construct the current settings | 152 | #Construct the current settings |
| 147 | current_settings = Set() | 153 | current_settings = Set() |
| 154 | + #print "current sample: "+str(current_sample) | ||
| 148 | while index < len( samplepoints ) and samplepoints[index] == current_sample: | 155 | while index < len( samplepoints ) and samplepoints[index] == current_sample: |
| 156 | + #print "index: "+str(index) | ||
| 149 | current_settings.add((cpufpoints[index],memfpoints[index])) | 157 | current_settings.add((cpufpoints[index],memfpoints[index])) |
| 150 | index = index + 1 | 158 | index = index + 1 |
| 151 | 159 | ||
| 152 | #Compute the common points between current and what is available | 160 | #Compute the common points between current and what is available |
| 153 | common_points = current_settings.intersection(settings_available) | 161 | common_points = current_settings.intersection(settings_available) |
| 154 | 162 | ||
| 163 | + #print "sp = " + str(samplepoints[-1]) | ||
| 155 | if (len(common_points) == 0 or index == len( samplepoints )): | 164 | if (len(common_points) == 0 or index == len( samplepoints )): |
| 156 | # find the point with highest cpu and mem freq | 165 | # find the point with highest cpu and mem freq |
| 157 | if (current_sample !=0 ): | 166 | if (current_sample !=0 ): |
| @@ -164,20 +173,26 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): | @@ -164,20 +173,26 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): | ||
| 164 | if point[1] > optimal_point[1]: | 173 | if point[1] > optimal_point[1]: |
| 165 | optimal_point = point | 174 | optimal_point = point |
| 166 | done = 0 | 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 | energy += get_energy(frontiers_data,optimal_point[0], optimal_point[1], idx) | 179 | 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) | 180 | 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) | 181 | 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) | 182 | aggr_performance += get_performance(frontiers_data, aggr_opt_point["cpu_freq"], aggr_opt_point["mem_freq"], idx) |
| 172 | if aggr_energy < energy: | 183 | if aggr_energy < energy: |
| 173 | print "unexpected!" | 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 | idx += 1 | 194 | idx += 1 |
| 178 | 195 | ||
| 179 | - prev_tr_sample = samplepoints[index-2] | ||
| 180 | - | ||
| 181 | # When there are no common points, transition | 196 | # When there are no common points, transition |
| 182 | if (len(common_points) == 0): | 197 | if (len(common_points) == 0): |
| 183 | settings_available = current_settings #all current settings are now available | 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,14 +219,13 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): | ||
| 204 | aggr_energy = (aggr_energy + (num_transitions * energy_cost))/1e6 | 219 | aggr_energy = (aggr_energy + (num_transitions * energy_cost))/1e6 |
| 205 | aggr_performance = (aggr_performance +(num_transitions * perf_cost))/1e6 | 220 | aggr_performance = (aggr_performance +(num_transitions * perf_cost))/1e6 |
| 206 | print "no.tuning(cum): performance (ms): "+str(aggr_performance)+"energy(mJ): "+str(aggr_energy) | 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 | def main(argv): | 224 | def main(argv): |
| 210 | args = parse(argv) | 225 | args = parse(argv) |
| 211 | 226 | ||
| 212 | for thresh in [0.0]: | 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 | if __name__ == "__main__": | 230 | if __name__ == "__main__": |
| 217 | main(sys.argv) | 231 | main(sys.argv) |