-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/new modifier implementation #356
base: develop
Are you sure you want to change the base?
Changes from all commits
f5d42ea
eaf72d0
19a9cfd
0823c12
d80ecef
7b9c2e2
7c6f80c
2238ac1
7c46969
0c0bbd3
0c46273
7bff318
2de749d
b0baff3
56b4737
fdfce26
0dc3af8
f33103d
54347d5
d7a6125
00c86fa
6298921
dd30ad5
4a28b43
2fc1408
fa2e096
98b1789
73cf307
7c9bb91
0dabe54
e9ed483
122fe00
1602e0c
fb2ec64
bb8abb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Copyright 2023 Lawrence Livermore National Security, LLC and other | ||
# Benchpark Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
from benchpark.directives import variant | ||
from benchpark.experiment import Experiment | ||
|
||
|
||
class Caliper(Experiment): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (suggestion, not a problem) IIRC you mentioned that |
||
variant( | ||
"caliper", | ||
default="none", | ||
values=( | ||
"none", | ||
"time", | ||
"mpi", | ||
"cuda", | ||
"topdown-counters-all", | ||
"topdown-counters-toplevel", | ||
"topdown-all", | ||
"topdown-toplevel", | ||
), | ||
multi=True, | ||
description="caliper mode", | ||
) | ||
|
||
def is_enabled(self): | ||
return not self.spec.satisfies("caliper=none") | ||
|
||
def compute_modifiers_section(self): | ||
modifier_list = [] | ||
if not self.spec.satisfies("caliper=none"): | ||
for var in list(self.spec.variants["caliper"]): | ||
if var != "time": | ||
caliper_modifier_modes = {} | ||
caliper_modifier_modes["name"] = "caliper" | ||
caliper_modifier_modes["mode"] = var | ||
modifier_list.append(caliper_modifier_modes) | ||
# Add time as the last mode | ||
modifier_list.append({"name": "caliper", "mode": "time"}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (question) When you mentioned having to order things yourself, is this what you mean? In a separate conversation, you mention that this is so "In this case, the time mode is always added last to the modifier list which adds the CALI_CONFIG variable after each of the CALI_CONFIG_MODE variables have been defined. " I'm not clear on how this achieves that. Is |
||
return modifier_list | ||
|
||
def compute_spack_section(self): | ||
# set package versions | ||
caliper_version = "master" | ||
|
||
# get system config options | ||
# TODO: Get compiler/mpi/package handles directly from system.py | ||
system_specs = {} | ||
system_specs["compiler"] = "default-compiler" | ||
if self.spec.satisfies("programming_model=cuda"): | ||
system_specs["cuda_arch"] = "{cuda_arch}" | ||
if self.spec.satisfies("programming_model=rocm"): | ||
system_specs["rocm_arch"] = "{rocm_arch}" | ||
|
||
# set package spack specs | ||
package_specs = {} | ||
|
||
if not self.spec.satisfies("caliper=none"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get the impression that some combinations of |
||
package_specs["caliper"] = { | ||
"pkg_spec": f"caliper@{caliper_version}+adiak+mpi~libunwind~libdw", | ||
"compiler": system_specs["compiler"], | ||
} | ||
if any("topdown" in var for var in self.spec.variants["caliper"]): | ||
papi_support = True # check if target system supports papi | ||
if papi_support: | ||
package_specs["caliper"]["pkg_spec"] += "+papi" | ||
else: | ||
raise NotImplementedError( | ||
"Target system does not support the papi interface" | ||
) | ||
elif self.spec.satisfies("caliper=cuda"): | ||
cuda_support = ( | ||
self.spec.satisfies("caliper=cuda") and True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) # check if target system supports cuda | ||
if cuda_support: | ||
package_specs["caliper"][ | ||
"pkg_spec" | ||
] += "~papi+cuda cuda_arch={}".format(system_specs["cuda_arch"]) | ||
else: | ||
raise NotImplementedError( | ||
"Target system does not support the cuda interface" | ||
) | ||
elif self.spec.satisfies("caliper=time") or self.spec.satisfies( | ||
"caliper=mpi" | ||
): | ||
package_specs["caliper"]["pkg_spec"] += "~papi" | ||
|
||
return { | ||
"packages": {k: v for k, v in package_specs.items() if v}, | ||
"environments": {"caliper": {"packages": list(package_specs.keys())}}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a suggestion for refactoring this to make it easier to add analogs to
caliper
:Experiment.__init__
(in the base classExperiment
) callsExperiment.initialize
caliper.Caliper
except for variant declaration intocaliper.Helper
Amg2023.initialize
setshelpers = [caliper.Helper()]
Experiment
(the base class) handles tacking on extra modifiers from all.helpers
caliper_package_specs
The benefit of this organization is that you can add more functionality (that defines other modifiers/specs) without having to modify functions in this class other than
.initialize
.