Skip to content

Commit

Permalink
nits: run clang-format (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz authored May 14, 2024
1 parent 2b1ea3a commit 79c5ae1
Show file tree
Hide file tree
Showing 21 changed files with 571 additions and 279 deletions.
7 changes: 5 additions & 2 deletions tasks/elastic/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from os.path import join
from pandas import read_csv
from tasks.util.elastic import ELASTIC_PLOTS_DIR, ELASTIC_RESULTS_DIR
from tasks.util.env import SYSTEM_NAME
from tasks.util.plot import SINGLE_COL_FIGSIZE, save_plot


Expand Down Expand Up @@ -42,7 +41,11 @@ def plot(ctx):
makedirs(ELASTIC_PLOTS_DIR, exist_ok=True)
fig, ax = subplots(figsize=SINGLE_COL_FIGSIZE)

assert len(results["elastic"]) == len(results["no-elastic"]), "Results mismatch! (elastic: {} - no-elastic: {})".format(len(results["elastic"]), len(results["no-elastic"]))
assert len(results["elastic"]) == len(
results["no-elastic"]
), "Results mismatch! (elastic: {} - no-elastic: {})".format(
len(results["elastic"]), len(results["no-elastic"])
)

xs = list(results["elastic"].keys())
ys = [
Expand Down
7 changes: 5 additions & 2 deletions tasks/elastic/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,16 @@ def wasm(ctx, num_threads=None, elastic=False, repeats=1):

reset_planner(num_vms)

csv_name = "openmp_{}_granny.csv".format("elastic" if elastic else "no-elastic")
csv_name = "openmp_{}_granny.csv".format(
"elastic" if elastic else "no-elastic"
)
_init_csv_file(csv_name)

for nthread in num_threads:
for r in range(int(repeats)):
print(
"Running OpenMP elastic experiment with {} threads (elastic: {} - repeat: {}/{})".format(
"Running OpenMP elastic experiment with {} threads"
" (elastic: {} - repeat: {}/{})".format(
nthread, elastic, r + 1, repeats
)
)
Expand Down
14 changes: 8 additions & 6 deletions tasks/elastic/wasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ def upload(ctx):
"""
Upload the OpenMP functions to Granny
"""
wasm_file_details = [{
"wasm_file": OPENMP_ELASTIC_WASM,
"wasm_user": OPENMP_ELASTIC_USER,
"wasm_function": OPENMP_ELASTIC_FUNCTION,
"copies": 1,
}]
wasm_file_details = [
{
"wasm_file": OPENMP_ELASTIC_WASM,
"wasm_user": OPENMP_ELASTIC_USER,
"wasm_function": OPENMP_ELASTIC_FUNCTION,
"copies": 1,
}
]

upload_wasm(wasm_file_details)
4 changes: 3 additions & 1 deletion tasks/kernels_omp/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def wasm(ctx, kernel=None, num_threads=None, repeats=1):
"singleHostHint": True,
}

result_json = post_async_msg_and_get_result_json(msg, req_dict=req)
result_json = post_async_msg_and_get_result_json(
msg, req_dict=req
)
actual_time = get_faasm_exec_time_from_json(
result_json, check=True
)
Expand Down
65 changes: 25 additions & 40 deletions tasks/makespan/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
read_elastic_results,
)
from tasks.util.eviction import (
read_eviction_results,
plot_eviction_results,
read_eviction_results,
plot_eviction_results,
)

# TODO: consider moving some of the migration to a different file (e.g.
# tasks.util.locality)
from tasks.util.makespan import (
Expand Down Expand Up @@ -98,55 +99,36 @@ def locality(ctx):
# Plot 1: boxplot of idle vCPUs and num xVM links for various cluster sizes
# ----------

do_makespan_plot(
"percentage_vcpus",
results,
ax1,
num_vms,
num_tasks
)
do_makespan_plot("percentage_vcpus", results, ax1, num_vms, num_tasks)

do_makespan_plot(
"percentage_xvm",
results,
ax2,
num_vms,
num_tasks
)
do_makespan_plot("percentage_xvm", results, ax2, num_vms, num_tasks)

# ----------
# Plot 2: (two) timeseries of one of the cluster sizes
# ----------

do_makespan_plot(
"ts_vcpus",
results,
ax3,
timeseries_num_vms,
timeseries_num_tasks
"ts_vcpus", results, ax3, timeseries_num_vms, timeseries_num_tasks
)

do_makespan_plot(
"ts_xvm_links",
results,
ax4,
timeseries_num_vms,
timeseries_num_tasks
"ts_xvm_links", results, ax4, timeseries_num_vms, timeseries_num_tasks
)

# Manually craft the legend
baselines = ["slurm", "batch", "granny", "granny-migrate"]
legend_entries = [
Patch(
color=get_color_for_baseline("mpi-migrate", baseline),
label=get_label_for_baseline("mpi-migrate", baseline)
) for baseline in baselines
label=get_label_for_baseline("mpi-migrate", baseline),
)
for baseline in baselines
]
fig.legend(
handles=legend_entries,
loc="upper center",
ncols=len(baselines),
bbox_to_anchor=(0.52, 1.07)
bbox_to_anchor=(0.52, 1.07),
)

save_plot(fig, MAKESPAN_PLOTS_DIR, "makespan_locality")
Expand All @@ -173,10 +155,11 @@ def eviction(ctx):

results = {}
for (n_vms, n_users, n_tasks) in zip(num_vms, num_users, num_tasks):
results[n_vms] = read_eviction_results(n_vms, n_users, n_tasks, num_cpus_per_vm)
results[n_vms] = read_eviction_results(
n_vms, n_users, n_tasks, num_cpus_per_vm
)

fig, ax = subplot_mosaic([['left', 'right'],
['left', 'right']])
fig, ax = subplot_mosaic([["left", "right"], ["left", "right"]])

# ----------
# Plot 1: bar plot of the CPUsecs per execution
Expand Down Expand Up @@ -254,14 +237,15 @@ def spot(ctx):
legend_entries = [
Patch(
color=get_color_for_baseline("mpi-spot", baseline),
label=get_label_for_baseline("mpi-spot", baseline)
) for baseline in baselines
label=get_label_for_baseline("mpi-spot", baseline),
)
for baseline in baselines
]
fig.legend(
handles=legend_entries,
loc="upper center",
ncols=len(baselines),
bbox_to_anchor=(0.52, 1.07)
bbox_to_anchor=(0.52, 1.07),
)

