Spike!  v1.0
A high speed Spiking Neural Network Simulator designed for GPGPUs.
STDP/vanRossumSTDP.h
00001 // vanRossum STDP Class Header
00002 // vanRossumSTDP.h
00003 //
00004 // This STDP learning rule is extracted from the following paper:
00005 
00006 //  Rossum, M. C. van, G. Q. Bi, and G. G. Turrigiano. 2000. “Stable Hebbian Learning from Spike Timing-Dependent Plasticity.” The Journal of Neuroscience: The Official Journal of the Society for Neuroscience 20 (23): 8812–21.
00007 
00008 // This equation is based upon the multiplicative learning rule without the gaussian random variable
00009 // The default parameters are also those used in the above paper
00010 //  Author: Nasir Ahmad
00011 //  Date: 03/10/2016
00012 
00013 #ifndef VANROSSUM_STDP_H
00014 #define VANROSSUM_STDP_H
00015 
00016 // Get Synapses & Neurons Class
00017 #include "../Synapses/SpikingSynapses.h"
00018 #include "../Neurons/SpikingNeurons.h"
00019 #include "../STDP/STDP.h"
00020 
00021 // stdlib allows random numbers
00022 #include <stdlib.h>
00023 // Input Output
00024 #include <stdio.h>
00025 // allows maths
00026 #include <math.h>
00027 
00028 #include <cuda.h>
00029 
00030 
00031 // STDP Parameters
00032 struct vanrossum_stdp_parameters_struct : stdp_parameters_struct {
00033     vanrossum_stdp_parameters_struct() : a_minus(0.003), a_plus(7.0f*pow(10.0, -12)), tau_minus(0.02f), tau_plus(0.02f) { } // default Constructor
00034     // STDP Parameters
00035     float a_minus;
00036     float a_plus;
00037     float tau_minus;
00038     float tau_plus;
00039 
00040 };
00041 
00042 
00043 class vanRossumSTDP : public STDP{
00044 public:
00045 
00046     // Constructor/Destructor
00047     vanRossumSTDP();
00048     ~vanRossumSTDP();
00049 
00050     struct vanrossum_stdp_parameters_struct* stdp_params;
00051     SpikingSynapses* syns;
00052     SpikingNeurons* neurs;
00053     int* index_of_last_afferent_synapse_to_spike;
00054     int* d_index_of_last_afferent_synapse_to_spike;
00055     bool* isindexed_ltd_synapse_spike;
00056     bool* d_isindexed_ltd_synapse_spike;
00057     int* index_of_first_synapse_spiked_after_postneuron;
00058     int* d_index_of_first_synapse_spiked_after_postneuron;
00059 
00060     // Pointers
00061     virtual void allocate_device_pointers();
00062     // Pointers
00063     virtual void reset_STDP_activities();
00064     // Set STDP Parameters
00065     virtual void Set_STDP_Parameters(SpikingSynapses* synapses, SpikingNeurons* neurons, SpikingNeurons* input_neurons, stdp_parameters_struct* stdp_parameters);
00066     // STDP
00067     virtual void Run_STDP(float* d_last_spike_time_of_each_neuron, float current_time_in_seconds, float timestep);
00068     // LTP & LTD for this model
00069     void apply_stdp_to_synapse_weights(float* d_last_spike_time_of_each_neuron, float current_time_in_seconds);
00070 
00071 };
00072 
00073 
00074 // Kernel to carry out LTP/LTD
00075 __global__ void vanrossum_apply_stdp_to_synapse_weights_kernel(int* d_postsyns,
00076                             float* d_last_spike_time_of_each_neuron,
00077                             bool* d_stdp,
00078                             float* d_time_of_last_spike_to_reach_synapse,
00079                             float* d_synaptic_efficacies_or_weights,
00080                             int* d_index_of_last_afferent_synapse_to_spike,
00081                             bool* d_isindexed_ltd_synapse_spike,
00082                             int* d_index_of_first_synapse_spiked_after_postneuron,
00083                             struct vanrossum_stdp_parameters_struct stdp_vars,
00084                             float currtime,
00085                             size_t total_number_of_post_neurons);
00086 
00087 __global__ void vanrossum_get_indices_to_apply_stdp(int* d_postsyns,
00088                             float* d_last_spike_time_of_each_neuron,
00089                             bool* d_stdp,
00090                             float* d_time_of_last_spike_to_reach_synapse,
00091                             int* d_index_of_last_afferent_synapse_to_spike,
00092                             bool* d_isindexed_ltd_synapse_spike,
00093                             int* d_index_of_first_synapse_spiked_after_postneuron,
00094                             float currtime,
00095                             size_t total_number_of_synapse);
00096 
00097 #endif
 All Classes Files Functions Variables Enumerations