Skip to content

Commit 628521f

Browse files
committed
Write out.dat only if SONATA reports are not enabled
1 parent 95b14c9 commit 628521f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/coreneuron/io/output_spikes.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,19 @@ void output_spike_populations(const SpikesInfo& spikes_info) {
190190
}
191191
#endif // ENABLE_SONATA_REPORTS
192192

193-
/** Write generated spikes to out.dat using mpi parallel i/o.
193+
/** Write generated spikes to either:
194+
* - out.h5 using libsonatareport API when SONATA reports are enabled
195+
* - out.dat using mpi parallel i/o when SONATA reports are disabled
194196
* \todo : MPI related code should be factored into nrnmpi.c
195197
* Check spike record length which is set to 64 chars
196198
*/
197199
static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes_info) {
200+
#ifdef ENABLE_SONATA_REPORTS
201+
sonata_create_spikefile(outpath, spikes_info.file_name.data());
202+
output_spike_populations(spikes_info);
203+
sonata_write_spike_populations();
204+
sonata_close_spikefile();
205+
#else
198206
std::stringstream ss;
199207
ss << outpath << "/out.dat";
200208
std::string fname = ss.str();
@@ -203,12 +211,6 @@ static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes
203211
if (nrnmpi_myid == 0) {
204212
remove(fname.c_str());
205213
}
206-
#ifdef ENABLE_SONATA_REPORTS
207-
sonata_create_spikefile(outpath, spikes_info.file_name.data());
208-
output_spike_populations(spikes_info);
209-
sonata_write_spike_populations();
210-
sonata_close_spikefile();
211-
#endif // ENABLE_SONATA_REPORTS
212214

213215
sort_spikes(spikevec_time, spikevec_gid);
214216
nrnmpi_barrier();
@@ -244,6 +246,7 @@ static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes
244246
nrnmpi_write_file(fname, spike_data, num_chars);
245247

246248
free(spike_data);
249+
#endif // ENABLE_SONATA_REPORTS
247250
}
248251
#endif
249252

0 commit comments

Comments
 (0)