@@ -26,6 +26,8 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2626THE POSSIBILITY OF SUCH DAMAGE.
2727*/
2828
29+ #include < functional>
30+
2931#include " coreneuron/coreneuron.hpp"
3032#include " coreneuron/nrnconf.h"
3133#include " coreneuron/sim/multicore.hpp"
@@ -43,7 +45,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
4345namespace coreneuron {
4446
4547static void * nrn_fixed_step_thread (NrnThread*);
46- static void * nrn_fixed_step_group_thread (NrnThread*);
48+ static void * nrn_fixed_step_group_thread (NrnThread*, int , int , int & );
4749
4850void dt2thread (double adt) { /* copied from nrnoc/fadvance.c */
4951 if (adt != nrn_threads[0 ]._dt ) {
@@ -84,9 +86,6 @@ void nrn_fixed_step_minimal() { /* not so minimal anymore with gap junctions */
8486integration interval before joining
8587*/
8688// / --> Coreneuron
87- static int step_group_n;
88- static int step_group_begin;
89- static int step_group_end;
9089static progressbar* progress;
9190
9291void initialize_progress_bar (int nstep) {
@@ -137,13 +136,13 @@ void nrn_fixed_step_group_minimal(int total_sim_steps) {
137136 static int current_steps = 0 ;
138137 dt2thread (dt);
139138 nrn_thread_table_check ();
140- step_group_n = total_sim_steps;
141- step_group_begin = 0 ;
142- step_group_end = 0 ;
139+ int step_group_n = total_sim_steps;
140+ int step_group_begin = 0 ;
141+ int step_group_end = 0 ;
143142 initialize_progress_bar (step_group_n);
144143
145144 while (step_group_end < step_group_n) {
146- nrn_multithread_job (nrn_fixed_step_group_thread);
145+ nrn_multithread_job (nrn_fixed_step_group_thread, step_group_n, step_group_begin, step_group_end );
147146#if NRNMPI
148147 nrn_spike_exchange (nrn_threads);
149148#endif
@@ -162,9 +161,9 @@ void nrn_fixed_step_group_minimal(int total_sim_steps) {
162161 finalize_progress_bar ();
163162}
164163
165- static void * nrn_fixed_step_group_thread (NrnThread* nth) {
164+ static void * nrn_fixed_step_group_thread (NrnThread* nth, int step_group_max, int step_group_begin, int & step_group_end ) {
166165 nth->_stop_stepping = 0 ;
167- for (int i = step_group_begin; i < step_group_n ; ++i) {
166+ for (int i = step_group_begin; i < step_group_max ; ++i) {
168167 nrn_fixed_step_thread (nth);
169168 if (nth->_stop_stepping ) {
170169 if (nth->id == 0 ) {
@@ -175,7 +174,7 @@ static void* nrn_fixed_step_group_thread(NrnThread* nth) {
175174 }
176175 }
177176 if (nth->id == 0 ) {
178- step_group_end = step_group_n ;
177+ step_group_end = step_group_max ;
179178 }
180179 return nullptr ;
181180}
0 commit comments