Skip to content

Commit

Permalink
Add support for setting a specific no_turbo value with denoise
Browse files Browse the repository at this point in the history
- only check no_turbo arg when we try to minimize

Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Jan 5, 2025
1 parent 86c9c9b commit 7cf7987
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
29 changes: 26 additions & 3 deletions rebench/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ def _read_no_turbo() -> Optional[bool]:
return None


def _set_no_turbo(with_no_turbo: bool) -> Union[Literal[True], str]:
if with_no_turbo:
def _set_no_turbo(no_turbo_value: bool) -> Union[Literal[True], str]:
if no_turbo_value:
value = "1"
else:
value = "0"
Expand Down Expand Up @@ -374,7 +374,7 @@ def _minimize_noise(args) -> dict:
result["shielding"] = _activate_shielding(shield, num_cores)

if args.use_no_turbo:
r = _set_no_turbo(True)
r = _set_no_turbo(args.no_turbo)
result["no_turbo"] = "succeeded" if r is True else r

if args.use_scaling_governor:
Expand Down Expand Up @@ -524,6 +524,17 @@ def _shell_options():
dest="use_no_turbo",
help="Don't try setting no_turbo",
)
parser.add_argument(
"-nt",
"--no-turbo",
action="store",
default=None,
dest="no_turbo",
choices=[True, False],
# convert input string to boolean
type=lambda x: x.lower() == "true",
help="Set no_turbo to the given boolean.",
)
parser.add_argument(
"-G",
"--without-scaling-governor",
Expand Down Expand Up @@ -651,6 +662,18 @@ def _any_failed(result: dict):


def _check_for_inconsistent_settings(args):
if args.use_no_turbo is False and args.no_turbo is not None:
print(
"Error: -nt|--no-turbo can only be set "
"when -T|--without-no-turbo is not set."
)
sys.exit(EXIT_CODE_INVALID_SETTINGS)
elif args.use_no_turbo and args.no_turbo is None and args.command == "minimize":
print(
"Error: Attempting to set no_turbo, but no value specified with -nt|--no-turbo."
)
sys.exit(EXIT_CODE_INVALID_SETTINGS)

if args.use_shielding is False and args.shield is not None:
print(
"Error: -s|--shield can only be set "
Expand Down
3 changes: 3 additions & 0 deletions rebench/denoise_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ def _add_denoise_options(cmd: list[str], requested: Denoise):
cmd.append(requested.scaling_governor)
if not requested.requested_no_turbo:
options_to_disable += "T"
else:
cmd.append("-nt")
cmd.append("true" if requested.no_turbo else "false")
if not requested.requested_minimize_perf_sampling:
options_to_disable += "P"

Expand Down

0 comments on commit 7cf7987

Please sign in to comment.