save_plot(fig, MAKESPAN_PLOTS_DIR, "makespan_spot")
Expand Down Expand Up @@ -330,7 +314,7 @@ def elastic(ctx):
results,
ax3,
cdf_num_vms=cdf_num_vms,
cdf_num_tasks=cdf_num_tasks
cdf_num_tasks=cdf_num_tasks,
)

# ----------
Expand All @@ -342,22 +326,23 @@ def elastic(ctx):
results,
ax4,
timeseries_num_vms=timeseries_num_vms,
timeseries_num_tasks=timeseries_num_tasks
timeseries_num_tasks=timeseries_num_tasks,
)

# Manually craft the legend
baselines = ["slurm", "batch", "granny", "granny-elastic"]
legend_entries = [
Patch(
color=get_color_for_baseline("omp-elastic", baseline),
label=get_label_for_baseline("omp-elastic", baseline)
) for baseline in baselines
label=get_label_for_baseline("omp-elastic", baseline),
)
for baseline in baselines
]
fig.legend(
handles=legend_entries,
loc="upper center",
ncols=len(baselines),
bbox_to_anchor=(0.52, 1.07)
bbox_to_anchor=(0.52, 1.07),
)

save_plot(fig, MAKESPAN_PLOTS_DIR, "makespan_elastic")
14 changes: 10 additions & 4 deletions tasks/makespan/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
write_line_to_csv,
)
from tasks.util.trace import load_task_trace_from_file
from time import sleep, time
from time import time
from typing import Dict

# Configure the logging settings globally
Expand Down Expand Up @@ -67,13 +67,19 @@ def granny(
# Work-out the baseline name from the arguments
baseline = "granny"
if migrate:
assert workload == "mpi-migrate", "--migrate flag should only be used with mpi-migrate workload!"
assert (
workload == "mpi-migrate"
), "--migrate flag should only be used with mpi-migrate workload!"
baseline = "granny-migrate"
if fault:
assert workload == "mpi-spot", "--fault flag should only be used with mpi-spot workload!"
assert (
workload == "mpi-spot"
), "--fault flag should only be used with mpi-spot workload!"
baseline = "granny-ft"
if elastic:
assert workload == "omp-elastic", "--fault flag should only be used with omp-elastic workload!"
assert (
workload == "omp-elastic"
), "--fault flag should only be used with omp-elastic workload!"
baseline = "granny-elastic"

workload = _get_workload_from_cmdline(workload)
Expand Down
Loading

0 comments on commit 79c5ae1

Please sign in to comment.