Skip to content

Commit 6cfa837

Browse files
rfhaqueRiyaz Haquepearce8
authored
laghos changes (#1138)
* Changes to laghos * Changes * enable caliper blocks in laghos source * laghos input params * Update git url to main repo * Use fixed number of time steps * Increase end time so that code runs for max steps * Add weak scaling * Fix weak scaling params * lint * Add support for nonconforming meshes * Default nonconforming true * Fixes * Change parallel refinement value * Add throughput configs for different orders * Add rocm-6.4.3 * Add sedov workload * lint * cuda fixes * Update .codespellignore --------- Co-authored-by: Riyaz Haque <[email protected]> Co-authored-by: pearce8 <[email protected]>
1 parent a440f1a commit 6cfa837

File tree

7 files changed

+274
-47
lines changed

7 files changed

+274
-47
lines changed

.codespellignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
cachable
2-
parma
2+
ot
3+
parma

experiments/laghos/experiment.py

Lines changed: 164 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@ class Laghos(
1717
MpiOnlyExperiment,
1818
CudaExperiment,
1919
ROCmExperiment,
20-
Scaling(ScalingMode.Strong),
20+
Scaling(ScalingMode.Strong, ScalingMode.Weak, ScalingMode.Throughput),
2121
Caliper,
2222
):
2323

2424
variant(
2525
"workload",
26-
default="triplept",
27-
description="triplept or other problem",
26+
default="sedov",
27+
values=("sedov", "triplept"),
28+
description="problem type",
29+
)
30+
31+
variant(
32+
"order",
33+
default="linear",
34+
values=("linear", "quadratic", "cubic"),
35+
description="solution order",
2836
)
2937

3038
variant(
@@ -40,38 +48,172 @@ class Laghos(
4048
description="Use GPU-aware MPI",
4149
)
4250

51+
variant(
52+
"nc",
53+
default=False,
54+
values=(True, False),
55+
description="nonconforming or conforming",
56+
)
57+
4358
maintainers("wdhawkins")
4459

45-
def compute_applications_section(self):
46-
# "zones" defined from mesh file, we are hardcoding it here
47-
self.add_experiment_variable("nx", 2, True)
48-
self.add_experiment_variable("ny", 2, True)
49-
self.add_experiment_variable("nz", 2, True)
50-
self.add_experiment_variable("tf", 0.0033, True)
51-
self.add_experiment_variable("zones", 1024, True)
60+
def generate_perf_specs(self):
61+
problem_spec = {
62+
"nx": 1,
63+
"ny": 1,
64+
"nz": 1,
65+
"pool_size": 16,
66+
"ms": 250,
67+
"tf": 10000,
68+
"resource_count": 4,
69+
"strong": None,
70+
"weak": None,
71+
"throughput": None,
72+
}
73+
# Add problem specs as needed here
74+
if self.spec.satisfies("+throughput"):
75+
if self.spec.satisfies("order=linear"):
76+
problem_spec["rs"] = [4, 4, 4]
77+
problem_spec["rp"] = [2, 3, 4]
78+
elif self.spec.satisfies("order=quadratic"):
79+
problem_spec["rs"] = [4, 4, 4]
80+
problem_spec["rp"] = [1, 2, 3]
81+
elif self.spec.satisfies("order=cubic"):
82+
problem_spec["rs"] = [4, 4, 4]
83+
problem_spec["rp"] = [1, 2, 3]
84+
elif self.spec.satisfies("+strong"):
85+
problem_spec["strong"] = (
86+
lambda var, itr, dim, scaling_factor: var.val(dim) * scaling_factor
87+
)
88+
if self.spec.satisfies("order=linear"):
89+
problem_spec["rs"] = 4
90+
problem_spec["rp"] = 3
91+
elif self.spec.satisfies("order=quadratic"):
92+
problem_spec["rs"] = 4
93+
problem_spec["rp"] = 2
94+
elif self.spec.satisfies("order=cubic"):
95+
problem_spec["rs"] = 4
96+
problem_spec["rp"] = 1
97+
elif self.spec.satisfies("+weak"):
98+
problem_spec["nx"] = [1, 2, 3, 4, 5, 6]
99+
problem_spec["ny"] = [1, 2, 3, 4, 5, 6]
100+
problem_spec["nz"] = [1, 2, 3, 4, 5, 6]
101+
problem_spec["resource_count"] = [4, 32, 108, 256, 500, 864]
102+
if self.spec.satisfies("order=linear"):
103+
problem_spec["rs"] = 4
104+
problem_spec["rp"] = 3
105+
elif self.spec.satisfies("order=quadratic"):
106+
problem_spec["rs"] = 4
107+
problem_spec["rp"] = 2
108+
elif self.spec.satisfies("order=cubic"):
109+
problem_spec["rs"] = 4
110+
problem_spec["rp"] = 1
111+
else:
112+
problem_spec["rs"] = 4
113+
problem_spec["rp"] = 1
52114

53-
# resource_count is the number of resources used for this experiment:
54-
self.add_experiment_variable("resource_count", 1, False)
115+
self.add_experiment_variable("nx", problem_spec["nx"], True)
116+
self.add_experiment_variable("ny", problem_spec["ny"], True)
117+
self.add_experiment_variable("nz", problem_spec["nz"], True)
118+
self.add_experiment_variable("rs", problem_spec["rs"], True)
119+
self.add_experiment_variable("rp", problem_spec["rp"], True)
120+
self.add_experiment_variable("ms", problem_spec["ms"], True)
121+
self.add_experiment_variable("tf", problem_spec["tf"], True)
55122

56-
# Set the variables required by the experiment
57-
self.set_required_variables(
58-
n_resources="{resource_count}",
59-
process_problem_size="{zones} / {n_resources}",
60-
total_problem_size="{zones}",
123+
self.add_experiment_variable(
124+
"resource_count", problem_spec["resource_count"], True
61125
)
62126

63-
# Register the scaling variables and their respective scaling functions
64-
# required to correctly scale the experiment for the given scaliing policy
65-
# Strong scaling scales up resource_count by the specified scaling_factor
127+
# Per-process size (in zones) in each dimension
128+
self.add_experiment_variable("zones", "{nx}*{ny}*{nz}*(8**({rs}+{rp}))", False)
129+
130+
# Umpire device pool size
131+
self.add_experiment_variable("pool", problem_spec["pool_size"], False)
132+
66133
self.register_scaling_config(
67134
{
68135
ScalingMode.Strong: {
69-
"resource_count": lambda var, itr, dim, scaling_factor: var.val(dim)
70-
* scaling_factor,
136+
"resource_count": problem_spec["strong"],
137+
},
138+
ScalingMode.Weak: {
139+
"resource_count": problem_spec["weak"],
140+
},
141+
ScalingMode.Throughput: {
142+
"resource_count": problem_spec["throughput"],
71143
},
72144
}
73145
)
74146

147+
def compute_applications_section(self):
148+
if self.spec.satisfies("exec_mode=perf"):
149+
self.generate_perf_specs()
150+
else:
151+
# "zones" defined from mesh file, we are hardcoding it here
152+
self.add_experiment_variable("nx", 1, True)
153+
self.add_experiment_variable("ny", 1, True)
154+
self.add_experiment_variable("nz", 1, True)
155+
self.add_experiment_variable("rs", 3, True)
156+
self.add_experiment_variable("rp", 2, True)
157+
self.add_experiment_variable("ms", 250, True)
158+
self.add_experiment_variable("tf", 10000, True)
159+
self.add_experiment_variable(
160+
"zones", "{nx}*{ny}*{nz}*(8**({rs}+{rp}))", False
161+
)
162+
self.add_experiment_variable("pool", 16, True)
163+
# resource_count is the number of resources used for this experiment:
164+
self.add_experiment_variable("resource_count", 1, False)
165+
166+
# Register the scaling variables and their respective scaling functions
167+
# required to correctly scale the experiment for the given scaliing policy
168+
# Strong scaling scales up resource_count by the specified scaling_factor
169+
self.register_scaling_config(
170+
{
171+
ScalingMode.Strong: {
172+
"resource_count": lambda var, itr, dim, scaling_factor: var.val(
173+
dim
174+
)
175+
* scaling_factor,
176+
},
177+
ScalingMode.Weak: {
178+
"resource_count": None,
179+
},
180+
ScalingMode.Throughput: {
181+
"resource_count": None,
182+
},
183+
}
184+
)
185+
186+
if self.spec.satisfies("order=linear"):
187+
self.add_experiment_variable("order", "linear", True)
188+
self.add_experiment_variable("ok", 1, False)
189+
self.add_experiment_variable("ot", 0, False)
190+
elif self.spec.satisfies("order=quadratic"):
191+
self.add_experiment_variable("order", "quadratic", True)
192+
self.add_experiment_variable("ok", 2, False)
193+
self.add_experiment_variable("ot", 1, False)
194+
elif self.spec.satisfies("order=cubic"):
195+
self.add_experiment_variable("order", "cubic", True)
196+
self.add_experiment_variable("ok", 3, False)
197+
self.add_experiment_variable("ot", 2, False)
198+
else:
199+
self.add_experiment_variable("order", "linear", True)
200+
self.add_experiment_variable("ok", 1, False)
201+
self.add_experiment_variable("ot", 0, False)
202+
203+
if self.spec.satisfies("+nc"):
204+
self.add_experiment_variable("nc_type", "nonconforming", True)
205+
self.add_experiment_variable("nc", "-nc", False)
206+
else:
207+
self.add_experiment_variable("nc_type", "conforming", True)
208+
self.add_experiment_variable("nc", "-no-nc", False)
209+
210+
# Set the variables required by the experiment
211+
self.set_required_variables(
212+
n_resources="{resource_count}",
213+
process_problem_size="{zones} / {n_resources}",
214+
total_problem_size="{zones}",
215+
)
216+
75217
if self.spec.satisfies("+cuda"):
76218
self.add_experiment_variable("device", "cuda", True)
77219
elif self.spec.satisfies("+rocm"):

lib/benchpark/scaling.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,10 @@ def scale_params(self, scaling_config):
126126
for itr in range(num_exprs):
127127
dim = (start_dim + itr) % ndims
128128
for var_name, scaling_func in scaling_config.items():
129-
getattr(self.expr_vars, var_name).scale_dim(
130-
itr, dim, scaling_func, scaling_factor
131-
)
129+
if scaling_func:
130+
getattr(self.expr_vars, var_name).scale_dim(
131+
itr, dim, scaling_func, scaling_factor
132+
)
132133

133134
BaseScaling.scale_params = scale_params
134135

lib/benchpark/variables.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,19 @@ def val(self, key):
151151

152152
def scale_dim(self, itr, dim, scaling_func, sf):
153153
key = self._dims[0] if self.ndims == 1 else self._dims[dim]
154-
for k in self._dims:
155-
if k == key:
156-
self._var[k].append(scaling_func(self, itr, k, sf))
157-
else:
158-
self._var[k].append(self.val(k))
154+
155+
next_val = scaling_func(self, itr, key, sf)
156+
157+
if not next_val:
158+
return
159+
elif isinstance(next_val, list):
160+
idx = 0
161+
for k in self._dims:
162+
self._var[k].append(next_val[idx])
163+
idx += 1
164+
else:
165+
for k in self._dims:
166+
if k == key:
167+
self._var[k].append(scaling_func(self, itr, k, sf))
168+
else:
169+
self._var[k].append(self.val(k))

repo/laghos/application.py

Lines changed: 60 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,57 +19,102 @@ class Laghos(ExecutableApplication):
1919
'lagrangian','spatial-discretization','unstructured-grid',
2020
'network-latency-bound','network-collectives','unstructured-grid']
2121

22-
executable('prob', 'laghos -p {problem} -m {mesh} -nx {nx} -ny {ny} -nz {nz} -rs {rs} -rp {rp} -ms {ms} --fom {gam} -d {device} {assembly} -tf {tf}', use_mpi=True)
22+
executable('triplept', 'laghos' +
23+
' -p 3' +
24+
' -m {mesh}' +
25+
' -nx {nx} -ny {ny} -nz {nz}' +
26+
' -rs {rs} -rp {rp}' +
27+
' -ms {ms}' +
28+
' -ok {ok} -ot {ot} -oq {oq}' +
29+
' {nc} --mem --fom {gam}' +
30+
' --dev-pool-size {pool}' +
31+
' -d {device}' +
32+
' {assembly}',
33+
use_mpi=True)
2334

24-
workload('triplept', executables=['prob'])
35+
executable('sedov', 'laghos' +
36+
' -p 1' +
37+
' -m {mesh}' +
38+
' -nx {nx} -ny {ny} -nz {nz}' +
39+
' -rs {rs} -rp {rp}' +
40+
' -ms {ms}' +
41+
' -ok {ok} -ot {ot} -oq {oq}' +
42+
' {nc} --mem --fom {gam}' +
43+
' --dev-pool-size {pool}' +
44+
' -d {device}' +
45+
' {assembly}',
46+
use_mpi=True)
47+
48+
workload('triplept', executables=['triplept'])
49+
workload('sedov', executables=['sedov'])
2550

2651
workload_variable('mesh', default='default',
2752
description='mesh file',
28-
workloads=['triplept'])
53+
workloads=['*'])
2954

3055
workload_variable('nx', default='2',
3156
description='Elements in x-dimension',
32-
workloads=['triplept'])
57+
workloads=['*'])
3358

