-
Notifications
You must be signed in to change notification settings - Fork 27
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/variant helpers #404
Conversation
…er-implementation
…er-implementation
lib/benchpark/experiment.py
Outdated
def compute_applications_section_wrapper(self): | ||
self.expr_name = [] | ||
self.variables = {} | ||
self.zips = {} | ||
self.matrix = [] | ||
self.excludes = [] | ||
|
||
self.compute_applications_section() | ||
|
||
expr_name_list = [self.name, self.workload] | ||
for cls in self.helpers: | ||
helper_prefix = cls.get_helper_name_prefix() | ||
if helper_prefix: | ||
expr_name_list.append(helper_prefix) | ||
expr_name = "_".join(expr_name_list + self.expr_name) | ||
|
||
return { | ||
self.name: { | ||
"workloads": { | ||
self.workload: { | ||
"experiments": { | ||
expr_name: { | ||
"variants": {"package_manager": "spack"}, | ||
"variables": self.variables, | ||
"zips": self.zips, | ||
"matrix": self.matrix, | ||
"exclude": {"where" : self.excludes} if self.excludes else {}, | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def add_spack_spec(self, package_name, spec=None): | ||
if spec: | ||
self.package_specs[package_name] = { | ||
"pkg_spec": spec[0], | ||
"compiler": spec[1], | ||
} | ||
else: | ||
self.package_specs[package_name] = {} | ||
|
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.
@scheibelp @pearce8 Refactored lib/experiment.py to remove much of the boilerplate code from the application experiment.py
lib/benchpark/experiment.py
Outdated
def compute_spack_section_wrapper(self): | ||
for cls in self.helpers: | ||
cls_package_specs = cls.compute_spack_section() | ||
if ( | ||
cls_package_specs | ||
and "packages" in cls_package_specs | ||
): | ||
self.package_specs |= cls_package_specs["packages"] | ||
|
||
self.compute_spack_section() | ||
|
||
if not self.name in self.package_specs: | ||
raise BenchparkError( | ||
f"Spack section must be defined for application package {self.name}" | ||
) | ||
|
||
spack_variants = [cls.get_spack_variants() for cls in self.helpers] | ||
self.package_specs[self.name]["pkg_spec"] += " ".join(spack_variants+list(self.spec.variants["extra_spack_specs"])).strip() | ||
|
||
return { | ||
"packages": {k: v for k, v in self.package_specs.items() if v}, | ||
"environments": {self.name: {"packages": list(self.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.
@scheibelp @pearce8 Refactored lib/experiment.py to remove much of the boilerplate code from the application experiment.py
"modifiers": self.compute_modifiers_section_wrapper(), | ||
"applications": self.compute_applications_section_wrapper(), | ||
"software": self.compute_spack_section_wrapper(), |
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.
@scheibelp @pearce8 Refactored lib/experiment.py to remove much of the boilerplate code from the application experiment.py
self.add_experiment_variable("px", p, True) | ||
self.add_experiment_variable("py", p, True) | ||
self.add_experiment_variable("pz", p, True) |
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.
@scheibelp @pearce8 The application can use an API to set experiment variables and other constructs
Merge #356 first. Closes #400.
Programming model and modifier.