Skip to content

Commit 4e95f67

Browse files
committed
Added stdp altai support for single threaded cpu backend: KasperskyLab#64
1 parent 078e4e5 commit 4e95f67

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

  • knp/backends/cpu

knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_dispatcher.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ inline void calculate_pre_impact_single_neuron_state_dispatch(
4141
}
4242

4343

44+
/**
45+
* @brief Calculate pre impact state of single neuron.
46+
* @param neuron Neuron.
47+
*/
48+
inline void calculate_pre_impact_single_neuron_state_dispatch(
49+
knp::neuron_traits::neuron_parameters<knp::neuron_traits::SynapticResourceSTDPAltAILIFNeuron> &neuron)
50+
{
51+
altai::calculate_pre_impact_single_neuron_state_impl(neuron);
52+
}
53+
54+
4455
/**
4556
* @brief Impact neuron.
4657
* @param neuron Neuron.

knp/backends/cpu/cpu-single-threaded-backend/impl/backend.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,17 @@ std::optional<core::messaging::SpikeMessage> SingleThreadedCPUBackend::calculate
241241
}
242242

243243

244+
std::optional<core::messaging::SpikeMessage> SingleThreadedCPUBackend::calculate_population(
245+
core::Population<neuron_traits::SynapticResourceSTDPAltAILIFNeuron> &population)
246+
{
247+
SPDLOG_TRACE(
248+
"Calculate resource-based STDP-compatible AltAI-LIF population {}.", std::string(population.get_uid()));
249+
return knp::backends::cpu::calculate_resource_stdp_population<
250+
neuron_traits::AltAILIF, synapse_traits::DeltaSynapse, ProjectionContainer>(
251+
population, projections_, get_message_endpoint(), get_step());
252+
}
253+
254+
244255
void SingleThreadedCPUBackend::calculate_projection(
245256
knp::core::Projection<knp::synapse_traits::DeltaSynapse> &projection, SynapticMessageQueue &message_queue)
246257
{

knp/backends/cpu/cpu-single-threaded-backend/include/knp/backends/cpu-single-threaded/backend.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class KNP_DECLSPEC SingleThreadedCPUBackend : public knp::core::Backend
5757
*/
5858
using SupportedNeurons = boost::mp11::mp_list<
5959
knp::neuron_traits::BLIFATNeuron, knp::neuron_traits::SynapticResourceSTDPBLIFATNeuron,
60-
knp::neuron_traits::AltAILIF>;
60+
knp::neuron_traits::AltAILIF, knp::neuron_traits::SynapticResourceSTDPAltAILIFNeuron>;
6161

6262
/**
6363
* @brief List of synapse types supported by the single-threaded CPU backend.
@@ -346,6 +346,17 @@ class KNP_DECLSPEC SingleThreadedCPUBackend : public knp::core::Backend
346346
std::optional<core::messaging::SpikeMessage> calculate_population(
347347
knp::core::Population<knp::neuron_traits::AltAILIF> &population);
348348

349+
350+
/**
351+
* @brief Calculate population of 'AltAILIF' neurons.
352+
* @note Population state will be changed during calculation.
353+
* @param population population to calculate.
354+
* @return spike message with indexes of spiked neurons if population is emitting one.
355+
*/
356+
std::optional<core::messaging::SpikeMessage> calculate_population(
357+
knp::core::Population<knp::neuron_traits::SynapticResourceSTDPAltAILIFNeuron> &population);
358+
359+
349360
/**
350361
* @brief Calculate projection of delta synapses.
351362
* @note Projection will be changed during calculation.

0 commit comments

Comments
 (0)