3459
workload_variable('ny', default='2',
3560
description='Elements in y-dimension',
36-
workloads=['triplept'])
61+
workloads=['*'])
3762

3863
workload_variable('nz', default='2',
3964
description='Elements in z-dimension',
40-
workloads=['triplept'])
65+
workloads=['*'])
4166

4267
workload_variable('problem', default='3',
4368
description='problem number',
44-
workloads=['triplept'])
69+
workloads=['*'])
4570

4671
workload_variable('rs', default='2',
4772
description='number of serial refinements',
48-
workloads=['triplept'])
73+
workloads=['*'])
4974

5075
workload_variable('rp', default='0',
5176
description='number of parallel refinements',
52-
workloads=['triplept'])
77+
workloads=['*'])
5378

5479
workload_variable('ms', default='250',
5580
description='max number of steps',
56-
workloads=['triplept'])
81+
workloads=['*'])
82+
83+
workload_variable('ok', default='1',
84+
description='Order (degree) of the kinematic finite element space',
85+
workloads=['*'])
86+
87+
workload_variable('ot', default='0',
88+
description='Order (degree) of the thermodynamic finite element space',
89+
workloads=['*'])
90+
91+
workload_variable('oq', default='-1',
92+
description='Order of the integration rule',
93+
workloads=['*'])
94+
95+
workload_variable('pool', default='4',
96+
description='Device pool size',
97+
workloads=['*'])
5798

5899
workload_variable('device', default='cpu',
59100
description='cpu, cuda or hip',
60-
workloads=['triplept'])
101+
workloads=['*'])
61102

62103
workload_variable('gam', default='--no-gpu-aware-mpi',
63104
description='--gpu-aware-mpi or --no-gpu-aware-mpi',
64-
workloads=['triplept'])
105+
workloads=['*'])
106+
107+
workload_variable('nc', default='-nc',
108+
description='Use non-conforming meshes. Requires a 2D or 3D mesh.',
109+
workloads=['*'])
65110

66111
workload_variable('assembly', default='-pa',
67112
description='Activate 1D tensor-based assembly (partial assembly).',
68-
workloads=['triplept'])
113+
workloads=['*'])
69114

70-
workload_variable('tf', default='0.6',
115+
workload_variable('tf', default='0.8',
71116
description='Final time; start time is 0.',
72-
workloads=['triplept'])
117+
workloads=['*'])
73118

74119
figure_of_merit('Major kernels total time',
75120
log_file='{experiment_run_dir}/{experiment_name}.out',

0 commit comments

Comments
 (0)