Skip to content

Commit

Permalink
Write out.dat only if SONATA reports are not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jorblancoa committed Dec 3, 2024
1 parent 95b14c9 commit 628521f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/coreneuron/io/output_spikes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,19 @@ void output_spike_populations(const SpikesInfo& spikes_info) {
}
#endif // ENABLE_SONATA_REPORTS

/** Write generated spikes to out.dat using mpi parallel i/o.
/** Write generated spikes to either:
* - out.h5 using libsonatareport API when SONATA reports are enabled
* - out.dat using mpi parallel i/o when SONATA reports are disabled
* \todo : MPI related code should be factored into nrnmpi.c
* Check spike record length which is set to 64 chars
*/
static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes_info) {
#ifdef ENABLE_SONATA_REPORTS
sonata_create_spikefile(outpath, spikes_info.file_name.data());
output_spike_populations(spikes_info);
sonata_write_spike_populations();
sonata_close_spikefile();
#else
std::stringstream ss;
ss << outpath << "/out.dat";
std::string fname = ss.str();
Expand All @@ -203,12 +211,6 @@ static void output_spikes_parallel(const char* outpath, const SpikesInfo& spikes
if (nrnmpi_myid == 0) {
remove(fname.c_str());
}
#ifdef ENABLE_SONATA_REPORTS
sonata_create_spikefile(outpath, spikes_info.file_name.data());
output_spike_populations(spikes_info);
sonata_write_spike_populations();
sonata_close_spikefile();
#endif // ENABLE_SONATA_REPORTS

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

free(spike_data);
#endif // ENABLE_SONATA_REPORTS
}
#endif

Expand Down

0 comments on commit 628521f

Please sign in to comment.