Skip to content

Commit

Permalink
plots: make color usage homogeneous (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz authored May 21, 2024
1 parent 79c5ae1 commit da421c1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 16 deletions.
6 changes: 5 additions & 1 deletion tasks/kernels_mpi/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ def deploy(ctx, backend="k8s", num_vms=2):
if backend == "k8s":
deploy_native_mpi("kernels", FAABRIC_EXP_IMAGE_NAME, num_vms)

wait_for_pods(get_native_mpi_namespace("kernels"), "run=faasm-openmpi")
wait_for_pods(
get_native_mpi_namespace("kernels"),
"run=faasm-openmpi",
num_expected=num_vms,
)
else:
raise RuntimeError("Compose backend not implemented!")

Expand Down
5 changes: 4 additions & 1 deletion tasks/kernels_mpi/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
MPI_KERNELS_PLOTS_DIR,
MPI_KERNELS_RESULTS_DIR,
)
from tasks.util.plot import SINGLE_COL_FIGSIZE, save_plot
from tasks.util.plot import UBENCH_PLOT_COLORS, SINGLE_COL_FIGSIZE, save_plot


def _read_kernels_results():
Expand Down Expand Up @@ -92,6 +92,7 @@ def kernels(ctx):
xs,
ys,
width,
color=UBENCH_PLOT_COLORS[ind_kernel],
label=kernel,
edgecolor="black",
)
Expand All @@ -108,13 +109,15 @@ def kernels(ctx):
# Vertical lines to separate MPI processes
ylim_bottom = 0
ylim_top = ymax
"""
ax.vlines(
[i + 0.5 for i in range(len(MPI_KERNELS_EXPERIMENT_NPROCS) - 1)],
ylim_bottom,
ylim_top,
linestyle="dashed",
colors="gray",
)
"""

ax.set_xlim(left=xlim_left, right=xlim_right)
ax.set_ylim(bottom=ylim_bottom, top=ylim_top)
Expand Down
11 changes: 7 additions & 4 deletions tasks/kernels_omp/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
OPENMP_KERNELS_PLOTS_DIR,
OPENMP_KERNELS_RESULTS_DIR,
)
from tasks.util.plot import SINGLE_COL_FIGSIZE, save_plot
from tasks.util.plot import UBENCH_PLOT_COLORS, SINGLE_COL_FIGSIZE, save_plot


def _read_results():
Expand Down Expand Up @@ -85,6 +85,7 @@ def plot(ctx):
ys,
width,
label=kernel,
color=UBENCH_PLOT_COLORS[ind_kernel],
edgecolor="black",
)

Expand All @@ -93,14 +94,16 @@ def plot(ctx):
ax.set_xticks(xs, labels=nprocs)

# Horizontal line at slowdown of 1
xlim_left = -0.5
xlim_left = -(0.5 + width)
xlim_right = len(nprocs) - 0.5
ax.hlines(1, xlim_left, xlim_right, linestyle="dashed", colors="red")

ax.set_xlim(left=xlim_left, right=xlim_right)
ax.set_ylim(bottom=0, top=ymax)
ax.set_xlabel("Number of OpenMP threads")
ax.set_ylabel("Slowdown \n [{} / OpenMPI]".format(SYSTEM_NAME))
ax.legend(loc="upper right", ncol=4, bbox_to_anchor=(0.95, 1.35))
ax.set_ylabel("Slowdown \n [{} / OpenMP]".format(SYSTEM_NAME))
ax.legend(
loc="upper right", ncol=5, bbox_to_anchor=(1.00, 1.17), fontsize=9
)

save_plot(fig, OPENMP_KERNELS_PLOTS_DIR, "openmp_kernels_slowdown")
6 changes: 5 additions & 1 deletion tasks/lammps/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ def deploy(ctx, backend="k8s", num_vms=2):
if backend == "k8s":
deploy_native_mpi("lammps", FAABRIC_EXP_IMAGE_NAME, num_vms)

