From 496fb819979bef613b1c5c4911a6b30c9bd18b39 Mon Sep 17 00:00:00 2001 From: James Betker Date: Fri, 11 Feb 2022 11:22:25 -0700 Subject: [PATCH] use fork instead --- codes/sweep.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/codes/sweep.py b/codes/sweep.py index ac31dd3f..9f3092af 100644 --- a/codes/sweep.py +++ b/codes/sweep.py @@ -48,5 +48,11 @@ if __name__ == '__main__': nd['path'][k] = p.replace(base_path, f'{base_path}\\{mod}') all_opts.append(nd) - with ThreadPool(len(modifications)) as pool: - list(pool.imap(functools.partial(launch_trainer, opt_path=base_opt), all_opts)) + for i in range(1,len(modifications)): + pid = os.fork() + if pid == 0: + rank = i + break + else: + rank = 0 + launch_trainer(all_opts[i], base_opt)