2727#include < knp/synapse-traits/stdp_synaptic_resource_rule.h>
2828
2929#include < spdlog/spdlog.h>
30+ #include < spdlog/fmt/fmt.h>
3031
3132#include < algorithm>
3233#include < mutex>
@@ -65,12 +66,12 @@ constexpr bool is_forcing<knp::core::Projection<synapse_traits::DeltaSynapse>>()
6566template <typename ProjectionType>
6667MessageQueue::const_iterator calculate_delta_synapse_projection_data (
6768 ProjectionType &projection, std::vector<core::messaging::SpikeMessage> &messages, MessageQueue &future_messages,
68- size_t step_n,
69+ const size_t step_n,
6970 std::function<knp::synapse_traits::synapse_parameters<knp::synapse_traits::DeltaSynapse>(
7071 const typename ProjectionType::SynapseParameters &)>
7172 sp_getter = [](const typename ProjectionType::SynapseParameters &synapse_params) { return synapse_params; })
7273{
73- SPDLOG_TRACE (" Calculating delta synapse projection data... " );
74+ SPDLOG_TRACE (" Calculating delta synapse projection data for the step = {} " , step_n );
7475 using SynapseType = typename ProjectionType::ProjectionSynapseType;
7576 WeightUpdateSTDP<SynapseType>::init_projection (projection, messages, step_n);
7677
@@ -80,6 +81,7 @@ MessageQueue::const_iterator calculate_delta_synapse_projection_data(
8081 for (const auto &spiked_neuron_index : message_data)
8182 {
8283 auto synapses = projection.find_synapses (spiked_neuron_index, ProjectionType::Search::by_presynaptic);
84+ SPDLOG_TRACE (" Projection synapse count for the spike = {}" , synapses.size ());
8385 for (auto synapse_index : synapses)
8486 {
8587 auto &synapse = projection[synapse_index];
@@ -94,8 +96,13 @@ MessageQueue::const_iterator calculate_delta_synapse_projection_data(
9496 static_cast <uint32_t >(std::get<core::target_neuron_id>(synapse))};
9597
9698 auto iter = future_messages.find (future_step);
99+
100+ SPDLOG_TRACE (" Synapse index = {}, synapse delay = {}, synapse weight = {}, step = {}, future step = {}" ,
101+ synapse_index, synapse_params.delay_ , synapse_params.weight_ , step_n, future_step);
102+
97103 if (iter != future_messages.end ())
98104 {
105+ SPDLOG_TRACE (" Add existing impact." );
99106 iter->second .impacts_ .push_back (impact);
100107 }
101108 else
@@ -106,11 +113,13 @@ MessageQueue::const_iterator calculate_delta_synapse_projection_data(
106113 projection.get_postsynaptic (),
107114 is_forcing<ProjectionType>(),
108115 {impact}};
116+ SPDLOG_TRACE (" Add new impact." );
109117 future_messages.insert (std::make_pair (future_step, message_out));
110118 }
111119 }
112120 }
113121 }
122+
114123 WeightUpdateSTDP<SynapseType>::modify_weights (projection);
115124 return future_messages.find (step_n);
116125}
@@ -208,6 +217,18 @@ void calculate_delta_synapse_projection_impl(
208217 SPDLOG_DEBUG (" Calculating delta synapse projection..." );
209218
210219 auto messages = endpoint.unload_messages <core::messaging::SpikeMessage>(projection.get_uid ());
220+
221+ SPDLOG_DEBUG (" Messages count = {}..." , messages.size ());
222+
223+ #if (SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE)
224+ for (const auto &message : messages)
225+ {
226+ SPDLOG_TRACE (" Spike from {} with spiked neurons: {}" ,
227+ std::string (message.header_ .sender_uid_ ),
228+ fmt::join (message.neuron_indexes_ , " , " ));
229+ }
230+ #endif
231+
211232 auto out_iter = calculate_delta_synapse_projection_data (projection, messages, future_messages, step_n);
212233 if (out_iter != future_messages.end ())
213234 {
0 commit comments