diff --git a/lollipop/cli/deconvolute.py b/lollipop/cli/deconvolute.py index 803f512..2362da9 100755 --- a/lollipop/cli/deconvolute.py +++ b/lollipop/cli/deconvolute.py @@ -14,7 +14,7 @@ import pandas as pd import numpy as np from tqdm import tqdm, trange -from threadpoolctl import threadpool_info, ThreadpoolController, threadpool_limits +from threadpoolctl import ThreadpoolController import lollipop as ll @@ -147,11 +147,10 @@ def _deconvolute_bootstrap( List[pd.DataFrame] The deconvolution results for the location and bootstrap iterations. """ - print("Threadpool: ", threadpool_info()) - - logging.warning(threadpool_info()) + # monitor the number of threads, to prevent oversubscription on blas / cluster systmes controller = ThreadpoolController() + logging.info(f"Threading configuration:\n {controller.info()}") # deconvolution results deconv = [] @@ -238,17 +237,19 @@ def _deconvolute_bootstrap( # just run one on everything weights = {} + # define deconvolution kernel + t_kdec = ll.KernelDeconv( + temp_df2[var_dates["var_dates"][mindate] + ["undetermined"]], + temp_df2["frac"], + temp_df2["date"], + kernel=kernel(**kernel_params), + reg=regressor(**regressor_params), + confint=confint(**confint_params), + **weights, + ) + # limit the number of threads, to prevent oversubscription on blas / cluster systmes with controller.limit(limits=1, user_api='blas'): - # deconvolution - t_kdec = ll.KernelDeconv( - temp_df2[var_dates["var_dates"][mindate] + ["undetermined"]], - temp_df2["frac"], - temp_df2["date"], - kernel=kernel(**kernel_params), - reg=regressor(**regressor_params), - confint=confint(**confint_params), - **weights, - ) + # do the deconvolution t_kdec = t_kdec.deconv_all(**deconv_params) if have_confint: @@ -397,9 +398,6 @@ def deconvolute( tally_data, namefield, ): - - controller = ThreadpoolController() - logging.warning(f"Controller {controller.info()}") # load data yaml = ruamel.yaml.YAML(typ="rt")