Commit 7464c266 authored by Matej Spetko's avatar Matej Spetko

HDF5 heatmap data load update

parent 924f29ec
......@@ -4,6 +4,7 @@ import csv
import sys
from runpy import run_path
import json
import h5py
class DataLoad:
......@@ -32,6 +33,7 @@ class DataLoad:
self.data = {"plot_summary_data": [], "nested_regions_report_data": []}
self.__load_data_from_csv()
#self.__load_data_from_hdf5()
def __load_data_from_csv(self):
......@@ -183,13 +185,13 @@ class DataLoad:
'category': key,
'index': i,
'unit': vals[i][1]},
{'config': (),#ignore this
{'config': (),#ignore this # espreso 3 cfgs example {'config': ('taurusi6587', '8', 'CONFIG'),
'func_label_name': self.file_name_args[funcLabel_pos][1],
'func_label_unit': self.config_dic['func_label_unit'],
'heat_data': [],
# list of lists one of lists contains tuples -> (funcLabel, value_in_heatmap)
'key': ('optimalkey;',), # optimal key from mericConfig
'lines': [], # xlablel values
# list of lists one of lists contains tuples -> (xLabel, value_in_heatmap)
'key': (self.meric_config_energy_data[region]['NUM_THREADS']+';'+self.config_dic['keys_units'][0],), # optimal key from mericConfig
'lines': [], # funcLabel values
'optim_func_label_value': self.meric_config_energy_data[region]['FREQUENCY'], # optim vals
'optim_x_val': self.meric_config_energy_data[region]['UNCORE_FREQUENCY'],
'optim_y_val': sys.maxsize,
......@@ -198,6 +200,8 @@ class DataLoad:
act_category = None
# HDF5
h5region = h5file[region]
......@@ -222,7 +226,7 @@ class DataLoad:
#print(h5Thrd.keys())
# implementation here
h5_run_num = 0
h5_xlabel_val = h5_name[xLabel_pos]
h5_funclabel_val = h5_name[funcLabel_pos]
h5_key_val = h5_name[key_pos]
......@@ -233,57 +237,75 @@ class DataLoad:
new_dict_key = key + " " + val[0]
h5_dict_plot_data_ylabel[new_dict_key] = 0
# TODO if key_val == self.meric_config_energy_data[region]['NUM_THREADS']:
h5_run_num += 1
if h5_key_val == self.meric_config_energy_data[region]['NUM_THREADS']:
for CategName in sorted(h5Thrd.keys()):
h5categ = h5Thrd[CategName]
#print(h5categ)
h5_act_category = CategName
for CategName in sorted(h5Thrd.keys()):
h5categ = h5Thrd[CategName]
#print(h5categ)
h5_act_category = CategName
h5_run_num = 0
h5_last_calltree = ""
for MeasureNumber in sorted(h5categ.keys(), reverse=True):
h5number = h5categ[MeasureNumber]
#print(h5number.name)
for MeasureNumber in sorted(h5categ.keys(), reverse=True):
h5number = h5categ[MeasureNumber]
#print(h5number.name)
print(h5number.name+"\n-------------")
h5string = str(h5number[()], encoding='ascii').split("\n")
#print(h5string)
h5_last_calltree = h5string.pop(0)
print("calltree: " + h5_last_calltree)
for elem in h5string:
line = elem.split(",")
print(line)
if line[0] in args and h5_act_category.strip() in categories:
h5_dict_plot_data_ylabel[h5_act_category.strip() + " " + line[0]] += float(line[1])
print(h5_dict_plot_data_ylabel)
print(h5number.name+"\n-------------")
h5string = str(h5number[()], encoding='ascii').split("\n")
#print(h5string)
if not (h5_last_calltree == h5string.pop(0)):
h5_last_calltree = h5string.pop(0)
h5_run_num += 1
for key in h5_dict_plot_data_ylabel.keys():
h5_dict_plot_data_ylabel[key] = h5_dict_plot_data_ylabel[key]/float(h5_run_num)
print("calltree: " + h5_last_calltree)
for elem in h5string:
line = elem.split(",")
print(line)
for key, value in h5_dict_plot_data_ylabel.items():
for data in data_region:
if data[0]['arg'] in key and data[0]['category'] in key:
if str(h5_xlabel_val) not in data[1]['lines']:
data[1]['lines'].append(str(h5_xlabel_val))
if line[0] in args and h5_act_category.strip() in categories:
h5_dict_plot_data_ylabel[h5_act_category.strip() + " " + line[0]] += float(line[1])
print(h5_dict_plot_data_ylabel)
index_of_line = data[1]['lines'].index(str(h5_xlabel_val))
if len(data[1]['heat_data'])-1 < index_of_line:
data[1]['heat_data'].append([])
for key in h5_dict_plot_data_ylabel.keys():
h5_dict_plot_data_ylabel[key] = h5_dict_plot_data_ylabel[key]/float(h5_run_num)
data[1]['heat_data'][index_of_line].append((h5_funclabel_val, value))
if value < data[1]['optim_y_val']: #optimal value is just minimum
data[1]['optim_y_val'] = value
for key, value in h5_dict_plot_data_ylabel.items():
for data in data_region:
if data[0]['arg'] in key and data[0]['category'] in key:
if str(round(float(h5_funclabel_val)*self.funcLabel_multiplier, 2)) not in data[1]['lines']:
data[1]['lines'].append(str(round(float(h5_funclabel_val)*self.funcLabel_multiplier, 2)))
index_of_line = data[1]['lines'].index(str(round(float(h5_funclabel_val)*self.funcLabel_multiplier, 2)))
if len(data[1]['heat_data'])-1 < index_of_line:
data[1]['heat_data'].append([])
data[1]['heat_data'][index_of_line].append((round(float(h5_xlabel_val)*self.xLabel_multiplier, 2), value))
if value < data[1]['optim_y_val']: #optimal value is just minimum
data[1]['optim_y_val'] = value
# TODO
else:
continue
h5_name.pop()
h5_name.pop()
#sort data
for y_label_data in data_region:
for i, heat_data_list in enumerate(y_label_data[1]['heat_data']):
y_label_data[1]['heat_data'][i] = sorted(heat_data_list)
lines_heat_data = zip(y_label_data[1]['lines'], y_label_data[1]['heat_data'])
lines_heat_data = sorted(lines_heat_data)
lines_heat_data = list(zip(*lines_heat_data))
y_label_data[1]['lines'] = lines_heat_data[0]
y_label_data[1]['heat_data'] = lines_heat_data[1]
if region == list(self.main_reg)[0]:
self.data["plot_summary_data"] = data_region
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment