Properly terminate benchexec immediately if required cgroup is missing
We did this already for cpuset, but not for cpuacct and memory.
This would mean that BenchExec would instead attempt to start each run
and mark it as failure.
@@ -70,6 +70,7 @@ def execute_benchmark(benchmark, output_handler):
)
my_cgroups = cgroups.find_my_cgroups()
+ required_cgroups = set()
coreAssignment = None # cores per run
memoryAssignment = None # memory banks per run
@@ -79,11 +80,12 @@ def execute_benchmark(benchmark, output_handler):
if benchmark.rlimits.cpu_cores:
if not my_cgroups.require_subsystem(cgroups.CPUSET):
+ required_cgroups.add(cgroups.CPUSET)
logging.error(
"Cgroup subsystem cpuset is required "
"for limiting the number of CPU cores/memory nodes."
)
- my_cgroups.handle_errors({cgroups.CPUSET})
+ else:
coreAssignment = resources.get_cpu_cores_per_run(
benchmark.rlimits.cpu_cores,
benchmark.num_of_threads,
@@ -106,6 +108,10 @@ def execute_benchmark(benchmark, output_handler):
)
if benchmark.rlimits.memory:
+ if not my_cgroups.require_subsystem(cgroups.MEMORY):
+ required_cgroups.add(cgroups.MEMORY)
+ logging.error("Cgroup subsystem memory is required for memory limit.")
+ else:
# check whether we have enough memory in the used memory banks for all runs
resources.check_memory_size(
benchmark.rlimits.memory,
@@ -114,6 +120,13 @@ def execute_benchmark(benchmark, output_handler):
my_cgroups,
)
+ if benchmark.rlimits.cputime:
+ if not my_cgroups.require_subsystem(cgroups.CPUACCT):
+ required_cgroups.add(cgroups.CPUACCT)
+ logging.error("Cgroup subsystem cpuacct is required for cputime limit.")
+
+ my_cgroups.handle_errors(required_cgroups)
+
if benchmark.num_of_threads > 1 and systeminfo.is_turbo_boost_enabled():
logging.warning(
"Turbo boost of CPU is enabled. "
