Skip to content

Commit

Permalink
cpu_set support
Browse files Browse the repository at this point in the history
  • Loading branch information
johnaohara authored and franz1981 committed Dec 4, 2023
1 parent 24a734b commit aa9e99e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions toolset/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ def main(argv=None):
default=None,
help='The network mode to run docker in')

# CPU set options
parser.add_argument(
'--cpuset_cpus',
default=None,
help='The cpu set to run framework container on')

args = parser.parse_args()

config = BenchmarkConfig(args)
Expand Down
1 change: 1 addition & 0 deletions toolset/utils/benchmark_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self, args):
self.network = None
self.test_container_memory = args.test_container_memory
self.extra_docker_runtime_args = args.extra_docker_runtime_args
self.cpuset_cpus = args.cpuset_cpus

if self.network_mode is None:
self.network = 'tfb'
Expand Down
11 changes: 10 additions & 1 deletion toolset/utils/docker_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ def watch_container(docker_container, docker_file):
'soft': 99
}]

cpuset_cpus = ''

if self.benchmarker.config.cpuset_cpus is not None:
cpuset_cpus = self.benchmarker.config.cpuset_cpus

log("Running docker container with cpu set: %s" %
cpuset_cpus)

docker_cmd = ''
if hasattr(test, 'docker_cmd'):
docker_cmd = test.docker_cmd
Expand All @@ -205,7 +213,7 @@ def watch_container(docker_container, docker_file):
# to the webserver from IDE
if hasattr(test, 'debug_port'):
ports[test.debug_port] = test.debug_port

# Total memory limit allocated for the test container
if self.benchmarker.config.test_container_memory is not None:
mem_limit = self.benchmarker.config.test_container_memory
Expand Down Expand Up @@ -235,6 +243,7 @@ def watch_container(docker_container, docker_file):
sysctls=sysctl,
remove=True,
log_config={'type': None},
cpuset_cpus=cpuset_cpus,
**extra_docker_args
)

Expand Down

0 comments on commit aa9e99e

Please sign in to comment.