From bb98d65d83affe49dff1f231c999204d6ae5ca65 Mon Sep 17 00:00:00 2001 From: Rizwana Begum Date: Tue, 5 May 2015 10:45:14 -0400 Subject: [PATCH] update --- figures/notuning_wtuning.py | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/figures/notuning_wtuning.py b/figures/notuning_wtuning.py index ae1a94a..b106638 100644 --- a/figures/notuning_wtuning.py +++ b/figures/notuning_wtuning.py @@ -63,14 +63,14 @@ def get_no_tuning_energy_performance(args, budget, bmark): energy = energy/1e6 performance = performance/1e6 - return (energy, performance) + return (optimal_point, energy, performance) def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): dir_path = args.input_dir output_dir_path = args.output_dir benchmarks, labels = get_benchmarks(args) -# benchmarks =['bzip2'] +# benchmarks =['gobmk'] #plot constants cpuflist = get_cpu_freq_plot_list(args) memflist = get_mem_freq_plot_list(args) @@ -84,7 +84,7 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): for budget_index, budget in enumerate(budget_list): print "Inefficiency Budget: "+str(budget)+" Benchmark: "+bmark - energy_notuning, performance_notuning = get_no_tuning_energy_performance(args, budget, bmark) + aggr_opt_point, energy_notuning, performance_notuning = get_no_tuning_energy_performance(args, budget, bmark) print "no.tuning: performance (ms): "+str(performance_notuning)+" energy(mJ): "+str(energy_notuning) 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): memfpoints = [memf for memf in [data_to_plot[sample]["mem_freq"] for sample in range(len(data_to_plot))]] samplepoints = sample_points + #print cpufpoints + #print memfpoints + #print samplepoints #Total number of transitions num_transitions = 0.0 #Available settings for (CPU, MEM) @@ -134,6 +137,9 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): prev_tr_sample = 0 energy = 0 performance = 0 + aggr_energy = 0 + aggr_performance = 0 + idx = 0 while index < len( samplepoints ): current_sample = samplepoints[index] @@ -158,16 +164,19 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): if point[1] > optimal_point[1]: optimal_point = point done = 0 - idx = prev_tr_sample+1 - while done == 0: - energy += get_energy(frontiers_data, optimal_point[0], optimal_point[1], idx) - performance += get_performance(frontiers_data, optimal_point[0], optimal_point[1], idx) - if idx == samplepoints[index-1]: + while done == 0 or idx == len(samplepoints) -1: + energy += get_energy(frontiers_data,optimal_point[0], optimal_point[1], idx) + performance += get_performance(frontiers_data,optimal_point[0], optimal_point[1], idx) + aggr_energy += get_energy(frontiers_data, aggr_opt_point["cpu_freq"], aggr_opt_point["mem_freq"], idx) + aggr_performance += get_performance(frontiers_data, aggr_opt_point["cpu_freq"], aggr_opt_point["mem_freq"], idx) + if aggr_energy < energy: + print "unexpected!" + # 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)+") " + if idx == samplepoints[index-2]: done = 1 - else: - idx += 1 + idx += 1 - prev_tr_sample = samplepoints[index-1] + prev_tr_sample = samplepoints[index-2] # When there are no common points, transition if (len(common_points) == 0): @@ -192,13 +201,17 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): performance = (performance +(num_transitions * perf_cost))/1e6 energy_data[budget_index].append(energy) performance_data[budget_index].append(performance) + aggr_energy = (aggr_energy + (num_transitions * energy_cost))/1e6 + aggr_performance = (aggr_performance +(num_transitions * perf_cost))/1e6 + print "no.tuning(cum): performance (ms): "+str(aggr_performance)+"energy(mJ): "+str(aggr_energy) print "w.tuning: performance (ms): "+str(performance)+" energy(mJ): "+str(energy) +"\n" def main(argv): args = parse(argv) for thresh in [0.0]: - energy_time(args, [1.0,1.1, 1.2, 1.3,1.6,3.0], thresh, 0, 0) - + energy_time(args, [1.0], thresh, 0, 0) +# energy_time(args, [1.0,1.1, 1.2, 1.3,1.6,3.0], thresh, 0, 0) + if __name__ == "__main__": main(sys.argv) -- libgit2 0.22.2