From b6c5b931076565fbb18fd46c7ab8a5f2aeb9dbc7 Mon Sep 17 00:00:00 2001 From: fmckenna Date: Tue, 22 Oct 2024 10:44:43 -0700 Subject: [PATCH] fmk - reverting runTMCMC processor pool to original, if large num processors setting to 8 for container runs --- modules/performUQ/UCSD_UQ/runTMCMC.py | 34 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/modules/performUQ/UCSD_UQ/runTMCMC.py b/modules/performUQ/UCSD_UQ/runTMCMC.py index cfa1d5a19..14e571423 100644 --- a/modules/performUQ/UCSD_UQ/runTMCMC.py +++ b/modules/performUQ/UCSD_UQ/runTMCMC.py @@ -264,17 +264,33 @@ def run_TMCMC( # noqa: N802, PLR0913 # Evaluate log-likelihood at current samples Sm if run_type == 'runningLocal': - mp.set_start_method('forkserver', force=True) + processor_count = mp.cpu_count() - with mp.Pool(processes=processor_count) as pool: - write_eval_data_to_logfile( - logfile, - parallelize_MCMC, - run_type, - proc_count=processor_count, - stage_num=stage_number, + if processor_count > 32: + processor_count = 8 + + pool = Pool(processes=processor_count) + write_eval_data_to_logfile( + logfile, + parallelize_MCMC, + run_type, + proc_count=processor_count, + stage_num=stage_number, ) - outputs = pool.starmap(runFEM, iterables) + outputs = pool.starmap(runFEM, iterables) + + # pool does not start + #mp.set_start_method('forkserver', force=True) + #processor_count = mp.cpu_count() + #with mp.Pool(processes=processor_count) as pool: + # write_eval_data_to_logfile( + # logfile, + # parallelize_MCMC, + # run_type, + # proc_count=processor_count, + # stage_num=stage_number, + # ) + # outputs = pool.starmap(runFEM, iterables) #mp.set_start_method('spawn') #with mp.Pool(processes=processor_count) as pool: