Skip to content

Write out.dat only if SONATA reports are not enabled #3267

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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
Loading