Commit 59fb9002 authored by Philippe SWARTVAGHER's avatar Philippe SWARTVAGHER
Browse files

plot_model.py: highlight plots of configurations used to instanciate models

* Add gca() method to CommCompGraph
* Add is_sample() method to CombinedCommCompModel
parent ee725410
......@@ -831,6 +831,9 @@ class CommCompGraph:
def add_vertical_line(self, x, **kwargs):
self._ax.axvline(x, **kwargs)
def gca(self):
return self._ax
def _plot(self):
plt.figure(self._instance_id)
......
......@@ -209,3 +209,13 @@ class CombinedCommCompModel:
else:
# Computations do remote acceses:
return self.model_remote.total_model
def is_sample(self, numa_comm, numa_comp):
"""Returns wether the couple (numa_comm, numa_comp) is one of those
used to instanciate the model.
TODO: improve this, by asking self.model_{local,remote} on which NUMA
nodes was bound memory to instanciate the model and compares it to the
method arguments.
"""
return numa_comm == numa_comp and numa_comm in [0, self.topology.nb_numa_nodes_per_socket]
......@@ -108,6 +108,7 @@ for numa_comp in range(topo.nb_numa_nodes_total):
real_x_values = parser.x_values[:nb_cores_to_consider]
x_span_zone = topo.nb_cores_per_numa_node if topo.nb_numa_nodes_per_socket > 1 else None
title_fontweight = "bold" if cli_args.model and combined_model.is_sample(numa_comm, numa_comp) else "normal"
graph = CommCompGraph(
real_x_values,
parser.x_type,
......@@ -115,6 +116,7 @@ for numa_comp in range(topo.nb_numa_nodes_total):
parser.compute_bench_type,
parser.compute_bench_type.default_metric,
title=f"Comp. data on NUMA node {numa_comp} - Comm. data on NUMA node {numa_comm}",
title_fontweight=title_fontweight,
comp_legend_title=f"Computation Bandwidth - {cli_args.comp_kernel}",
comm_legend_title="Network Bandwidth",
x_span_zone=x_span_zone)
......@@ -171,7 +173,7 @@ for numa_comp in range(topo.nb_numa_nodes_total):
error = compute_error(comm_with_comp_values, comm_values_model)
print(f"Communication model error: {error*100:3.2f}%")
if (numa_comp == 0 and numa_comm == 0) or (numa_comp == topo.nb_numa_nodes_per_socket and numa_comm == topo.nb_numa_nodes_per_socket):
if combined_model.is_sample(numa_comm, numa_comp):
comm_errors_sample.append(error)
else:
comm_errors.append(error)
......@@ -218,8 +220,12 @@ for numa_comp in range(topo.nb_numa_nodes_total):
error = compute_error(comp_with_comm_values, comp_values_model)
print(f"Computation model error: {error*100:3.2f}%")
if (numa_comp == 0 and numa_comm == 0) or (numa_comp == topo.nb_numa_nodes_per_socket and numa_comm == topo.nb_numa_nodes_per_socket):
if combined_model.is_sample(numa_comm, numa_comp):
comp_errors_sample.append(error)
ax = graph.gca()
for axis in ['top', 'bottom', 'left', 'right']:
ax.spines[axis].set_linewidth(1.5)
else:
comp_errors.append(error)
......
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