Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable spike replays using external files for coreneuron in memory mode #2871

Closed
wants to merge 2 commits into from
Closed
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
15 changes: 8 additions & 7 deletions src/coreneuron/apps/main1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,6 @@ void nrn_init_and_load_data(int argc,
report_mem_usage("After nrn_setup ");
}

// Invoke PatternStim
if (!corenrn_param.patternstim.empty()) {
nrn_mkPatternStim(corenrn_param.patternstim.c_str(), corenrn_param.tstop);
}

/// Setting the timeout
nrn_set_timeout(200.);

Expand Down Expand Up @@ -311,11 +306,17 @@ void nrn_init_and_load_data(int argc,
// all final state, including the event queue will be sent back
// to NEURON. Here there is some first time only
// initialization and queue transfer.
direct_mode_initialize();
// Transfer PatternStim from NEURON only when input is not specified by --pattern.
direct_mode_initialize(corenrn_param.patternstim.empty());
clear_spike_vectors(); // PreSyn send already recorded by NEURON
(*nrn2core_part2_clean_)();
}

// Invoke PatternStim
if (!corenrn_param.patternstim.empty()) {
nrn_mkPatternStim(corenrn_param.patternstim.c_str(), corenrn_param.tstop);
}

if (corenrn_param.gpu) {
// Copy nrnthreads to device only after all the data are passed from NEURON and the
// nrnthreads on CPU are properly set up
Expand Down Expand Up @@ -636,7 +637,7 @@ extern "C" int run_solve_core(int argc, char** argv) {
}

if (corenrn_embedded) {
core2nrn_data_return();
core2nrn_data_return(corenrn_param.patternstim.empty());
}

{
Expand Down
6 changes: 5 additions & 1 deletion src/coreneuron/io/core2nrn_data_return.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
* Copies t, voltage, i_membrane_ if it used, and mechanism param data.
* Copies event queue and related state, e.g. WATCH, VecPlayContinuous.
*/
void core2nrn_data_return() {
void core2nrn_data_return(bool return_patternstim) {
if (!nrn2core_type_return_) {
return;
}
Expand Down Expand Up @@ -331,8 +331,12 @@
}
}

int patstimtype = nrn_get_mechtype("PatternStim");
for (NrnThreadMembList* tml = nt.tml; tml; tml = tml->next) {
int mtype = tml->index;
if (!return_patternstim && mtype == patstimtype) {
continue;

Check warning on line 338 in src/coreneuron/io/core2nrn_data_return.cpp

View check run for this annotation

Codecov / codecov/patch

src/coreneuron/io/core2nrn_data_return.cpp#L338

Added line #L338 was not covered by tests
}
Memb_list* ml = tml->ml;
n = (*nrn2core_type_return_)(mtype, tid, data, mdata);
assert(n == size_t(ml->nodecount) && !mdata.empty());
Expand Down
2 changes: 1 addition & 1 deletion src/coreneuron/io/core2nrn_data_return.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace coreneuron {
I.e. voltage, i_membrane_, mechanism data, event queue, WATCH state,
Play state, etc.
*/
extern void core2nrn_data_return();
extern void core2nrn_data_return(bool return_patternstim = true);

/** @brief return first and last datum indices of WATCH statements
*/
Expand Down
6 changes: 4 additions & 2 deletions src/coreneuron/io/nrn2core_data_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void (*nrn2core_transfer_watch_)(void (*cb)(int, int, int, int, int));
nrn_finitialize above but without changing any simulation data. We follow
some of the strategy of checkpoint_initialize.
**/
void direct_mode_initialize() {
void direct_mode_initialize(bool send_patternstim) {
dt2thread(-1.);
nrn_thread_table_check();

Expand Down Expand Up @@ -90,7 +90,9 @@ void direct_mode_initialize() {
nrn2core_PreSyn_flag_receive(tid);
}

nrn2core_patstim_share_info();
if (send_patternstim) {
nrn2core_patstim_share_info();
}

nrn2core_tqueue();
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreneuron/sim/multicore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ 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 direct_mode_initialize();
extern void direct_mode_initialize(bool send_patternstim = true);
extern void nrn_mk_table_check(void);
extern void nonvint(NrnThread* _nt);
extern void update(NrnThread*);
Expand Down
Loading