Skip to content

Commit

Permalink
bench/parameter: Adding get_name_with_position()
Browse files Browse the repository at this point in the history
This function is an helper to provide a unique name to benchmarks.
The current job position is padded to the current job name.

This commit:
- add this new function
- replace the existing occurences.
- change the output to report the name with position at runtime

Before :
[full_cpu_load] stressng/cpu/matrixprod(M): 1 stressor on CPU [0] for 60s
[full_cpu_load] stressng/cpu/matrixprod(M): 2 stressor on CPU [0] for 60s
[full_cpu_load] stressng/cpu/matrixprod(M): 4 stressor on CPU [0] for 60s

After:
[full_cpu_load_0] stressng/cpu/matrixprod(M): 1 stressor on CPU [0] for 60s
[full_cpu_load_1] stressng/cpu/matrixprod(M): 2 stressor on CPU [0] for 60s
[full_cpu_load_2] stressng/cpu/matrixprod(M): 4 stressor on CPU [0] for 60s

Signed-off-by: Erwan Velu <[email protected]>
  • Loading branch information
ErwanAliasr1 committed Nov 26, 2024
1 parent f78fed5 commit 175db84
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hwbench/bench/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def pre_run(self):
monitoring = "(M)"
print(
"[{}] {}/{}/{}{}: {:3d} stressor{} for {}s{}".format(
p.get_name(),
p.get_name_with_position(),
self.engine_module.get_engine().get_name(),
self.engine_module.get_name(),
p.get_engine_module_parameter(),
Expand Down
10 changes: 4 additions & 6 deletions hwbench/bench/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,9 @@ def run(self):
)

# Save each benchmark result
results[
"{}_{}".format(
benchmark.get_parameters().get_name(), benchmark.get_job_number()
)
] = benchmark.run()
results[benchmark.get_parameters().get_name_with_position()] = (
benchmark.run()
)
return results

def dump(self):
Expand All @@ -278,7 +276,7 @@ def dump(self):
engine = bench.get_enginemodule().get_engine()
em = bench.get_enginemodule()
param = bench.get_parameters()
print(f"[{param.get_name()}_{bench.get_job_number()}]", file=f)
print(f"[{param.get_name_with_position()}]", file=f)
print(f"runtime={param.get_runtime()}", file=f)
print(f"monitoring={param.get_monitoring_config()}", file=f)
print(f"engine={engine.get_name()}", file=f)
Expand Down
5 changes: 5 additions & 0 deletions hwbench/bench/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def get_pinned_cpu(self):
def get_name(self) -> str:
return self.job_name

def get_name_with_position(self) -> str:
if not self.benchmark:
return self.get_name()
return f"{self.get_name()}_{self.benchmark.get_job_number()}"

def get_engine_instances_count(self) -> int:
return self.engine_instances

Expand Down

0 comments on commit 175db84

Please sign in to comment.