diff --git a/src/communication/communicator.hpp b/src/communication/communicator.hpp index 4480f4d777e896be6bc22f3dec7f20666b4fbf45..e59e15f5b2bf5ab7482ad9ce0c11fb0ea1359638 100644 --- a/src/communication/communicator.hpp +++ b/src/communication/communicator.hpp @@ -92,14 +92,14 @@ public: /// events in each queue are all events that must be delivered to targets in that cell /// group as a result of the global spike exchange. std::vector<event_queue> exchange(const std::vector<spike_type>& local_spikes, - std::function<void (std::vector<spike_type>)> export_function) //const std::vector<spike_type>& + std::function<void (const std::vector<spike_type>&)> export_function) //const std::vector<spike_type>& { // global all-to-all to gather a local copy of the global spike list on each node. bool file_per_rank = true; if (file_per_rank) { - export_function(); //local_spikes + export_function(local_spikes); //local_spikes } diff --git a/src/communication/exporter_interface.hpp b/src/communication/exporter_interface.hpp index 579577e369b2a53c11cdf9c9a5cd51a5f53e930d..3fb101a7dc4eeef06acc2f8f6de5a99f8fc8b638 100644 --- a/src/communication/exporter_interface.hpp +++ b/src/communication/exporter_interface.hpp @@ -25,7 +25,7 @@ public: virtual void add_data(std::vector<spike_type>) = 0; - virtual void add_and_export() = 0; + virtual void add_and_export(const std::vector<spike_type>&) = 0; // Internal state is ok diff --git a/src/communication/exporter_spike_file.hpp b/src/communication/exporter_spike_file.hpp index 8c31385166218437e108bd314125c377268aa409..580efa56becfeb8ff6dc1385780a9e7a110124fd 100644 --- a/src/communication/exporter_spike_file.hpp +++ b/src/communication/exporter_spike_file.hpp @@ -86,9 +86,9 @@ public: } // Add and export data to file in a single function - void add_and_export() override //std::vector<spike_type>spikes + void add_and_export(const std::vector<spike_type>& spikes) override //std::vector<spike_type>spikes { - std::vector<spike_type>spikes; + add_data(spikes); do_export(); } diff --git a/src/communication/exporter_spike_single_file.hpp b/src/communication/exporter_spike_single_file.hpp index c3eaa287ea3eb3d5ca9814425ba71af9fcc1ec85..b22d77c011ef21d31195b290c4d5566d93817f11 100644 --- a/src/communication/exporter_spike_single_file.hpp +++ b/src/communication/exporter_spike_single_file.hpp @@ -99,9 +99,8 @@ public: } // Add and export data to file in a single function - void add_and_export() override + void add_and_export(const std::vector<spike_type>& spikes) override { - std::vector<spike_type>spikes; if (!communication_policy_.id() == 0) { return; } diff --git a/src/model.hpp b/src/model.hpp index 02b7b370756d06eccd48ddadf77350efbd496985..f7e22d28c939c6fb1f81bd41e7a127d6f5a6d3cd 100644 --- a/src/model.hpp +++ b/src/model.hpp @@ -14,6 +14,7 @@ #include <communication/global_policy.hpp> #include <communication/exporter_interface.hpp> #include <communication/exporter_spike_single_file.hpp> +#include <communication/exporter_spike_file.hpp> #include <profiling/profiler.hpp> #include "trace_sampler.hpp" @@ -138,11 +139,11 @@ public: PE("stepping", "exchange"); auto local_spikes = previous_spikes().gather(); future_events() = communicator_.exchange(local_spikes, -// [&] { exporter_->add_and_export(std::vector<spike_type> spikes); }); - [&] { exporter_->add_and_export(std::vector<spike_type> spikes); }); + [&] (const std::vector<spike_type>& spikes){ exporter_->add_and_export(spikes); }); PL(2); }; + // run the tasks, overlapping if the threading model and number of // available threads permits it. threading::task_group g; @@ -194,7 +195,7 @@ private: util::double_buffer< local_spike_store_type > local_spikes_; using exporter_interface_type = nest::mc::communication::exporter_interface<time_type, communication::global_policy>; - using exporter_spike_single_file_type = nest::mc::communication::exporter_spike_single_file<time_type, communication::global_policy>; + using exporter_spike_single_file_type = nest::mc::communication::exporter_spike_file<time_type, communication::global_policy>; std::unique_ptr<exporter_interface_type> exporter_; // Convenience functions that map the spike buffers and event queues onto