Commit bb98d65d83affe49dff1f231c999204d6ae5ca65
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 | 63 | energy = energy/1e6 |
| 64 | 64 | performance = performance/1e6 |
| 65 | 65 | |
| 66 | - return (energy, performance) | |
| 66 | + return (optimal_point, energy, performance) | |
| 67 | 67 | |
| 68 | 68 | def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): |
| 69 | 69 | dir_path = args.input_dir |
| 70 | 70 | output_dir_path = args.output_dir |
| 71 | 71 | |
| 72 | 72 | benchmarks, labels = get_benchmarks(args) |
| 73 | -# benchmarks =['bzip2'] | |
| 73 | +# benchmarks =['gobmk'] | |
| 74 | 74 | #plot constants |
| 75 | 75 | cpuflist = get_cpu_freq_plot_list(args) |
| 76 | 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 | 84 | for budget_index, budget in enumerate(budget_list): |
| 85 | 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 | 88 | print "no.tuning: performance (ms): "+str(performance_notuning)+" energy(mJ): "+str(energy_notuning) |
| 89 | 89 | |
| 90 | 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 | 123 | memfpoints = [memf for memf in [data_to_plot[sample]["mem_freq"] for sample in range(len(data_to_plot))]] |
| 124 | 124 | samplepoints = sample_points |
| 125 | 125 | |
| 126 | + #print cpufpoints | |
| 127 | + #print memfpoints | |
| 128 | + #print samplepoints | |
| 126 | 129 | #Total number of transitions |
| 127 | 130 | num_transitions = 0.0 |
| 128 | 131 | #Available settings for (CPU, MEM) |
| ... | ... | @@ -134,6 +137,9 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): |
| 134 | 137 | prev_tr_sample = 0 |
| 135 | 138 | energy = 0 |
| 136 | 139 | performance = 0 |
| 140 | + aggr_energy = 0 | |
| 141 | + aggr_performance = 0 | |
| 142 | + idx = 0 | |
| 137 | 143 | while index < len( samplepoints ): |
| 138 | 144 | current_sample = samplepoints[index] |
| 139 | 145 | |
| ... | ... | @@ -158,16 +164,19 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): |
| 158 | 164 | if point[1] > optimal_point[1]: |
| 159 | 165 | optimal_point = point |
| 160 | 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 | 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 | 181 | # When there are no common points, transition |
| 173 | 182 | if (len(common_points) == 0): |
| ... | ... | @@ -192,13 +201,17 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): |
| 192 | 201 | performance = (performance +(num_transitions * perf_cost))/1e6 |
| 193 | 202 | energy_data[budget_index].append(energy) |
| 194 | 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 | 207 | print "w.tuning: performance (ms): "+str(performance)+" energy(mJ): "+str(energy) +"\n" |
| 196 | 208 | |
| 197 | 209 | def main(argv): |
| 198 | 210 | args = parse(argv) |
| 199 | 211 | |
| 200 | 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 | 216 | if __name__ == "__main__": |
| 204 | 217 | main(sys.argv) | ... | ... |