Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 2ba1f24

Browse files
authored
Fix VecPlayContinuous direct mode error with multiple threads. (#521)
* Fix VecPlayContinuous direct mode error with multiple threads. * See associated PR neuronsimulator/nrn#1154 neuronsimulator/nrn#1155
1 parent 955d247 commit 2ba1f24

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

coreneuron/io/nrn2core_direct.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extern int (*nrn2core_get_dat2_corepointer_mech_)(int tid,
7777
int*& iarray,
7878
double*& darray);
7979

80-
extern int (*nrn2core_get_dat2_vecplay_)(int tid, int& n);
80+
extern int (*nrn2core_get_dat2_vecplay_)(int tid, std::vector<int>& indices);
8181

8282
extern int (*nrn2core_get_dat2_vecplay_inst_)(int tid,
8383
int i,

coreneuron/io/phase2.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ int (*nrn2core_get_dat2_corepointer_mech_)(int tid,
6262
int*& iarray,
6363
double*& darray);
6464

65-
int (*nrn2core_get_dat2_vecplay_)(int tid, int& n);
65+
int (*nrn2core_get_dat2_vecplay_)(int tid, std::vector<int>& indices);
6666

6767
int (*nrn2core_get_dat2_vecplay_inst_)(int tid,
6868
int i,
@@ -373,10 +373,13 @@ void Phase2::read_direct(int thread_id, const NrnThread& nt) {
373373
delete[] dArray_;
374374
}
375375

376-
int n_vec_play_continuous;
377-
(*nrn2core_get_dat2_vecplay_)(thread_id, n_vec_play_continuous);
376+
// Get from NEURON, the VecPlayContinuous indices in
377+
// NetCvode::fixed_play_ for this thread.
378+
std::vector<int> indices_vec_play_continuous;
379+
(*nrn2core_get_dat2_vecplay_)(thread_id, indices_vec_play_continuous);
378380

379-
for (size_t i = 0; i < n_vec_play_continuous; ++i) {
381+
// i is an index into NEURON's NetCvode::fixed_play_ for this thread.
382+
for (auto i: indices_vec_play_continuous) {
380383
VecPlayContinuous_ item;
381384
// yvec_ and tvec_ are not deleted as that space is within
382385
// NEURON Vector

external/nmodl

Submodule nmodl updated 58 files

0 commit comments

Comments
 (0)