Commit 38e0d558c5a413f5b83496500562cc0570f54ec3

Authored by Rizwana Begum
1 parent ad31d16f

fixed script issues

figures/energy_perf_bar.py
@@ -10,13 +10,13 @@ from sets import Set @@ -10,13 +10,13 @@ from sets import Set
10 10
11 from common import * 11 from common import *
12 12
13 -def get_energy(frontiers_data, cpu_freq, mem_freq, sample, bmark): 13 +def get_energy(frontiers_data, cpu_freq, mem_freq, sample):
14 for point in frontiers_data["data"][sample]: 14 for point in frontiers_data["data"][sample]:
15 if point["cpu_freq"] == cpu_freq: 15 if point["cpu_freq"] == cpu_freq:
16 if point["mem_freq"] == mem_freq: 16 if point["mem_freq"] == mem_freq:
17 return point["energy"] 17 return point["energy"]
18 18
19 -def get_performance(frontiers_data, cpu_freq, mem_freq, sample, bmark): 19 +def get_performance(frontiers_data, cpu_freq, mem_freq, sample):
20 for point in frontiers_data["data"][sample]: 20 for point in frontiers_data["data"][sample]:
21 if point["cpu_freq"] == cpu_freq: 21 if point["cpu_freq"] == cpu_freq:
22 if point["mem_freq"] == mem_freq: 22 if point["mem_freq"] == mem_freq:
@@ -90,9 +90,9 @@ def plot_energy_perf_bar(args, threshold_list, budget): @@ -90,9 +90,9 @@ def plot_energy_perf_bar(args, threshold_list, budget):
90 current_sample = -1 90 current_sample = -1
91 length = 1 91 length = 1
92 lengths = [] 92 lengths = []
93 - prev_tr_sample = 0  
94 energy = 0 93 energy = 0
95 performance = 0 94 performance = 0
  95 + idx = 0
96 while index < len( samplepoints ): 96 while index < len( samplepoints ):
97 current_sample = samplepoints[index] 97 current_sample = samplepoints[index]
98 98
@@ -116,18 +116,32 @@ def plot_energy_perf_bar(args, threshold_list, budget): @@ -116,18 +116,32 @@ def plot_energy_perf_bar(args, threshold_list, budget):
116 elif point[0] == optimal_point[0]: 116 elif point[0] == optimal_point[0]:
117 if point[1] > optimal_point[1]: 117 if point[1] > optimal_point[1]:
118 optimal_point = point 118 optimal_point = point
  119 +# done = 0
  120 +# idx = prev_tr_sample+1
  121 +# while done == 0:
  122 +# energy += get_energy(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)
  123 +# performance += get_performance(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)
  124 +# if idx == samplepoints[index-1]:
  125 +# done = 1
  126 +# else:
  127 +# idx += 1
  128 +#
  129 +# prev_tr_sample = samplepoints[index-1]
  130 +############
119 done = 0 131 done = 0
120 - idx = prev_tr_sample+1  
121 - while done == 0:  
122 - energy += get_energy(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)  
123 - performance += get_performance(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)  
124 - if idx == samplepoints[index-1]:  
125 - done = 1  
126 - else:  
127 - idx += 1  
128 -  
129 - prev_tr_sample = samplepoints[index-1]  
130 - 132 + #print samplepoints[-1]
  133 + while done == 0 or idx == samplepoints[-1]:
  134 + #print idx
  135 + energy += get_energy(frontiers_data,optimal_point[0], optimal_point[1], idx)
  136 + performance += get_performance(frontiers_data,optimal_point[0], optimal_point[1], idx)
  137 + if index < len(samplepoints):
  138 + if idx == samplepoints[index]-2:
  139 + done = 1
  140 + else:
  141 + if idx == samplepoints[-2]:
  142 + done = 1
  143 + idx += 1
  144 +############
131 # When there are no common points, transition 145 # When there are no common points, transition
132 if (len(common_points) == 0): 146 if (len(common_points) == 0):
133 settings_available = current_settings #all current settings are now available 147 settings_available = current_settings #all current settings are now available
@@ -320,6 +334,7 @@ def plot_abs_energy_time_bar(args, budget_list, cluster_thresh, perf_cost, energ @@ -320,6 +334,7 @@ def plot_abs_energy_time_bar(args, budget_list, cluster_thresh, perf_cost, energ
320 prev_tr_sample = 0 334 prev_tr_sample = 0
321 energy = 0 335 energy = 0
322 performance = 0 336 performance = 0
  337 + idx = 0
323 while index < len( samplepoints ): 338 while index < len( samplepoints ):
324 current_sample = samplepoints[index] 339 current_sample = samplepoints[index]
325 340
@@ -343,17 +358,32 @@ def plot_abs_energy_time_bar(args, budget_list, cluster_thresh, perf_cost, energ @@ -343,17 +358,32 @@ def plot_abs_energy_time_bar(args, budget_list, cluster_thresh, perf_cost, energ
343 elif point[0] == optimal_point[0]: 358 elif point[0] == optimal_point[0]:
344 if point[1] > optimal_point[1]: 359 if point[1] > optimal_point[1]:
345 optimal_point = point 360 optimal_point = point
  361 +# done = 0
  362 +# idx = prev_tr_sample+1
  363 +# while done == 0:
  364 +# energy += get_energy(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)
  365 +# performance += get_performance(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)
  366 +# if idx == samplepoints[index-1]:
  367 +# done = 1
  368 +# else:
  369 +# idx += 1
  370 +#
  371 +# prev_tr_sample = samplepoints[index-1]
  372 +############
346 done = 0 373 done = 0
347 - idx = prev_tr_sample+1  
348 - while done == 0:  
349 - energy += get_energy(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)  
350 - performance += get_performance(frontiers_data, optimal_point[0], optimal_point[1], idx, bmark)  
351 - if idx == samplepoints[index-1]:  
352 - done = 1  
353 - else:  
354 - idx += 1  
355 -  
356 - prev_tr_sample = samplepoints[index-1] 374 + #print samplepoints[-1]
  375 + while done == 0 or idx == samplepoints[-1]:
  376 + #print idx
  377 + energy += get_energy(frontiers_data,optimal_point[0], optimal_point[1], idx)
  378 + performance += get_performance(frontiers_data,optimal_point[0], optimal_point[1], idx)
  379 + if index < len(samplepoints):
  380 + if idx == samplepoints[index]-2:
  381 + done = 1
  382 + else:
  383 + if idx == samplepoints[-2]:
  384 + done = 1
  385 + idx += 1
  386 +############
357 387
358 # When there are no common points, transition 388 # When there are no common points, transition
359 if (len(common_points) == 0): 389 if (len(common_points) == 0):
figures/plots/496/energy_perf_bar/energy_bar_normalized_0.0_0_0.pdf
No preview for this file type
figures/plots/496/energy_perf_bar/energy_bar_normalized_1.0_0_0.pdf
No preview for this file type
figures/plots/496/energy_perf_bar/energy_bar_normalized_1_0_0.pdf deleted
No preview for this file type
figures/plots/496/energy_perf_bar/energy_bar_normalized_5.0_0_0.pdf
No preview for this file type
figures/plots/496/energy_perf_bar/energy_perf_bar_1.3.pdf
No preview for this file type
figures/plots/496/energy_perf_bar/performance_bar_normalized_0.0_0_0.pdf
No preview for this file type
figures/plots/496/energy_perf_bar/performance_bar_normalized_1.0_0_0.pdf
No preview for this file type
figures/plots/496/energy_perf_bar/performance_bar_normalized_5.0_0_0.pdf
No preview for this file type