Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions coreneuron/network/netcvode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,26 +576,12 @@ void SelfEvent::pr(const char* s, double tt, NetCvode*) {
}

void ncs2nrn_integrate(double tstop) {
double ts;
int n = (int)((tstop - nrn_threads->_t) / dt + 1e-9);
int total_sim_steps = static_cast<int>((tstop - nrn_threads->_t) / dt + 1e-9);

if (n > 3 && !nrn_have_gaps) {
nrn_fixed_step_group_minimal(n);
if (total_sim_steps > 3 && !nrn_have_gaps) {
nrn_fixed_step_group_minimal(total_sim_steps);
} else {
#if NRNMPI
ts = tstop - dt;
nrn_assert(nrn_threads->_t <= tstop);
// It may very well be the case that we do not advance at all
while (nrn_threads->_t <= ts) {
#else
ts = tstop - .5 * dt;
while (nrn_threads->_t < ts) {
#endif
nrn_fixed_step_minimal();

if (stoprun)
break;
}
nrn_fixed_single_steps_minimal(total_sim_steps, tstop);
}

// handle all the pending flag=1 self events
Expand Down
33 changes: 29 additions & 4 deletions coreneuron/sim/fadvance_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,36 @@ void finalize_progress_bar() {
}
}

void nrn_fixed_step_group_minimal(int n) {
static int step = 0;
void nrn_fixed_single_steps_minimal(int total_sim_steps, double tstop) {
const int progressbar_update_interval = 5;
static int current_steps = 0;
initialize_progress_bar(total_sim_steps);
#if NRNMPI
double updated_tstop = tstop - dt;
nrn_assert(nrn_threads->_t <= tstop);
// It may very well be the case that we do not advance at all
while (nrn_threads->_t <= updated_tstop) {
#else
double updated_tstop = tstop - .5 * dt;
while (nrn_threads->_t < updated_tstop) {
#endif
nrn_fixed_step_minimal();
if (stoprun) {
break;
}
current_steps++;
if (!(current_steps % progressbar_update_interval)) {
update_progress_bar(current_steps, nrn_threads[0]._t);
}
}
finalize_progress_bar();
}

void nrn_fixed_step_group_minimal(int total_sim_steps) {
static int current_steps = 0;
dt2thread(dt);
nrn_thread_table_check();
step_group_n = n;
step_group_n = total_sim_steps;
step_group_begin = 0;
step_group_end = 0;
initialize_progress_bar(step_group_n);
Expand All @@ -129,7 +154,7 @@ void nrn_fixed_step_group_minimal(int n) {
if (stoprun) {
break;
}
step++;
current_steps++;
step_group_begin = step_group_end;
update_progress_bar(step_group_end, nrn_threads[0]._t);
}
Expand Down
3 changes: 2 additions & 1 deletion coreneuron/sim/multicore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ extern void nrn_solve_minimal(NrnThread*);
extern void nrncore2nrn_send_init();
extern void* setup_tree_matrix_minimal(NrnThread*);
extern void nrncore2nrn_send_values(NrnThread*);
extern void nrn_fixed_step_group_minimal(int n);
extern void nrn_fixed_step_group_minimal(int total_sim_steps);
extern void nrn_fixed_single_steps_minimal(int total_sim_steps, double tstop);
extern void nrn_fixed_step_minimal(void);
extern void nrn_finitialize(int setv, double v);
extern void nrn_mk_table_check(void);
Expand Down
1 change: 1 addition & 0 deletions extra/instrumentation.tau
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ BEGIN_INCLUDE_LIST
void coreneuron::nrn_finitialize(int, double)
void coreneuron::nrn_fixed_step_group(int)
void coreneuron::nrn_fixed_step_group_minimal(int)
void coreneuron::nrn_fixed_single_steps_minimal(int, double)
void coreneuron::nrn_flush_reports(double)
void coreneuron::nrn_lhs(coreneuron::NrnThread *)
void coreneuron::nrn_multithread_job(void *(*)(coreneuron::NrnThread *))
Expand Down