|
24 | 24 | #endif |
25 | 25 |
|
26 | 26 | int (*nrn2core_get_dat2_1_)(int tid, |
| 27 | + int& n_real_cell, |
27 | 28 | int& ngid, |
28 | 29 | int& n_real_gid, |
29 | 30 | int& nnode, |
@@ -107,6 +108,7 @@ inline void mech_data_layout_transform(T* data, int cnt, int sz, int layout) { |
107 | 108 | } |
108 | 109 |
|
109 | 110 | void Phase2::read_file(FileHandler& F, const NrnThread& nt) { |
| 111 | + n_real_cell = F.read_int(); |
110 | 112 | n_output = F.read_int(); |
111 | 113 | n_real_output = F.read_int(); |
112 | 114 | n_node = F.read_int(); |
@@ -256,6 +258,7 @@ void Phase2::read_direct(int thread_id, const NrnThread& nt) { |
256 | 258 | int* nodecounts_ = nullptr; |
257 | 259 | int n_weight; |
258 | 260 | (*nrn2core_get_dat2_1_)(thread_id, |
| 261 | + n_real_cell, |
259 | 262 | n_output, |
260 | 263 | n_real_output, |
261 | 264 | n_node, |
@@ -915,8 +918,9 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) { |
915 | 918 | NrnThreadChkpnt& ntc = nrnthread_chkpnt[nt.id]; |
916 | 919 | ntc.file_id = userParams.gidgroups[nt.id]; |
917 | 920 |
|
918 | | - nt.ncell = n_real_output; |
| 921 | + nt.ncell = n_real_cell; |
919 | 922 | nt.end = n_node; |
| 923 | + nt.n_real_output = n_real_output; |
920 | 924 |
|
921 | 925 | #if CHKPNTDEBUG |
922 | 926 | ntc.n_outputgids = n_output; |
@@ -1221,14 +1225,15 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) { |
1221 | 1225 | node_permute(output_vindex.data(), nt.n_presyn, nt._permute); |
1222 | 1226 | } |
1223 | 1227 | #if CHKPNTDEBUG |
1224 | | - ntc.output_threshold = new double[nt.ncell]; |
1225 | | - memcpy(ntc.output_threshold, output_threshold.data(), nt.ncell * sizeof(double)); |
| 1228 | + ntc.output_threshold = new double[n_real_output]; |
| 1229 | + memcpy(ntc.output_threshold, output_threshold.data(), n_real_output * sizeof(double)); |
1226 | 1230 | #endif |
| 1231 | + |
1227 | 1232 | for (int i = 0; i < nt.n_presyn; ++i) { // real cells |
1228 | 1233 | PreSyn* ps = nt.presyns + i; |
1229 | 1234 |
|
1230 | 1235 | int ix = output_vindex[i]; |
1231 | | - if (ix == -1 && i < nt.ncell) { // real cell without a presyn |
| 1236 | + if (ix == -1 && i < n_real_output) { // real cell without a presyn |
1232 | 1237 | continue; |
1233 | 1238 | } |
1234 | 1239 | if (ix < 0) { |
@@ -1256,7 +1261,7 @@ void Phase2::populate(NrnThread& nt, const UserParams& userParams) { |
1256 | 1261 | // initial net_send_buffer size about 1% of number of presyns |
1257 | 1262 | // nt._net_send_buffer_size = nt.ncell/100 + 1; |
1258 | 1263 | // but, to avoid reallocation complexity on GPU ... |
1259 | | - nt._net_send_buffer_size = nt.ncell; |
| 1264 | + nt._net_send_buffer_size = n_real_output; |
1260 | 1265 | nt._net_send_buffer = (int*) ecalloc_align(nt._net_send_buffer_size, sizeof(int)); |
1261 | 1266 |
|
1262 | 1267 | int nnetcon = nt.n_netcon; |
|
0 commit comments