def visualizePowerModel(path): # Plot the measured values and the model pw_model = powerModel(path) freqs = get_range(args.freqs) if args.freqs else pw_model.frequencies thrs = get_range(args.thrs) if args.thrs else pw_model.threads est = pw_model.estimate(freqs, thrs) plotData.setProps(xlabel="Frequencies (GHz)", ylabel="Active Cores", zlabel="Power (W)") plotData.plot3D(x=pw_model.frequencies, y=pw_model.threads, z=pw_model.powers, legend='Measurements') plotData.plot3D(x=freqs, y=thrs, z=est, points=False, legend='Model') plotData.plotShow(showLegend=True)
def update_data(val): d = int(val) plotData.setProps(xlabel='Frequencies (GHz)', ylabel='Active threads', zlabel='Time (S)', title=title_) df_ = df[df['in_cat'] == d] df_pred_ = df_pred[df_pred['in_cat'] == d] df_ = df_[df_['thr'].isin(df_pred_['thr'].unique())] if not df_.empty: plotData.plot3D(x=df_['freq'].unique(), y=df_['thr'].unique(), z=df_['time'].values) plotData.plot3D(x=df_pred_['freq'].unique(), y=df_pred_['thr'].unique(), z=df_pred_['time'].values, points=False)
def figures(appname=None, energy=True, in_cmp=3): from energyOptimal import plotData for app, title in zip(parsec_models, titles): if (appname and not appname in app) or (not app): continue pw_model = powerModel('data/ipmi_2-32_cpuload.pw') perf_model = performanceModel('data/dataframes/' + app, 'data/svr/' + app) en_model = energyModel(pw_model, perf_model, freq_range_=np.arange(1.2e6, 2.3e6, 0.1e6) / 1e6) plotData.setProps(xlabel='Frequencies (GHz)', ylabel='Active threads', zlabel='Energy (kJ)' if energy else 'Time (s)', title=title) df_ = perf_model.dataFrame[perf_model.dataFrame['in_cat'] == in_cmp].sort_values(['freq', 'thr']) df_pred_ = en_model.dataFrame[en_model.dataFrame['in_cat'] == in_cmp].sort_values(['freq', 'thr']) # df_pred_= df_pred_[df_pred_['thr'].isin(list(range(8,33,2)))] # df_= df_[df_['thr'].isin(list(range(8,33,2)))] plotData.plot3D(x=df_['freq'].unique(), y=df_['thr'].unique(), z=df_['energy'].values / 1e3 if energy else df_['time'].values, points=True, legend='Measurements') plotData.plot3D(x=df_pred_['freq'].unique(), y=df_pred_['thr'].unique(), z=df_pred_['energy_model'].values / 1e3 if energy else df_pred_['time'].values, points=False, legend='Model') plotData.ax.view_init(30, 60) if 'HPL' in app: plotData.ax.set_zlim(0, 15) aux = 'energy' if energy else 'time' plotData.savePlot('fotos/{}/{}.png'.format(aux, app), showLegend=True)
def update_data(val): d = int(val) plotData.setProps(xlabel='Frequencies (GHz)', ylabel='Active threads', zlabel='Energy (KJ)', title=args.title) df_pred_ = df_pred[df_pred['in_cat'] == d] df_ = df[df['in_cat'] == d] df_ = df_[df_['thr'].isin(df_pred_['thr'].unique())] plotData.ax.view_init(30, 60) if not df_.empty: plotData.plot3D(x=df_['freq'].unique(), y=df_['thr'].unique(), z=df_['energy'].values / 1e3, points=True, legend='Measurements') plotData.plot3D(x=df_pred_['freq'].unique(), y=df_pred_['thr'].unique(), z=df_pred_['energy_model'].values / 1e3, points=False, legend='Model')
f_est, p_est = pw_model_full.frequencies, pw_model_full.threads pws_est = pw_model.estimate(f_est, p_est) df_est = pw_model.estimate(f_est, p_est, dataFrame=True) df_full = pw_model_full.get_Dataframe() df = pd.merge(df_est, df_full) df['diff'] = np.abs((df['pw_est'] - df['pw']) / df['pw'] * 100) print("Max error from all measured points {} ".format( df['diff'].max())) plotData.setProps(xlabel='Frequency', ylabel='Threads', zlabel='Power') plotData.plot3D(pw_model_full.frequencies, pw_model_full.threads, pw_model_full.powers, color_='blue', legend='Measurement') plotData.plot3D(pw_model.frequencies, pw_model.threads, pw_model.powers, color_='red', legend='Chosen points') plotData.plot3D(f_est, p_est, pws_est, points=False, legend='Estimative') plotData.savePlot('figures/pwmodel_{}_{}.png'.format( len(freq), len(thr)), showLegend=True)