Compare commits
2 Commits
6c58640378
...
1ffa92eb04
Author | SHA1 | Date | |
---|---|---|---|
1ffa92eb04 | |||
4f37118136 |
@ -9,8 +9,7 @@ import seaborn as sns
|
|||||||
#import tikzplotlib
|
#import tikzplotlib
|
||||||
import wquantiles as wq
|
import wquantiles as wq
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import argparse
|
||||||
from functools import partial
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
@ -54,15 +53,39 @@ def convert8(x):
|
|||||||
return np.array(int(x, base=16)).astype(np.int64)
|
return np.array(int(x, base=16)).astype(np.int64)
|
||||||
# return np.int8(int(x, base=16))
|
# return np.int8(int(x, base=16))
|
||||||
|
|
||||||
if len(sys.argv) != 2:
|
|
||||||
print(f"Usage: {sys.argv[0]} <file>")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
assert os.path.exists(sys.argv[1] + ".slices.csv")
|
parser = argparse.ArgumentParser(
|
||||||
assert os.path.exists(sys.argv[1] + ".cores.csv")
|
prog=sys.argv[0],
|
||||||
assert os.path.exists(sys.argv[1] + "-results_lite.csv.bz2")
|
)
|
||||||
|
|
||||||
df = pd.read_csv(sys.argv[1] + "-results_lite.csv.bz2",
|
parser.add_argument("path", help="Path to the experiment files")
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--no-plot",
|
||||||
|
dest="no_plot",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="No visible plot (save figures to files)"
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--stats",
|
||||||
|
dest="stats",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="Don't compute figures, just create .stats.csv file"
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
img_dir = os.path.dirname(args.path)+"/figs/"
|
||||||
|
os.makedirs(img_dir, exist_ok=True)
|
||||||
|
|
||||||
|
assert os.path.exists(args.path + ".slices.csv")
|
||||||
|
assert os.path.exists(args.path + ".cores.csv")
|
||||||
|
assert os.path.exists(args.path + "-results_lite.csv.bz2")
|
||||||
|
|
||||||
|
df = pd.read_csv(args.path + "-results_lite.csv.bz2",
|
||||||
dtype={
|
dtype={
|
||||||
"main_core": np.int8,
|
"main_core": np.int8,
|
||||||
"helper_core": np.int8,
|
"helper_core": np.int8,
|
||||||
@ -107,8 +130,8 @@ sample_flush_columns = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
slice_mapping = pd.read_csv(sys.argv[1] + ".slices.csv")
|
slice_mapping = pd.read_csv(args.path + ".slices.csv")
|
||||||
core_mapping = pd.read_csv(sys.argv[1] + ".cores.csv")
|
core_mapping = pd.read_csv(args.path + ".cores.csv")
|
||||||
|
|
||||||
def remap_core(key):
|
def remap_core(key):
|
||||||
def remap(core):
|
def remap(core):
|
||||||
@ -169,7 +192,11 @@ def show_specific_position(attacker, victim, slice):
|
|||||||
|
|
||||||
custom_hist(df_ax_vx_sx["time"], df_ax_vx_sx["clflush_miss_n"], df_ax_vx_sx["clflush_remote_hit"], title=f"A{attacker} V{victim} S{slice}")
|
custom_hist(df_ax_vx_sx["time"], df_ax_vx_sx["clflush_miss_n"], df_ax_vx_sx["clflush_remote_hit"], title=f"A{attacker} V{victim} S{slice}")
|
||||||
#tikzplotlib.save("fig-hist-good-A{}V{}S{}.tex".format(attacker,victim,slice))#, axis_width=r'0.175\textwidth', axis_height=r'0.25\textwidth')
|
#tikzplotlib.save("fig-hist-good-A{}V{}S{}.tex".format(attacker,victim,slice))#, axis_width=r'0.175\textwidth', axis_height=r'0.25\textwidth')
|
||||||
plt.show()
|
if args.no_plot:
|
||||||
|
plt.savefig(img_dir+"specific-a{}v{}s{}.png".format(attacker, victim, slice))
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
def show_grid(df, col, row, shown=["clflush_miss_n", "clflush_remote_hit", "clflush_local_hit_n", "clflush_shared_hit"]):
|
def show_grid(df, col, row, shown=["clflush_miss_n", "clflush_remote_hit", "clflush_local_hit_n", "clflush_shared_hit"]):
|
||||||
# Color convention here :
|
# Color convention here :
|
||||||
@ -179,8 +206,7 @@ def show_grid(df, col, row, shown=["clflush_miss_n", "clflush_remote_hit", "clfl
|
|||||||
# Yellow = Shared Hit
|
# Yellow = Shared Hit
|
||||||
g = sns.FacetGrid(df, col=col, row=row, legend_out=True)
|
g = sns.FacetGrid(df, col=col, row=row, legend_out=True)
|
||||||
g.map(custom_hist, "time", *shown)
|
g.map(custom_hist, "time", *shown)
|
||||||
|
return g
|
||||||
plt.show()
|
|
||||||
|
|
||||||
def export_stats_csv():
|
def export_stats_csv():
|
||||||
def stat(x, key):
|
def stat(x, key):
|
||||||
@ -198,25 +224,43 @@ def export_stats_csv():
|
|||||||
stats["clflush_local_hit_n"] = hit_local.values
|
stats["clflush_local_hit_n"] = hit_local.values
|
||||||
stats["clflush_shared_hit"] = hit_shared.values
|
stats["clflush_shared_hit"] = hit_shared.values
|
||||||
|
|
||||||
stats.to_csv(sys.argv[1] + ".stats.csv", index=False)
|
stats.to_csv(args.path + ".stats.csv", index=False)
|
||||||
|
|
||||||
|
|
||||||
df.loc[:, ("hash",)] = df["hash"].apply(dict_to_json)
|
df.loc[:, ("hash",)] = df["hash"].apply(dict_to_json)
|
||||||
|
|
||||||
if "NO_PLOT" not in os.environ:
|
if not args.stats:
|
||||||
custom_hist(df["time"], df["clflush_miss_n"], df["clflush_remote_hit"], title="miss v. hit")
|
custom_hist(df["time"], df["clflush_miss_n"], df["clflush_remote_hit"], title="miss v. hit")
|
||||||
plt.show()
|
if args.no_plot:
|
||||||
|
plt.savefig(img_dir+"miss_v_hit.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
show_specific_position(0, 2, 0)
|
show_specific_position(0, 2, 0)
|
||||||
|
|
||||||
df_main_core_0 = df[df["main_core"] == 0]
|
df_main_core_0 = df[df["main_core"] == 0]
|
||||||
df_main_core_0.loc[:, ("hash",)] = df["hash"].apply(dict_to_json)
|
df_main_core_0.loc[:, ("hash",)] = df["hash"].apply(dict_to_json)
|
||||||
|
|
||||||
show_grid(df_main_core_0, "helper_core", "hash")
|
g = show_grid(df_main_core_0, "helper_core", "hash")
|
||||||
show_grid(df, "main_core", "hash")
|
|
||||||
|
if args.no_plot:
|
||||||
|
g.savefig(img_dir+"helper_grid.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
g = show_grid(df, "main_core", "hash")
|
||||||
|
|
||||||
|
if args.no_plot:
|
||||||
|
g.savefig(img_dir+"main_grid.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
if not os.path.exists(sys.argv[1] + ".stats.csv"):
|
if not os.path.exists(args.path + ".stats.csv") or args.stats:
|
||||||
export_stats_csv()
|
export_stats_csv()
|
||||||
else:
|
else:
|
||||||
print("Skipping .stats.csv export")
|
print("Skipping .stats.csv export")
|
||||||
|
@ -9,6 +9,7 @@ import seaborn as sns
|
|||||||
from sys import exit
|
from sys import exit
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy import optimize
|
from scipy import optimize
|
||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ warnings.filterwarnings('ignore')
|
|||||||
print("warnings are filtered, enable them back if you are having some trouble")
|
print("warnings are filtered, enable them back if you are having some trouble")
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# sys.argv[1] should be the root
|
# args.path should be the root
|
||||||
# with root-result_lite.csv.bz2 the result
|
# with root-result_lite.csv.bz2 the result
|
||||||
# and .stats.csv
|
# and .stats.csv
|
||||||
# root.slices a slice mapping - done
|
# root.slices a slice mapping - done
|
||||||
@ -29,11 +30,30 @@ print("warnings are filtered, enable them back if you are having some trouble")
|
|||||||
# each row is an origin core
|
# each row is an origin core
|
||||||
# each column a helper core if applicable
|
# each column a helper core if applicable
|
||||||
|
|
||||||
assert os.path.exists(sys.argv[1] + ".stats.csv")
|
parser = argparse.ArgumentParser(
|
||||||
assert os.path.exists(sys.argv[1] + ".slices.csv")
|
prog=sys.argv[0],
|
||||||
assert os.path.exists(sys.argv[1] + ".cores.csv")
|
)
|
||||||
|
|
||||||
stats = pd.read_csv(sys.argv[1] + ".stats.csv",
|
parser.add_argument("path", help="Path to the experiment files")
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--no-plot",
|
||||||
|
dest="no_plot",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="No visible plot (save figures to files)"
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
img_dir = os.path.dirname(args.path)+"/figs/"
|
||||||
|
os.makedirs(img_dir, exist_ok=True)
|
||||||
|
|
||||||
|
assert os.path.exists(args.path + ".stats.csv")
|
||||||
|
assert os.path.exists(args.path + ".slices.csv")
|
||||||
|
assert os.path.exists(args.path + ".cores.csv")
|
||||||
|
|
||||||
|
stats = pd.read_csv(args.path + ".stats.csv",
|
||||||
dtype={
|
dtype={
|
||||||
"main_core": np.int8,
|
"main_core": np.int8,
|
||||||
"helper_core": np.int8,
|
"helper_core": np.int8,
|
||||||
@ -53,8 +73,8 @@ stats = pd.read_csv(sys.argv[1] + ".stats.csv",
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
slice_mapping = pd.read_csv(sys.argv[1] + ".slices.csv")
|
slice_mapping = pd.read_csv(args.path + ".slices.csv")
|
||||||
core_mapping = pd.read_csv(sys.argv[1] + ".cores.csv")
|
core_mapping = pd.read_csv(args.path + ".cores.csv")
|
||||||
|
|
||||||
print("core mapping:\n", core_mapping.to_string())
|
print("core mapping:\n", core_mapping.to_string())
|
||||||
print("slice mapping:\n", slice_mapping.to_string())
|
print("slice mapping:\n", slice_mapping.to_string())
|
||||||
@ -72,7 +92,6 @@ def remap_core(key):
|
|||||||
|
|
||||||
return remap
|
return remap
|
||||||
|
|
||||||
|
|
||||||
stats["main_socket"] = stats["main_core"].apply(remap_core("socket"))
|
stats["main_socket"] = stats["main_core"].apply(remap_core("socket"))
|
||||||
stats["main_core_fixed"] = stats["main_core"].apply(remap_core("core"))
|
stats["main_core_fixed"] = stats["main_core"].apply(remap_core("core"))
|
||||||
stats["main_ht"] = stats["main_core"].apply(remap_core("hthread"))
|
stats["main_ht"] = stats["main_core"].apply(remap_core("hthread"))
|
||||||
@ -92,7 +111,11 @@ print("Graphing from {} to {}".format(graph_lower_miss, graph_upper_miss))
|
|||||||
g_ = sns.FacetGrid(stats, col="main_core_fixed", row="slice_group")
|
g_ = sns.FacetGrid(stats, col="main_core_fixed", row="slice_group")
|
||||||
|
|
||||||
g_.map(sns.histplot, 'clflush_miss_n', bins=range(graph_lower_miss, graph_upper_miss), color="b", edgecolor="b", alpha=0.2)
|
g_.map(sns.histplot, 'clflush_miss_n', bins=range(graph_lower_miss, graph_upper_miss), color="b", edgecolor="b", alpha=0.2)
|
||||||
plt.show()
|
if args.no_plot:
|
||||||
|
g_.savefig(img_dir+"medians0.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -245,7 +268,11 @@ figure_median_I.tight_layout()
|
|||||||
# import tikzplotlib
|
# import tikzplotlib
|
||||||
|
|
||||||
# tikzplotlib.save("fig-median-I.tex", axis_width=r'0.175\textwidth', axis_height=r'0.25\textwidth')
|
# tikzplotlib.save("fig-median-I.tex", axis_width=r'0.175\textwidth', axis_height=r'0.25\textwidth')
|
||||||
plt.show()
|
if args.no_plot:
|
||||||
|
plt.savefig(img_dir+"medians1.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
#stats["predicted_remote_hit_no_gpu"] = exclusive_hit_topology_nogpu_df(stats, *(res_no_gpu[0]))
|
#stats["predicted_remote_hit_no_gpu"] = exclusive_hit_topology_nogpu_df(stats, *(res_no_gpu[0]))
|
||||||
stats["predicted_remote_hit_gpu"] = exclusive_hit_topology_gpu_df(stats, *(res_gpu[0]))
|
stats["predicted_remote_hit_gpu"] = exclusive_hit_topology_gpu_df(stats, *(res_gpu[0]))
|
||||||
@ -259,19 +286,36 @@ figure_median_E_A0.map(sns.lineplot, 'helper_core_fixed', 'predicted_remote_hit_
|
|||||||
figure_median_E_A0.set_titles(col_template="$S$ = {col_name}")
|
figure_median_E_A0.set_titles(col_template="$S$ = {col_name}")
|
||||||
|
|
||||||
# tikzplotlib.save("fig-median-E-A0.tex", axis_width=r'0.175\textwidth', axis_height=r'0.25\textwidth')
|
# tikzplotlib.save("fig-median-E-A0.tex", axis_width=r'0.175\textwidth', axis_height=r'0.25\textwidth')
|
||||||
plt.show()
|
if args.no_plot:
|
||||||
|
plt.savefig(img_dir+"medians1.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
g = sns.FacetGrid(stats, row="main_core_fixed")
|
g = sns.FacetGrid(stats, row="main_core_fixed")
|
||||||
|
|
||||||
g.map(sns.scatterplot, 'slice_group', 'clflush_miss_n', color="b")
|
g.map(sns.scatterplot, 'slice_group', 'clflush_miss_n', color="b")
|
||||||
g.map(sns.scatterplot, 'slice_group', 'clflush_local_hit_n', color="g")
|
g.map(sns.scatterplot, 'slice_group', 'clflush_local_hit_n', color="g")
|
||||||
|
|
||||||
|
if args.no_plot:
|
||||||
|
g.savefig(img_dir+"medians2.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
g0 = sns.FacetGrid(stats, row="slice_group")
|
g0 = sns.FacetGrid(stats, row="slice_group")
|
||||||
|
|
||||||
g0.map(sns.scatterplot, 'main_core_fixed', 'clflush_miss_n', color="b")
|
g0.map(sns.scatterplot, 'main_core_fixed', 'clflush_miss_n', color="b")
|
||||||
g0.map(sns.scatterplot, 'main_core_fixed', 'clflush_local_hit_n', color="g") # this gives away the trick I think !
|
g0.map(sns.scatterplot, 'main_core_fixed', 'clflush_local_hit_n', color="g") # this gives away the trick I think !
|
||||||
# possibility of sending a general please discard this everyone around one of the ring + wait for ACK - direction depends on the core.
|
# possibility of sending a general please discard this everyone around one of the ring + wait for ACK - direction depends on the core.
|
||||||
|
|
||||||
|
if args.no_plot:
|
||||||
|
g0.savefig(img_dir+"medians2.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
g2 = sns.FacetGrid(stats, row="main_core_fixed", col="slice_group")
|
g2 = sns.FacetGrid(stats, row="main_core_fixed", col="slice_group")
|
||||||
@ -281,9 +325,20 @@ g2.map(sns.lineplot, 'helper_core_fixed', 'predicted_remote_hit_gpu', color="r")
|
|||||||
#g2.map(sns.lineplot, 'helper_core_fixed', 'predicted_remote_hit_no_gpu', color="g")
|
#g2.map(sns.lineplot, 'helper_core_fixed', 'predicted_remote_hit_no_gpu', color="g")
|
||||||
#g2.map(plot_func(exclusive_hit_topology_nogpu_df, *(res_no_gpu[0])), 'helper_core_fixed', color="g")
|
#g2.map(plot_func(exclusive_hit_topology_nogpu_df, *(res_no_gpu[0])), 'helper_core_fixed', color="g")
|
||||||
|
|
||||||
|
if args.no_plot:
|
||||||
|
g2.savefig(img_dir+"medians3.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
g3 = sns.FacetGrid(stats, row="main_core_fixed", col="slice_group")
|
g3 = sns.FacetGrid(stats, row="main_core_fixed", col="slice_group")
|
||||||
g3.map(sns.scatterplot, 'helper_core_fixed', 'clflush_shared_hit', color="y")
|
g3.map(sns.scatterplot, 'helper_core_fixed', 'clflush_shared_hit', color="y")
|
||||||
|
|
||||||
# more ideas needed
|
# more ideas needed
|
||||||
|
if args.no_plot:
|
||||||
|
g3.savefig(img_dir+"medians4.png")
|
||||||
|
plt.close()
|
||||||
|
else:
|
||||||
|
plt.show()
|
||||||
|
|
||||||
plt.show()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user