From 557ec8cd7c2f6fee07ac27c40c8f59b35a29646f Mon Sep 17 00:00:00 2001 From: Abhishek Patidar <1e9abhi1e10@gmail.com> Date: Sun, 5 Mar 2023 03:22:03 +0530 Subject: [PATCH 1/3] Added documentation for parallel fixes for estimators --- tardis/montecarlo/montecarlo_numba/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tardis/montecarlo/montecarlo_numba/base.py b/tardis/montecarlo/montecarlo_numba/base.py index f8cafba5d29..d37e4f0c1eb 100644 --- a/tardis/montecarlo/montecarlo_numba/base.py +++ b/tardis/montecarlo/montecarlo_numba/base.py @@ -202,11 +202,15 @@ def montecarlo_main_loop( ) rpacket_trackers.append(RPacketTracker()) + # Get the ID of the main thread and the number of threads main_thread_id = get_thread_id() n_threads = get_num_threads() + # Create a list of Estimators, one for each thread estimator_list = List() - for i in range(n_threads): # betting get tid goes from 0 to num threads + for i in range(n_threads): # betting get tid goes from 0 to num threads + # Note that get_thread_id() returns values from 0 to n_threads-1, + # so we iterate from 0 to n_threads-1 to create the estimator_list estimator_list.append( Estimators( np.copy(estimators.j_estimator), From b1406233aa65f512d9bd7017bd80f1869f98569d Mon Sep 17 00:00:00 2001 From: Abhishek Patidar <1e9abhi1e10@gmail.com> Date: Sun, 5 Mar 2023 11:35:55 +0530 Subject: [PATCH 2/3] run black --- tardis/montecarlo/montecarlo_numba/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tardis/montecarlo/montecarlo_numba/base.py b/tardis/montecarlo/montecarlo_numba/base.py index d37e4f0c1eb..cbdbae686c7 100644 --- a/tardis/montecarlo/montecarlo_numba/base.py +++ b/tardis/montecarlo/montecarlo_numba/base.py @@ -208,7 +208,7 @@ def montecarlo_main_loop( # Create a list of Estimators, one for each thread estimator_list = List() - for i in range(n_threads): # betting get tid goes from 0 to num threads + for i in range(n_threads): # betting get tid goes from 0 to num threads # Note that get_thread_id() returns values from 0 to n_threads-1, # so we iterate from 0 to n_threads-1 to create the estimator_list estimator_list.append( From b4e7d085a2128d065c4a545975cfbec6550cb21d Mon Sep 17 00:00:00 2001 From: Abhishek Patidar <1e9abhi1e10@gmail.com> Date: Mon, 13 Mar 2023 10:00:06 +0530 Subject: [PATCH 3/3] remove comment --- tardis/montecarlo/montecarlo_numba/base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tardis/montecarlo/montecarlo_numba/base.py b/tardis/montecarlo/montecarlo_numba/base.py index cbdbae686c7..f51fdea4d50 100644 --- a/tardis/montecarlo/montecarlo_numba/base.py +++ b/tardis/montecarlo/montecarlo_numba/base.py @@ -206,7 +206,6 @@ def montecarlo_main_loop( main_thread_id = get_thread_id() n_threads = get_num_threads() - # Create a list of Estimators, one for each thread estimator_list = List() for i in range(n_threads): # betting get tid goes from 0 to num threads # Note that get_thread_id() returns values from 0 to n_threads-1,