From 5fa0ff65ca9e0f7c1a2e0312ec9330b9617cedd2 Mon Sep 17 00:00:00 2001 From: barneydobson Date: Mon, 8 Apr 2024 23:28:26 +0100 Subject: [PATCH] Update experimenter.py debug experimenter --- swmmanywhere/paper/experimenter.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/swmmanywhere/paper/experimenter.py b/swmmanywhere/paper/experimenter.py index acd2512c..be91732e 100644 --- a/swmmanywhere/paper/experimenter.py +++ b/swmmanywhere/paper/experimenter.py @@ -142,7 +142,15 @@ def process_parameters(jobid: int, nproc = nproc if nproc is not None else n_iter # Assign jobs based on jobid - job_iter = tlz.partition_all(nproc, range(n_iter)) + if n_iter % nproc != 0: + logger.warning(f"""Number of samples ({n_iter}) is not divisible by the + number of processors ({nproc}), leaving some processors + unused.""") + n = int(n_iter / nproc) + 1 + else: + n = int(n_iter / nproc) + + job_iter = tlz.partition_all(n, range(n_iter)) for _ in range(jobid + 1): job_idx = next(job_iter, None)