Skip to content

Commit 6a14351

Browse files
committed
Move tuned-adm to builtin repo
Also update the active profile query to check all nodes.
1 parent 0e5257d commit 6a14351

File tree

1 file changed

+76
-0
lines changed
  • var/ramble/repos/builtin/modifiers/tuned-adm

1 file changed

+76
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright 2022-2024 The Ramble Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4+
# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5+
# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6+
# option. This file may not be copied, modified, or distributed
7+
# except according to those terms.
8+
9+
import os
10+
11+
from ramble.modkit import *
12+
13+
14+
class TunedAdm(BasicModifier):
15+
"""Define a modifier for TunedAdm
16+
17+
This modifier is used to select a specific tuned profile.
18+
It also records the selected profile as a FOM.
19+
"""
20+
21+
name = "tuned-adm"
22+
23+
tags("system-info", "sysinfo", "platform-info")
24+
25+
maintainers("douglasjacobsen")
26+
27+
mode("standard", description="Standard execution mode for tuned-adm")
28+
29+
software_spec("pdsh", pkg_spec="pdsh", package_manager="spack*")
30+
31+
required_variable("hostlist")
32+
33+
modifier_variable(
34+
"tuned-profile",
35+
default="google-hpc-compute-throughput",
36+
description="tuned profile to use",
37+
mode="standard",
38+
)
39+
40+
register_builtin("set_tuning_profile")
41+
42+
def set_tuning_profile(self):
43+
return [
44+
"pdsh -w {hostlist} sudo tuned-adm profile {tuned-profile}",
45+
"pdsh -w {hostlist} sudo tuned-adm active > {experiment_run_dir}/tuning_profile",
46+
]
47+
48+
def _prepare_analysis(self, workspace):
49+
profile_path = os.path.join(
50+
self.expander.expand_var("{experiment_run_dir}"),
51+
"tuning_profile",
52+
)
53+
54+
if not os.path.exists(profile_path):
55+
return
56+
57+
profiles = set()
58+
with open(profile_path) as f:
59+
60+
for line in f.readlines():
61+
if "active profile:" in line:
62+
profiles.add(line.split(":")[-1].strip())
63+
profiles_str = ",".join(profiles)
64+
65+
if profiles:
66+
with open(profile_path, "a") as f:
67+
profiles_str = ",".join(profiles)
68+
f.write(f"Applied profiles: {profiles_str}")
69+
70+
figure_of_merit(
71+
"Tuning Profile",
72+
fom_regex=r"Applied profiles:\s*(?P<profile>.*)",
73+
log_file="{experiment_run_dir}/tuning_profile",
74+
group_name="profile",
75+
units="",
76+
)

0 commit comments

Comments
 (0)