Auryn simulator
v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
|
Abstract base class of all objects producing spikes. More...
#include <SpikingGroup.h>
Public Member Functions | |
void | add_state_vector (std::string key, AurynStateVector *state_vector) |
Adds a state vector passed as an argument to the dictinary. More... | |
void | remove_state_vector (std::string key) |
Removes a state vector passed as an argument to the dictinary. More... | |
AurynStateVector * | find_state_vector (std::string key) |
Returns existing state vector by name or NULL if it does not exist. More... | |
AurynStateVector * | get_state_vector (std::string key) |
Creates a new or returns an existing state vector by name. More... | |
AurynStateVector * | get_existing_state_vector (std::string key) |
Returns an existing state with the supplied name. More... | |
AurynStateVector * | create_state_vector (std::string key) |
Creates a new state vector and throws an exception if a vector with the same name exists. More... | |
AurynState * | get_state_variable (std::string key) |
Creates a new group-wide state variable or returns an existing group-wide variable by name then returns a pointer to it. More... | |
void | randomize_state_vector_gauss (std::string state_vector_name, AurynState mean, AurynState sigma, int seed=12239) |
Randomizes the content of a state vector with Gaussian random numbers. Seeding is MPI save. More... | |
SpikingGroup (NeuronID size, NodeDistributionMode mode=AUTO) | |
Default constructor. More... | |
virtual | ~SpikingGroup () |
Default destructor. More... | |
virtual void | evolve_traces () |
Evolves traces. More... | |
void | set_name (std::string s) |
Set connection name. More... | |
std::string | get_name () |
Retrieves the groups name. More... | |
std::string | get_file_name () |
Extracts the class name of the connection from the file name. More... | |
std::string | get_log_name () |
Returns a string which is the combination of file and connection name for logging. More... | |
void | inc_num_spike_attributes (int x) |
Instructs SpikingGroup to increase the number of spike attributes by x. More... | |
int | get_num_spike_attributes () |
virtual void | evolve ()=0 |
Virtual pure evolve function which needs to be implemented by derived classes. More... | |
void | conditional_evolve () |
Conditional evolve functino which is called by System. More... | |
unsigned int | get_locked_rank () |
Returns locked rank for SpikingGroups which are not distributed across all ranks. More... | |
unsigned int | get_locked_range () |
Returns locked range of ranks for SpikingGroups which are not distributed across all ranks. More... | |
SpikeContainer * | get_spikes () |
Returns pointer to a spike container that contains spikes which arrive in this timestep from all neurons in this group. More... | |
SpikeContainer * | get_spikes_immediate () |
Returns pointer to SpikeContainer of spikes generated during the last evolve() step. More... | |
AttributeContainer * | get_attributes () |
Returns pointer to Attributecontainer for usage in propagating Connection objects. Same as get_spikes_immediate(), however might be overwritten to contain Spikes that have been delayed. More... | |
AttributeContainer * | get_attributes_immediate () |
Returns pointer to Attributecontainer of spikes generated during the last evolve() step. More... | |
NeuronID | get_size () |
Returns the size of the group. More... | |
NeuronID | get_pre_size () |
Returns the size of the group. More... | |
NeuronID | calculate_rank_size (int rank=-1) |
Determines rank size and stores it in local variable. More... | |
NeuronID | get_rank_size () |
Returns the size on this rank. More... | |
NeuronID | get_post_size () |
Returns the size on this rank. More... | |
void | set_clock_ptr (AurynTime *clock) |
bool | evolve_locally () |
Returns true if the calling instance has units which are integrated on the current rank. More... | |
NeuronID | get_uid () |
Get the unique ID of the class. More... | |
Trace * | get_pre_trace (AurynFloat x) |
Returns a pre trace with time constant x. More... | |
void | add_pre_trace (Trace *tr) |
Adds trace to pretrace stack of a connection. More... | |
Trace * | get_post_trace (AurynFloat x) |
Returns a post trace with time constant x. More... | |
void | add_post_trace (Trace *tr) |
Adds trace to posttrace stack of a connection. More... | |
void | push_spike (NeuronID spike) |
Pushes a local NeuronID as spike into the axonal SpikeDelay buffer. More... | |
void | push_attribute (AurynFloat attrib) |
Pushes a spike attribute into the axonal SpikeDelay buffer. More... | |
void | clear_spikes () |
Clears all spikes stored in the delays which is useful to reset a network during runtime. More... | |
Trace * | get_post_state_trace (std::string state_name="mem", AurynFloat tau=10e-3, AurynFloat b=0.0) |
Returns a post trace of a neuronal state variable e.g. the membrane potential with time constant tau. More... | |
Trace * | get_post_state_trace (AurynStateVector *state, AurynFloat tau=10e-3, AurynFloat b=0.0) |
Returns a post trace of a neuronal state variable specified by pointer. More... | |
void | set_delay (int d) |
Sets axonal delay for this SpikingGroup. More... | |
virtual bool | write_to_file (const char *filename) |
Writes current states of SpikingGroup to human-readible textfile if implemented in derived class. More... | |
virtual bool | load_from_file (const char *filename) |
Reads current states of SpikingGroup to human-readible textfile if implemented in derived class. More... | |
NeuronID | ranksize () |
Returns size (num of neurons) on the current rank. More... | |
NeuronID | global2rank (NeuronID i) |
Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank. More... | |
NeuronID | rank2global (NeuronID i) |
Converts local NeuronID from the local rank to a global NeuronID. More... | |
bool | localrank (NeuronID i) |
Checks if the global NeuronID i is integrated on this MPI rank. More... | |
NeuronID | get_vector_size () |
Rank size but rounded up to multiples of 4 (or potentially some other and larger number in future versions) for SSE compatibility. More... | |
Public Attributes | |
SpikeDelay * | delay |
bool | active |
Toggles group active. More... | |
std::map< std::string, AurynStateVector * > | state_vectors |
std::map< std::string, AurynState > | state_variables |
Protected Member Functions | |
virtual void | load_input_line (NeuronID i, const char *buf) |
virtual std::string | get_output_line (NeuronID i) |
virtual void | virtual_serialize (boost::archive::binary_oarchive &ar, const unsigned int version) |
Implementatinon of serialize function for writing. More... | |
virtual void | virtual_serialize (boost::archive::binary_iarchive &ar, const unsigned int version) |
Implementatinon of serialize function for reading. More... | |
void | free () |
Frees potentially allocated memory. More... | |
Protected Attributes | |
std::vector< Trace * > | pretraces |
Pretraces. More... | |
std::vector< Trace * > | posttraces |
Posttraces. More... | |
std::vector< Trace * > | post_state_traces |
Post state traces. More... | |
std::vector< AurynFloat > | post_state_traces_spike_biases |
std::vector< AurynStateVector * > | post_state_traces_states |
std::string | group_name |
Identifying name for object. More... | |
NeuronID | size |
Stores the size of the group. More... | |
NeuronID | rank_size |
Stores the size of the group on this rank. More... | |
SpikeContainer * | spikes |
SpikeContainers to store spikes produced during one step of evolve. More... | |
AttributeContainer * | attribs |
Static Protected Attributes | |
static AurynTime * | clock_ptr = NULL |
Friends | |
class | boost::serialization::access |
Abstract base class of all objects producing spikes.
This is the abstract/virtual base class from which all spiking objects should be derived. All classes derived from SpikingGroup have in common that they can emit spikes. Furthermore they should implement the method evolve() for carring out internal state changes such as integration of the e.g. Euler Step. Other classes interact with inheritants of SpikingGroup by calling the functions get_spikes() and get_spikes_immediate().
SpikingGroup::SpikingGroup | ( | NeuronID | size, |
NodeDistributionMode | mode = AUTO |
||
) |
|
virtual |
Default destructor.
void SpikingGroup::add_post_trace | ( | Trace * | tr | ) |
Adds trace to posttrace stack of a connection.
Mostly for internal use by get_post_trace()
void SpikingGroup::add_pre_trace | ( | Trace * | tr | ) |
Adds trace to pretrace stack of a connection.
Mostly for internal use by get_pre_trace()
tr | A pointer to a presynaptic trace instance to be added to the present SpikingGroup |
void SpikingGroup::add_state_vector | ( | std::string | key, |
AurynStateVector * | state_vector | ||
) |
Adds a state vector passed as an argument to the dictinary.
NeuronID SpikingGroup::calculate_rank_size | ( | int | rank = -1 | ) |
Determines rank size and stores it in local variable.
void SpikingGroup::clear_spikes | ( | ) |
Clears all spikes stored in the delays which is useful to reset a network during runtime.
void SpikingGroup::conditional_evolve | ( | ) |
Conditional evolve functino which is called by System.
This function invoces evolve if the present group has work to be done on the current rank. Thus the call of evolve is made conditional on the fact if there is work to be done for this group on the present rank. This is only important for MPI parallel simulations.
AurynStateVector * SpikingGroup::create_state_vector | ( | std::string | key | ) |
Creates a new state vector and throws an exception if a vector with the same name exists.
Returns a new state vector with the given key and returns an exception if a vector with the same key already exists. Moreover, NULL is returned if the state vector would have length 0 otherwise.
AurynDelayTooSmallException | if a state vector with the same key already exists. |
key | The key of the state vector to be created. |
|
pure virtual |
Virtual pure evolve function which needs to be implemented by derived classes.
The evolve function is called during simulations in every timestep by the System class. It updates the internal state of the spiking group and pushes spikes which are generated in this timestep to the axonal output delay (SpikeDelay).
Implemented in auryn::StimulusGroup, auryn::AdExGroup, auryn::MovingBumpGroup, auryn::ModSynIFGroup, auryn::IFGroup, auryn::NaudGroup, auryn::IafPscExpGroup, auryn::TIFGroup, auryn::IzhikevichGroup, auryn::CorrelatedPoissonGroup, auryn::SRM0Group, auryn::InputChannelGroup, auryn::AuditoryBeepGroup, auryn::CubaIFGroup, auryn::FileInputGroup, auryn::AIFGroup, auryn::ProfilePoissonGroup, auryn::PoissonGroup, auryn::StructuredPoissonGroup, auryn::IafPscDeltaGroup, auryn::SpikeTimingStimGroup, auryn::AIF2Group, auryn::FileModulatedPoissonGroup, auryn::ParrotGroup, and auryn::PoissonSpikeInjector.
bool SpikingGroup::evolve_locally | ( | ) |
|
virtual |
Evolves traces.
AurynStateVector * SpikingGroup::find_state_vector | ( | std::string | key | ) |
Returns existing state vector by name or NULL if it does not exist.
key | A string with the name of the state vector. |
|
protected |
Frees potentially allocated memory.
AttributeContainer * SpikingGroup::get_attributes | ( | ) |
Returns pointer to Attributecontainer for usage in propagating Connection objects. Same as get_spikes_immediate(), however might be overwritten to contain Spikes that have been delayed.
AttributeContainer * SpikingGroup::get_attributes_immediate | ( | ) |
Returns pointer to Attributecontainer of spikes generated during the last evolve() step.
AurynStateVector * SpikingGroup::get_existing_state_vector | ( | std::string | key | ) |
Returns an existing state with the supplied name.
key | A string with the name of the state vector. |
std::string SpikingGroup::get_file_name | ( | ) |
Extracts the class name of the connection from the file name.
unsigned int SpikingGroup::get_locked_range | ( | ) |
unsigned int SpikingGroup::get_locked_rank | ( | ) |
std::string SpikingGroup::get_log_name | ( | ) |
Returns a string which is the combination of file and connection name for logging.
std::string SpikingGroup::get_name | ( | ) |
Retrieves the groups name.
int SpikingGroup::get_num_spike_attributes | ( | ) |
|
protectedvirtual |
NeuronID SpikingGroup::get_post_size | ( | ) |
Returns the size on this rank.
It's the size that should be used when a postsynaptic trace is defined on this group, hence the name.
Trace * SpikingGroup::get_post_state_trace | ( | std::string | state_name = "mem" , |
AurynFloat | tau = 10e-3 , |
||
AurynFloat | b = 0.0 |
||
) |
Returns a post trace of a neuronal state variable e.g. the membrane potential with time constant tau.
This trace is an cotinuously integrated Trace which uses the follow function on the mem state vector.
state_name | A string stating the neurons state name |
tau | The time constant of the trace. |
b | The optional parameter b allows to specify a spike triggered contribution which will be added instantaneously to the trace upon each postsynaptic spike. |
Trace * SpikingGroup::get_post_state_trace | ( | AurynStateVector * | state, |
AurynFloat | tau = 10e-3 , |
||
AurynFloat | b = 0.0 |
||
) |
Returns a post trace of a neuronal state variable specified by pointer.
This trace is an cotinuously integrated Trace which uses the follow function on the mem state vector.
state | A pointer to the relevant state vector |
tau | The time constant of the trace. |
b | The optional parameter b allows to specify a spike triggered contribution which will be added instantaneously to the trace upon each postsynaptic spike. |
Trace * SpikingGroup::get_post_trace | ( | AurynFloat | x | ) |
Returns a post trace with time constant x.
Checks first if an instance of a trace exists and returns it otherwise creates a new instance first.
x | The timeconstant for the postsynaptic trace. |
NeuronID SpikingGroup::get_pre_size | ( | ) |
Returns the size of the group.
It's the size that should be used when a presynaptic trace is defined on this grou, hence the name.
Trace * SpikingGroup::get_pre_trace | ( | AurynFloat | x | ) |
Returns a pre trace with time constant x.
Checks first if an instance of a trace exists and returns it otherwise creates a new instance first.
x | The timeconstant for the presynaptic trace |
|
inline |
Returns the size on this rank.
NeuronID SpikingGroup::get_size | ( | ) |
Returns the size of the group.
SpikeContainer * SpikingGroup::get_spikes | ( | ) |
Returns pointer to a spike container that contains spikes which arrive in this timestep from all neurons in this group.
In paralell simulations the SpikeContainer returned is at this point in time guaranteed to contain spikes from all ranks.
SpikeContainer * SpikingGroup::get_spikes_immediate | ( | ) |
Returns pointer to SpikeContainer of spikes generated during the last evolve() step.
AurynState * SpikingGroup::get_state_variable | ( | std::string | key | ) |
Creates a new group-wide state variable or returns an existing group-wide variable by name then returns a pointer to it.
AurynStateVector * SpikingGroup::get_state_vector | ( | std::string | key | ) |
Creates a new or returns an existing state vector by name.
This function returns a state vector for the given key. If a vector with the key does not exist the function creates one. If it does exist it returns the existing one. The function returns NULL if the statevector would have zero length on that rank.
key | The key name of the state vector to be return |
NeuronID SpikingGroup::get_uid | ( | ) |
Get the unique ID of the class.
NeuronID SpikingGroup::get_vector_size | ( | ) |
Rank size but rounded up to multiples of 4 (or potentially some other and larger number in future versions) for SSE compatibility.
Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank.
The return value of global2rank is only defined if the SpikingGroup has units on the present rank.
i | The global NeuronID to convert |
void SpikingGroup::inc_num_spike_attributes | ( | int | x | ) |
Instructs SpikingGroup to increase the number of spike attributes by x.
The reason we only increment the size is that multiple Connection objects such as STPConnection might want to add an attribute to a spike. These might be different to allow synaptic type dependent plasticity and hence will all have to be transmitted without knowledge about the other synapses which might want to submit a different value.
|
virtual |
Reads current states of SpikingGroup to human-readible textfile if implemented in derived class.
|
protectedvirtual |
bool SpikingGroup::localrank | ( | NeuronID | i | ) |
Checks if the global NeuronID i is integrated on this MPI rank.
i | the NeuronID to check. |
void SpikingGroup::push_attribute | ( | AurynFloat | attrib | ) |
Pushes a spike attribute into the axonal SpikeDelay buffer.
This is for instance used to implement short-term plasticity in which each presynaptic spike is associated with a certain currently available amount of presynaptic neurotransmitter. Spike attributes are float values which can be attaced to a spike to convey this information.
void SpikingGroup::push_spike | ( | NeuronID | spike | ) |
Pushes a local NeuronID as spike into the axonal SpikeDelay buffer.
This function expectes the local NeuronID and translates the argument to a global argument.
spike | The NeuronID of the units which spiked in the current timestep |
void SpikingGroup::randomize_state_vector_gauss | ( | std::string | state_vector_name, |
AurynState | mean, | ||
AurynState | sigma, | ||
int | seed = 12239 |
||
) |
Randomizes the content of a state vector with Gaussian random numbers. Seeding is MPI save.
Converts local NeuronID from the local rank to a global NeuronID.
i | The local neuron id. |
This function performs id translation for parallel simulations from a local rank id to a global NeuronID.
NeuronID SpikingGroup::ranksize | ( | ) |
Returns size (num of neurons) on the current rank.
void SpikingGroup::remove_state_vector | ( | std::string | key | ) |
Removes a state vector passed as an argument to the dictinary.
The state vector is not freed automatically!
void SpikingGroup::set_clock_ptr | ( | AurynTime * | clock | ) |
void SpikingGroup::set_delay | ( | int | d | ) |
Sets axonal delay for this SpikingGroup.
Note the delay needs to be larger er equal to the MINDELAY defined in auryn_definitions.h
void SpikingGroup::set_name | ( | std::string | s | ) |
Set connection name.
|
protectedvirtual |
Implementatinon of serialize function for writing.
|
protectedvirtual |
Implementatinon of serialize function for reading.
|
virtual |
Writes current states of SpikingGroup to human-readible textfile if implemented in derived class.
|
friend |
bool auryn::SpikingGroup::active |
Toggles group active.
Groups do not necessarily obey this toggle though.
|
protected |
|
staticprotected |
Stores the length of output delay
SpikeDelay* auryn::SpikingGroup::delay |
|
protected |
Identifying name for object.
|
protected |
Post state traces.
|
protected |
|
protected |
|
protected |
Posttraces.
|
protected |
Pretraces.
|
protected |
Stores the size of the group on this rank.
|
protected |
Stores the size of the group.
|
protected |
SpikeContainers to store spikes produced during one step of evolve.
std::map<std::string,AurynState> auryn::SpikingGroup::state_variables |
Holds group-wide state variables such as population target rates or global protein levels etc
std::map<std::string,AurynStateVector *> auryn::SpikingGroup::state_vectors |
Can hold single neuron vectors such as target rates or STP states etc