From 695046a123717af3fab5fc5429987ddd7fe75359 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sat, 2 Sep 2023 19:55:35 +0200 Subject: [PATCH] Support binding agent to core --- example.yaml | 1 + slate/slate.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/example.yaml b/example.yaml index be9d039..b6f35ff 100644 --- a/example.yaml +++ b/example.yaml @@ -21,6 +21,7 @@ scheduler: repetitions: 3 agents_per_job: 3 reps_per_agent: 1 + bind_agent_to_core: True wandb: project: '{config[name]}' diff --git a/slate/slate.py b/slate/slate.py index a6a556c..f761442 100644 --- a/slate/slate.py +++ b/slate/slate.py @@ -294,6 +294,9 @@ class Slate(): Runner = self.runners[runnerName] + if orig_config.consume('scheduler.bind_agent_to_core', False): + os.sched_setaffinity(0, [p_ind % os.cpu_count()]) + for r in rep_ids: self.run_id = r config = copy.deepcopy(orig_config) @@ -324,6 +327,9 @@ class Slate(): Runner = self.runners[runnerName] + if orig_config.consume('scheduler.bind_agent_to_core', False): + os.sched_setaffinity(0, [p_ind % os.cpu_count()]) + with wandb.init( project=project, reinit=self.consume(wandbC, 'reinit', DEFAULT_REINIT),