wait_for_pods(get_native_mpi_namespace("lammps"), "run=faasm-openmpi")
wait_for_pods(
get_native_mpi_namespace("lammps"),
"run=faasm-openmpi",
num_expected=num_vms,
)
else:
raise RuntimeError("Compose backend not implemented!")

Expand Down
9 changes: 4 additions & 5 deletions tasks/lammps/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
from os.path import join
from pandas import read_csv
from tasks.util.env import SYSTEM_NAME
from tasks.util.faasm import get_faasm_version
from tasks.util.lammps import (
LAMMPS_PLOTS_DIR,
LAMMPS_RESULTS_DIR,
LAMMPS_SIM_WORKLOAD_CONFIGS,
)
from tasks.util.plot import SINGLE_COL_FIGSIZE, save_plot
from tasks.util.plot import UBENCH_PLOT_COLORS, SINGLE_COL_FIGSIZE, save_plot


def _read_results():
Expand Down Expand Up @@ -74,6 +73,7 @@ def plot(ctx, plot_elapsed_times=True):
slowdown,
width=width,
label=workload,
color=UBENCH_PLOT_COLORS[workload_ind],
edgecolor="black",
)

Expand All @@ -85,9 +85,8 @@ def plot(ctx, plot_elapsed_times=True):
ax.set_xlim(left=xmin)
ax.set_xticks(list(range(17)))
ax.set_ylim(bottom=ymin, top=ymax)
ax.legend()
ax.legend(ncols=2, loc="upper center")
ax.set_xlabel("# MPI Processes")
ax.set_ylabel("Slowdown [{} / OpenMPI]".format(SYSTEM_NAME))
ax.set_title("Faasm Version ({})".format(get_faasm_version()))
ax.set_ylabel("Slowdown\n[{} / OpenMPI]".format(SYSTEM_NAME))

save_plot(fig, LAMMPS_PLOTS_DIR, "lammps_slowdown")
5 changes: 2 additions & 3 deletions tasks/lammps/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ def native(ctx, w, repeats=1):
"""
num_cpus_per_vm = 8
num_vms = 2
# data_file = get_faasm_benchmark(LAMMPS_SIM_WORKLOAD)["data"][0],
# TODO: is this a good idea? FIXME FIXME DELETE ME
data_file = get_faasm_benchmark("compute")["data"][0]
data_file = get_faasm_benchmark(LAMMPS_SIM_WORKLOAD)["data"][0]

for workload in w:
if workload not in LAMMPS_SIM_WORKLOAD_CONFIGS:
Expand Down Expand Up @@ -150,6 +148,7 @@ def native(ctx, w, repeats=1):
"mpirun",
get_lammps_migration_params(
native=True,
num_loops=3,
num_net_loops=workload_config["num_net_loops"],
chunk_size=workload_config["chunk_size"],
),
Expand Down
2 changes: 1 addition & 1 deletion tasks/util/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# -------------------

OPENMP_KERNELS_DOCKER_DIR = join(EXAMPLES_DOCKER_DIR, "Kernels")
OPENMP_KERNELS = ["global", "p2p", "sparse", "nstream", "reduce", "dgemm"]
OPENMP_KERNELS = ["p2p", "sparse", "nstream", "reduce", "dgemm"]
OPENMP_KERNELS_FAASM_USER = "kernels-omp"

OPENMP_KERNELS_PLOTS_DIR = join(PLOTS_ROOT, "kernels-omp")
Expand Down
9 changes: 9 additions & 0 deletions tasks/util/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
"slurm": (0.3, 0.3, 0.3),
}

UBENCH_PLOT_COLORS = [
(1, 0.4, 0.4),
(0.29, 0.63, 0.45),
(0.2, 0.6, 1.0),
(0.3, 0.3, 0.3),
(0.6, 0.4, 1.0),
(1.0, 0.8, 0.4),
]

PLOT_PATTERNS = ["//", "\\\\", "||", "-", "*-", "o-"]
SINGLE_COL_FIGSIZE = (6, 3)

Expand Down

0 comments on commit da421c1

Please sign in to comment.