From aa3594717470d11567a90f32a36f435342933a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gordon=20J=2E=20K=C3=B6hn?= Date: Tue, 15 Oct 2024 16:13:53 +0200 Subject: [PATCH] add thread control1 --- lollipop/cli/deconvolute.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lollipop/cli/deconvolute.py b/lollipop/cli/deconvolute.py index 2bc796b..023e735 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 +from threadpoolctl import threadpool_info, ThreadpoolController, threadpool_limits import lollipop as ll @@ -147,6 +147,11 @@ def _deconvolute_bootstrap( List[pd.DataFrame] The deconvolution results for the location and bootstrap iterations. """ + print("Threadpool: ", threadpool_info()) + + logging.warning(threadpool_info()) + + controller = ThreadpoolController() # deconvolution results deconv = [] @@ -243,10 +248,8 @@ def _deconvolute_bootstrap( confint=confint(**confint_params), **weights, ) - - logging.warning(threadpool_info()) - - t_kdec = t_kdec.deconv_all(**deconv_params) + with controller.limit(limits=1, user_api='blas'): + t_kdec = t_kdec.deconv_all(**deconv_params) if have_confint: # with conf int