From 0784cd53d79e00684506604f094b5d820b3994d4 Mon Sep 17 00:00:00 2001 From: Deepak Mallubhotla Date: Sun, 6 Mar 2022 17:31:17 -0600 Subject: [PATCH] feat: Changes chunksize for multiprocessing --- deepdog/alt_bayes_run.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deepdog/alt_bayes_run.py b/deepdog/alt_bayes_run.py index a998e42..39730c6 100644 --- a/deepdog/alt_bayes_run.py +++ b/deepdog/alt_bayes_run.py @@ -10,8 +10,7 @@ import numpy # TODO: remove hardcode -COST_THRESHOLD = 1e-10 - +CHUNKSIZE = 20 # TODO: It's garbage to have this here duplicated from pdme. DotInput = Tuple[numpy.typing.ArrayLike, float] @@ -98,7 +97,7 @@ class AltBayesRun(): _logger.debug(f"Doing discretisation #{disc_count}") with multiprocessing.Pool(multiprocessing.cpu_count() - 1 or 1) as pool: results.append(sum( - pool.imap_unordered(get_a_result, [(discretisation, self.dot_inputs_array, lows, highs, self.monte_carlo_count, self.max_frequency)] * self.monte_carlo_cycles) + pool.imap_unordered(get_a_result, [(discretisation, self.dot_inputs_array, lows, highs, self.monte_carlo_count, self.max_frequency)] * self.monte_carlo_cycles, CHUNKSIZE) )) _logger.debug("Done, constructing output now")