Skip to content

Commit

Permalink
Adding single node experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
pearce8 authored Oct 22, 2024
1 parent 0907116 commit afb5d9f
Showing 1 changed file with 38 additions and 41 deletions.
79 changes: 38 additions & 41 deletions var/exp_repo/experiments/amg2023/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class Amg2023(Experiment):
)

variant(
"experiment",
default="throughput",
values=("strong", "weak", "throughput"),
description="type of experiment",
"scaling",
default="single-node",
values=("single-node", "weak", "strong", "throughput"),
description="Single node, weak scaling, strong scaling, or throughput study",
)

def compute_applications_section(self):
Expand All @@ -44,14 +44,17 @@ def compute_applications_section(self):
variables = {}
variables["n_ranks"] = num_procs

# TODO: Use conditional variants
# TODO: Implement supports for matrices, zips and excludes
# TODO: Check for target system using programming_model mixin
if self.spec.satisfies("programming_model=openmp"):
variables["arch"] = "OpenMP"
variables["n_ranks"] = num_procs
variables["n_threads_per_proc"] = 1
n_resources = "{n_ranks}_{n_threads_per_proc}"
elif self.spec.satisfies("programming_model=cuda") or
self.spec.satisfies("programming_model=rocm"):
elif self.spec.satisfies("programming_model=cuda"):
variables["arch"] = "CUDA"
variables["n_gpus"] = num_procs
n_resources = "{n_gpus}"
elif self.spec.satisfies("programming_model=rocm"):
variables["arch"] = "HIP"
variables["n_gpus"] = num_procs
n_resources = "{n_gpus}"

Expand All @@ -61,16 +64,10 @@ def compute_applications_section(self):
experiment_setup["variants"] = {"package_manager": "spack"}

# Number of processes in each dimension
initial_p = [2, 2, 2]
variables[px] = initial_p[0]
variables[py] = initial_p[1]
variables[pz] = initial_p[2]
initial_p = [2, 2, 2]

# Per-process size (in zones) in each dimension
initial_n = [80, 80, 80]
variables[nx] = initial_n[0]
variables[ny] = initial_n[1]
variables[nz] = initial_n[2]

# TODO: Please explain the zips here. Can we just declare this as a vector to begin with?
zips_size = "size"
Expand All @@ -86,40 +83,40 @@ def compute_applications_section(self):
]
}
]
# TODO: We should use the allocation modifier to check for an unsatisfiable request for resources instead of here
# experiment_setup["exclude"] = {
# "where": [
# "{n_threads_per_proc} * {n_ranks} > {n_nodes} * {sys_cores_per_node}"
# ]
#}
elif self.spec.satisfies("programming_model=cuda") or self.spec.satisfies("programming_model=rocm"):
experiment_setup["matrix"] = [f"{zips_size}"]

# TODO: Is there an order these code blocks need to be in?
# Can the programming model part be completely separate from the scaling part?
input_params = {}
if self.spec.satisfies("experiment=throughput"):
if self.spec.satisfies("scaling=single-node"):
variables[px] = initial_p[0]
variables[py] = initial_p[1]
variables[pz] = initial_p[2]
scaling_variable = (nx, ny, nz)
input_params[scaling_variable] = initial_n
elif self.spec.satisfies("experiment=strong"):
scaling_variable = (px, py, pz)
input_params[scaling_variable] = initial_p
variables[nx] = initial_n[0]
variables[ny] = initial_n[1]
variables[nz] = initial_n[2]
elif self.spec.satisfies("experiment=weak"):
scaling_variable = (px, py, pz)
input_params[scaling_variable] = initial_p
input_params[(nx, ny, nz)] = initial_n
variables |= self.scale_experiment_variables(
input_params,
int(self.spec.variants["scaling-factor"][0]),
int(self.spec.variants["scaling-iterations"][0]),
scaling_variable,
)
else: # A scaling study
input_params = {}
if self.spec.satisfies("scaling=throughput"):
variables[px] = initial_p[0]
variables[py] = initial_p[1]
variables[pz] = initial_p[2]
scaling_variable = (nx, ny, nz)
input_params[scaling_variable] = initial_n
elif self.spec.satisfies("scaling=strong"):
scaling_variable = (px, py, pz)
input_params[scaling_variable] = initial_p
variables[nx] = initial_n[0]
variables[ny] = initial_n[1]
variables[nz] = initial_n[2]
elif self.spec.satisfies("scaling=weak"):
scaling_variable = (px, py, pz)
input_params[scaling_variable] = initial_p
input_params[(nx, ny, nz)] = initial_n
variables |= self.scale_scaling_variables(
input_params,
int(self.spec.variants["scaling-factor"][0]),
int(self.spec.variants["scaling-iterations"][0]),
scaling_variable,
)

# TODO: Add explanation
experiment_setup["variables"] = variables
Expand Down

0 comments on commit afb5d9f

Please sign in to comment.