From 40efbe7a13a0adafd9135e4256c71492b09a1aa7 Mon Sep 17 00:00:00 2001 From: Rizwana Begum Date: Tue, 5 May 2015 13:48:51 -0400 Subject: [PATCH] fixed no/wtuning --- figures/notuning_wtuning.py | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/figures/notuning_wtuning.py b/figures/notuning_wtuning.py index b106638..740917e 100644 --- a/figures/notuning_wtuning.py +++ b/figures/notuning_wtuning.py @@ -38,7 +38,7 @@ def get_no_tuning_energy_performance(args, budget, bmark): dir_path = args.input_dir # finding points with 3% threshold of target budget/inefficiency - thresh = 3 + thresh = 3 bmarkDirPath = os.path.join(os.path.join(dir_path, "aggr_data"), bmark) frontiers_file = os.path.join(bmarkDirPath, "frontiers.json") @@ -70,17 +70,16 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): output_dir_path = args.output_dir benchmarks, labels = get_benchmarks(args) -# benchmarks =['gobmk'] +# benchmarks = ['bzip2'] #plot constants cpuflist = get_cpu_freq_plot_list(args) memflist = get_mem_freq_plot_list(args) # finding points with 3% threshold of target budget/inefficiency - thresh = 3 - energy_data = [ [] for thresh in budget_list] - performance_data = [ [] for thresh in budget_list] + thresh = 3 + energy_data = [ [] for bgt in budget_list] + performance_data = [ [] for bgt in budget_list] for bmark in benchmarks: - data = [] for budget_index, budget in enumerate(budget_list): print "Inefficiency Budget: "+str(budget)+" Benchmark: "+bmark @@ -109,12 +108,19 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): if point["speedup"] > optimal_point["speedup"]: optimal_point = point +# if frontiers_data["data"].index(data) == 5: +# print filtered_data +# print optimal_point + local_rect_points=[] for point in filtered_data: if (optimal_point["speedup"] - point["speedup"]) < 0: print "something is wrong!" if (optimal_point["speedup"] - point["speedup"]) * 100 / optimal_point["speedup"] <= cluster_thresh: + # if optimal_point != point: + # print optimal_point + # print point data_to_plot.append(point) sample_points.append(frontiers_data["data"].index(data)) local_rect_points.append(point) @@ -145,13 +151,16 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): #Construct the current settings current_settings = Set() + #print "current sample: "+str(current_sample) while index < len( samplepoints ) and samplepoints[index] == current_sample: + #print "index: "+str(index) current_settings.add((cpufpoints[index],memfpoints[index])) index = index + 1 #Compute the common points between current and what is available common_points = current_settings.intersection(settings_available) + #print "sp = " + str(samplepoints[-1]) if (len(common_points) == 0 or index == len( samplepoints )): # find the point with highest cpu and mem freq if (current_sample !=0 ): @@ -164,20 +173,26 @@ def energy_time(args, budget_list, cluster_thresh, perf_cost, energy_cost): if point[1] > optimal_point[1]: optimal_point = point done = 0 - while done == 0 or idx == len(samplepoints) -1: + #print samplepoints[-1] + while done == 0 or idx == samplepoints[-1]: + #print idx 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 + # 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) + if index < len(samplepoints): + if idx == samplepoints[index]-2: + done = 1 + prev_tr_sample = samplepoints[index]-2 + else: + if idx == samplepoints[-2]: + done = 1 + prev_tr_sample = samplepoints[-2] idx += 1 - prev_tr_sample = samplepoints[index-2] - # When there are no common points, transition if (len(common_points) == 0): 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): 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" + 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" def main(argv): args = parse(argv) for thresh in [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) + 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) if __name__ == "__main__": main(sys.argv) -- libgit2 0.22.2