From f359d5cb2b62d6c9eefca554a4a0777df77e8d16 Mon Sep 17 00:00:00 2001 From: Riyaz Haque <5333387+rfhaque@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:22:28 -0800 Subject: [PATCH] Fix binary variants to use true, false (#441) Co-authored-by: Riyaz Haque --- .github/workflows/run.yml | 2 +- experiments/amg2023/experiment.py | 16 ++++++++-------- experiments/ior/experiment.py | 12 ++++++------ experiments/kripke/experiment.py | 16 ++++++++-------- experiments/laghos/experiment.py | 8 ++++---- experiments/quicksilver/experiment.py | 20 +++++++++----------- lib/benchpark/experiment.py | 5 ++--- lib/benchpark/scaling.py | 15 ++++++--------- 8 files changed, 44 insertions(+), 50 deletions(-) diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index d068f842..fbab23c3 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -262,7 +262,7 @@ jobs: - name: Dry run dynamic quicksilver-openmp on nosite-x86_64 with allocation modifier run: | - ./bin/benchpark experiment init --dest=quicksilver-openmp quicksilver+openmp experiment=weak + ./bin/benchpark experiment init --dest=quicksilver-openmp quicksilver+openmp +weak~single_node ./bin/benchpark setup ./quicksilver-openmp nosite-x86_64 workspace/ . workspace/setup.sh ramble \ diff --git a/experiments/amg2023/experiment.py b/experiments/amg2023/experiment.py index 37abeeae..d4ef2666 100644 --- a/experiments/amg2023/experiment.py +++ b/experiments/amg2023/experiment.py @@ -55,10 +55,10 @@ class Amg2023( def compute_applications_section(self): # TODO: Replace with conflicts clause scaling_modes = { - "strong": self.spec.satisfies("strong=oui"), - "weak": self.spec.satisfies("weak=oui"), - "throughput": self.spec.satisfies("throughput=oui"), - "single_node": self.spec.satisfies("single_node=oui"), + "strong": self.spec.satisfies("+strong"), + "weak": self.spec.satisfies("+weak"), + "throughput": self.spec.satisfies("+throughput"), + "single_node": self.spec.satisfies("+single_node"), } scaling_mode_enabled = [key for key, value in scaling_modes.items() if value] @@ -73,7 +73,7 @@ def compute_applications_section(self): # Per-process size (in zones) in each dimension problem_sizes = {"nx": 80, "ny": 80, "nz": 80} - if self.spec.satisfies("single_node=oui"): + if self.spec.satisfies("+single_node"): n_resources = 1 # TODO: Check if n_ranks / n_resources_per_node <= 1 for pk, pv in num_procs.items(): @@ -81,7 +81,7 @@ def compute_applications_section(self): n_resources *= pv for nk, nv in problem_sizes.items(): self.add_experiment_variable(nk, nv, True) - elif self.spec.satisfies("throughput=oui"): + elif self.spec.satisfies("+throughput"): n_resources = 1 for pk, pv in num_procs.items(): self.add_experiment_variable(pk, pv, True) @@ -93,7 +93,7 @@ def compute_applications_section(self): ) for nk, nv in scaled_variables.items(): self.add_experiment_variable(nk, nv, True) - elif self.spec.satisfies("strong=oui"): + elif self.spec.satisfies("+strong"): scaled_variables = self.generate_strong_scaling_params( {tuple(num_procs.keys()): list(num_procs.values())}, int(self.spec.variants["scaling-factor"][0]), @@ -109,7 +109,7 @@ def compute_applications_section(self): ] for nk, nv in problem_sizes.items(): self.add_experiment_variable(nk, nv, True) - elif self.spec.satisfies("weak=oui"): + elif self.spec.satisfies("+weak"): scaled_variables = self.generate_weak_scaling_params( {tuple(num_procs.keys()): list(num_procs.values())}, {tuple(problem_sizes.keys()): list(problem_sizes.values())}, diff --git a/experiments/ior/experiment.py b/experiments/ior/experiment.py index 4345571f..871e16a4 100644 --- a/experiments/ior/experiment.py +++ b/experiments/ior/experiment.py @@ -30,9 +30,9 @@ class Ior( def compute_applications_section(self): # TODO: Replace with conflicts clause scaling_modes = { - "strong": self.spec.satisfies("strong=oui"), - "weak": self.spec.satisfies("weak=oui"), - "single_node": self.spec.satisfies("single_node=oui"), + "strong": self.spec.satisfies("+strong"), + "weak": self.spec.satisfies("+weak"), + "single_node": self.spec.satisfies("+single_node"), } scaling_mode_enabled = [key for key, value in scaling_modes.items() if value] @@ -45,11 +45,11 @@ def compute_applications_section(self): t = "{b}/256" self.add_experiment_variable("t", t, True) - if self.spec.satisfies("single_node=oui"): + if self.spec.satisfies("+single_node"): for pk, pv in num_nodes.items(): self.add_experiment_variable(pk, pv, True) self.add_experiment_variable("b", "268435456", True) - elif self.spec.satisfies("strong=oui"): + elif self.spec.satisfies("+strong"): scaled_variables = self.generate_strong_scaling_params( {tuple(num_nodes.keys()): list(num_nodes.values())}, int(self.spec.variants["scaling-factor"][0]), @@ -59,7 +59,7 @@ def compute_applications_section(self): self.add_experiment_variable(k, v, True) # 256 mb self.add_experiment_variable("b", "268435456 / {n_nodes}", True) - elif self.spec.satisfies("weak=oui"): + elif self.spec.satisfies("+weak"): scaled_variables = self.generate_weak_scaling_params( {tuple(num_nodes.keys()): list(num_nodes.values())}, {tuple(num_nodes.keys()): list(num_nodes.values())}, diff --git a/experiments/kripke/experiment.py b/experiments/kripke/experiment.py index 5f401d05..94d59efa 100644 --- a/experiments/kripke/experiment.py +++ b/experiments/kripke/experiment.py @@ -38,10 +38,10 @@ class Kripke( def compute_applications_section(self): # TODO: Replace with conflicts clause scaling_modes = { - "strong": self.spec.satisfies("strong=oui"), - "weak": self.spec.satisfies("weak=oui"), - "throughput": self.spec.satisfies("throughput=oui"), - "single_node": self.spec.satisfies("single_node=oui"), + "strong": self.spec.satisfies("+strong"), + "weak": self.spec.satisfies("+weak"), + "throughput": self.spec.satisfies("+throughput"), + "single_node": self.spec.satisfies("+single_node"), } scaling_mode_enabled = [key for key, value in scaling_modes.items() if value] @@ -67,7 +67,7 @@ def compute_applications_section(self): for k, v in input_variables.items(): self.add_experiment_variable(k, v, True) - if self.spec.satisfies("single_node=oui"): + if self.spec.satisfies("+single_node"): n_resources = 1 # TODO: Check if n_ranks / n_resources_per_node <= 1 for pk, pv in num_procs.items(): @@ -75,7 +75,7 @@ def compute_applications_section(self): n_resources *= pv for nk, nv in problem_sizes.items(): self.add_experiment_variable(nk, nv, True) - elif self.spec.satisfies("throughput=oui"): + elif self.spec.satisfies("+throughput"): n_resources = 1 for pk, pv in num_procs.items(): self.add_experiment_variable(pk, pv, True) @@ -87,7 +87,7 @@ def compute_applications_section(self): ) for nk, nv in scaled_variables.items(): self.add_experiment_variable(nk, nv, True) - elif self.spec.satisfies("strong=oui"): + elif self.spec.satisfies("+strong"): scaled_variables = self.generate_strong_scaling_params( {tuple(num_procs.keys()): list(num_procs.values())}, int(self.spec.variants["scaling-factor"][0]), @@ -103,7 +103,7 @@ def compute_applications_section(self): ] for nk, nv in problem_sizes.items(): self.add_experiment_variable(nk, nv, True) - elif self.spec.satisfies("weak=oui"): + elif self.spec.satisfies("+weak"): scaled_variables = self.generate_weak_scaling_params( {tuple(num_procs.keys()): list(num_procs.values())}, {tuple(problem_sizes.keys()): list(problem_sizes.values())}, diff --git a/experiments/laghos/experiment.py b/experiments/laghos/experiment.py index ec4b8d7e..68f39079 100644 --- a/experiments/laghos/experiment.py +++ b/experiments/laghos/experiment.py @@ -31,8 +31,8 @@ class Laghos( def compute_applications_section(self): # TODO: Replace with conflicts clause scaling_modes = { - "strong": self.spec.satisfies("strong=oui"), - "single_node": self.spec.satisfies("single_node=oui"), + "strong": self.spec.satisfies("+strong"), + "single_node": self.spec.satisfies("+single_node"), } scaling_mode_enabled = [key for key, value in scaling_modes.items() if value] @@ -44,10 +44,10 @@ def compute_applications_section(self): # Number of initial nodes num_nodes = {"n_nodes": 1} - if self.spec.satisfies("single_node=oui"): + if self.spec.satisfies("+single_node"): for pk, pv in num_nodes.items(): self.add_experiment_variable(pk, pv, True) - elif self.spec.satisfies("strong=oui"): + elif self.spec.satisfies("+strong"): scaled_variables = self.generate_strong_scaling_params( {tuple(num_nodes.keys()): list(num_nodes.values())}, int(self.spec.variants["scaling-factor"][0]), diff --git a/experiments/quicksilver/experiment.py b/experiments/quicksilver/experiment.py index 8f50072e..8614a6b7 100644 --- a/experiments/quicksilver/experiment.py +++ b/experiments/quicksilver/experiment.py @@ -6,22 +6,22 @@ from benchpark.directives import variant from benchpark.experiment import Experiment from benchpark.openmp import OpenMPExperiment +from benchpark.scaling import StrongScaling +from benchpark.scaling import WeakScaling -class Quicksilver(Experiment, OpenMPExperiment): +class Quicksilver( + Experiment, + OpenMPExperiment, + StrongScaling, + WeakScaling, +): variant( "workload", default="quicksilver", description="quicksilver", ) - variant( - "experiment", - default="weak", - values=("weak", "strong"), - description="weak or strong scaling", - ) - variant( "version", default="master", @@ -35,13 +35,11 @@ def compute_applications_section(self): self.add_experiment_variable("x", "{X}") self.add_experiment_variable("y", "{Y}") self.add_experiment_variable("z", "{Z}") - if self.spec.satisfies("scaling=weak"): - self.add_experiment_name_prefix("weak") + if self.spec.satisfies("+weak"): self.add_experiment_variable("X", ["32", "32", "64", "64"]) self.add_experiment_variable("Y", ["32", "32", "32", "64"]) self.add_experiment_variable("Z", ["16", "32", "32", "32"]) else: - self.add_experiment_name_prefix("strong") self.add_experiment_variable("X", "32") self.add_experiment_variable("Y", "32") self.add_experiment_variable("Z", "16") diff --git a/lib/benchpark/experiment.py b/lib/benchpark/experiment.py index 2d7268e2..5b4227e4 100644 --- a/lib/benchpark/experiment.py +++ b/lib/benchpark/experiment.py @@ -51,14 +51,13 @@ def get_spack_variants(self): class SingleNode: variant( "single_node", - default="oui", - values=("oui", "non"), + default=True, description="Single node execution mode", ) class Helper(ExperimentHelper): def get_helper_name_prefix(self): - return "single_node" if self.spec.satisfies("single_node=oui") else "" + return "single_node" if self.spec.satisfies("+single_node") else "" class Experiment(ExperimentSystemBase, SingleNode): diff --git a/lib/benchpark/scaling.py b/lib/benchpark/scaling.py index 0ca8d297..29408520 100644 --- a/lib/benchpark/scaling.py +++ b/lib/benchpark/scaling.py @@ -156,8 +156,7 @@ def scale_experiment_variables( class StrongScaling(Scaling): variant( "strong", - default="non", - values=("oui", "non"), + default=False, description="Strong scaling", ) @@ -170,14 +169,13 @@ def generate_strong_scaling_params( class Helper(ExperimentHelper): def get_helper_name_prefix(self): - return "strong_scaling" if self.spec.satisfies("strong=oui") else "" + return "strong_scaling" if self.spec.satisfies("+strong") else "" class WeakScaling(Scaling): variant( "weak", - default="non", - values=("oui", "non"), + default=False, description="Weak scaling", ) @@ -194,14 +192,13 @@ def generate_weak_scaling_params( class Helper(ExperimentHelper): def get_helper_name_prefix(self): - return "weak_scaling" if self.spec.satisfies("weak=oui") else "" + return "weak_scaling" if self.spec.satisfies("+weak") else "" class ThroughputScaling(Scaling): variant( "throughput", - default="non", - values=("oui", "non"), + default=False, description="Throughput scaling", ) @@ -214,4 +211,4 @@ def generate_throughput_scaling_params( class Helper(ExperimentHelper): def get_helper_name_prefix(self): - return "throughput_scaling" if self.spec.satisfies("throughput=oui") else "" + return "throughput_scaling" if self.spec.satisfies("+throughput") else ""