Skip to content

Commit

Permalink
Fix binary variants to use true, false (#441)
Browse files Browse the repository at this point in the history
Co-authored-by: Riyaz Haque <[email protected]>
  • Loading branch information
rfhaque and Riyaz Haque authored Nov 20, 2024
1 parent b721a51 commit f359d5c
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
16 changes: 8 additions & 8 deletions experiments/amg2023/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -73,15 +73,15 @@ 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():
self.add_experiment_variable(pk, pv, True)
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)
Expand All @@ -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]),
Expand All @@ -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())},
Expand Down
12 changes: 6 additions & 6 deletions experiments/ior/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]),
Expand All @@ -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())},
Expand Down
16 changes: 8 additions & 8 deletions experiments/kripke/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -67,15 +67,15 @@ 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():
self.add_experiment_variable(pk, pv, True)
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)
Expand All @@ -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]),
Expand All @@ -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())},
Expand Down
8 changes: 4 additions & 4 deletions experiments/laghos/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]),
Expand Down
20 changes: 9 additions & 11 deletions experiments/quicksilver/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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")
Expand Down
5 changes: 2 additions & 3 deletions lib/benchpark/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
15 changes: 6 additions & 9 deletions lib/benchpark/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ def scale_experiment_variables(
class StrongScaling(Scaling):
variant(
"strong",
default="non",
values=("oui", "non"),
default=False,
description="Strong scaling",
)

Expand All @@ -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",
)

Expand All @@ -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",
)

Expand All @@ -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 ""

0 comments on commit f359d5c

Please sign in to comment.