Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
auryn::NeuronGroup Class Referenceabstract

Abstract base class for all neuron groups. More...

#include <NeuronGroup.h>

Inheritance diagram for auryn::NeuronGroup:
Inheritance graph
[legend]
Collaboration diagram for auryn::NeuronGroup:
Collaboration graph
[legend]

Public Member Functions

 NeuronGroup (NeuronID n, NodeDistributionMode mode=AUTO)
 Default constructor. More...
 
 NeuronGroup (NeuronID n, double loadmultiplier, NeuronID total)
 Old default constructor. More...
 
virtual ~NeuronGroup ()
 
virtual void clear ()=0
 
void set_state (std::string name, AurynState val)
 Conveniently sets all values in a state vector identified by name in this group. More...
 
void set_state (std::string name, NeuronID i, AurynState val)
 Conveniently sets a single value of element i in a state vector identified by name in this group. More...
 
virtual AurynStateVectorget_default_exc_target ()
 Returns default exc target input. More...
 
virtual AurynStateVectorget_default_inh_target ()
 Returns default inh target input. More...
 
void random_mem (AurynState mean=-60e-3, AurynState sigma=5e-3)
 
virtual void init_state ()
 
void safe_tadd (NeuronID id, AurynWeight amount, TransmitterType t=GLUT)
 
void tadd (NeuronID id, AurynWeight amount, TransmitterType t=GLUT)
 
void tadd (AurynStateVector *state, NeuronID id, AurynWeight amount)
 
- Public Member Functions inherited from auryn::SpikingGroup
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...
 
AurynStateVectorfind_state_vector (std::string key)
 Returns existing state vector by name or NULL if it does not exist. More...
 
AurynStateVectorget_state_vector (std::string key)
 Creates a new or returns an existing state vector by name. More...
 
AurynStateVectorget_existing_state_vector (std::string key)
 Returns an existing state with the supplied name. More...
 
AurynStateVectorcreate_state_vector (std::string key)
 Creates a new state vector and throws an exception if a vector with the same name exists. More...
 
AurynStateget_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...
 
SpikeContainerget_spikes ()
 Returns pointer to a spike container that contains spikes which arrive in this timestep from all neurons in this group. More...
 
SpikeContainerget_spikes_immediate ()
 Returns pointer to SpikeContainer of spikes generated during the last evolve() step. More...
 
AttributeContainerget_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...
 
AttributeContainerget_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...
 
Traceget_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...
 
Traceget_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...
 
Traceget_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...
 
Traceget_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

AurynStateVectormem
 
AurynStateVectorg_ampa
 
AurynStateVectorg_gaba
 
AurynStateVectorg_nmda
 
AurynStateVectorthr
 
- Public Attributes inherited from auryn::SpikingGroup
SpikeDelaydelay
 
bool active
 Toggles group active. More...
 
std::map< std::string, AurynStateVector * > state_vectors
 
std::map< std::string, AurynStatestate_variables
 

Protected Member Functions

void init ()
 
void free ()
 
- Protected Member Functions inherited from auryn::SpikingGroup
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

AurynStateVectordefault_exc_target_state
 
AurynStateVectordefault_inh_target_state
 
- Protected Attributes inherited from auryn::SpikingGroup
std::vector< Trace * > pretraces
 Pretraces. More...
 
std::vector< Trace * > posttraces
 Posttraces. More...
 
std::vector< Trace * > post_state_traces
 Post state traces. More...
 
std::vector< AurynFloatpost_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...
 
SpikeContainerspikes
 SpikeContainers to store spikes produced during one step of evolve. More...
 
AttributeContainerattribs
 

Additional Inherited Members

- Static Protected Attributes inherited from auryn::SpikingGroup
static AurynTimeclock_ptr = NULL
 

Detailed Description

Abstract base class for all neuron groups.

This class constitutes the abstract forefather of all neuron groups in the simulator. It serves as target for Connection objects and is directly derived from SpikingGroup. It directly allocated the memory for mem (membrane potential) and the synaptic conductantes (g_ampa, g_gaba, g_nmda) as well as a vector to store the thresholds. The detailed implementation of the evolve() function depends on the children of NeuronGroup.

Constructor & Destructor Documentation

◆ NeuronGroup() [1/2]

NeuronGroup::NeuronGroup ( NeuronID  n,
NodeDistributionMode  mode = AUTO 
)

Default constructor.

36  : SpikingGroup( n, mode )
37 {
38  if ( evolve_locally() ) init();
39 }
void init()
Definition: NeuronGroup.cpp:41
SpikingGroup(NeuronID size, NodeDistributionMode mode=AUTO)
Default constructor.
Definition: SpikingGroup.cpp:38
int n
Definition: mkpat.py:5
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
Here is the call graph for this function:

◆ NeuronGroup() [2/2]

NeuronGroup::NeuronGroup ( NeuronID  n,
double  loadmultiplier,
NeuronID  total 
)

Old default constructor.

Deprecated:
30  : SpikingGroup( n )
31 {
32  logger->warning("Using deprecated constructor of NeuronGroup with loadmultiplier. This feature is discontinued and the constructor will be removed in future versions.");
33  if ( evolve_locally() ) init();
34 }
void init()
Definition: NeuronGroup.cpp:41
SpikingGroup(NeuronID size, NodeDistributionMode mode=AUTO)
Default constructor.
Definition: SpikingGroup.cpp:38
int n
Definition: mkpat.py:5
void warning(std::string text)
Definition: Logger.cpp:136
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
Here is the call graph for this function:

◆ ~NeuronGroup()

NeuronGroup::~NeuronGroup ( )
virtual

Default destructor

76 {
77  if ( evolve_locally() ) free();
78 }
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
void free()
Definition: NeuronGroup.cpp:70
Here is the call graph for this function:

Member Function Documentation

◆ clear()

virtual void auryn::NeuronGroup::clear ( )
pure virtual

◆ free()

void NeuronGroup::free ( )
protected

Called by default destructor

71 {
72 }

◆ get_default_exc_target()

AurynStateVector * NeuronGroup::get_default_exc_target ( )
virtual

Returns default exc target input.

140 {
142 }
AurynStateVector * default_exc_target_state
Definition: NeuronGroup.h:50

◆ get_default_inh_target()

AurynStateVector * NeuronGroup::get_default_inh_target ( )
virtual

Returns default inh target input.

145 {
147 }
AurynStateVector * default_inh_target_state
Definition: NeuronGroup.h:51

◆ init()

void NeuronGroup::init ( )
protected

Init procedure called by default constructor.

42 { group_name = "NeuronGroup";
43 
44  // std::stringstream oss;
45  // oss << description_std::string << " init";
46  // auryn::logger->msg(oss.str(),VERBOSE);
47 
48  mem = get_state_vector("mem");
49  thr = get_state_vector("thr");
50  g_ampa = get_state_vector("g_ampa");
51  g_gaba = get_state_vector("g_gaba");
52  g_nmda = get_state_vector("g_nmda");
53 
56 
57 #ifndef CODE_ALIGNED_SSE_INSTRUCTIONS
58  // checking via default if those arrays are aligned
59  if ( auryn_AlignOffset( mem->size, mem->data, sizeof(float), 16)
60  || auryn_AlignOffset( thr->size, thr->data, sizeof(float), 16)
61  || auryn_AlignOffset( g_ampa->size, g_ampa->data, sizeof(float), 16)
62  || auryn_AlignOffset( g_nmda->size, g_nmda->data, sizeof(float), 16)
63  || auryn_AlignOffset( g_gaba->size, g_gaba->data, sizeof(float), 16)
64  )
66 #endif
67 }
T * data
Pointer to the array housing the data.
Definition: AurynVector.h:154
std::string group_name
Identifying name for object.
Definition: SpikingGroup.h:116
AurynStateVector * get_state_vector(std::string key)
Creates a new or returns an existing state vector by name.
Definition: SpikingGroup.cpp:781
IndexType size
Size of the vector.
Definition: AurynVector.h:151
AurynStateVector * g_ampa
Definition: NeuronGroup.h:66
Definition: auryn_definitions.h:265
AurynStateVector * default_inh_target_state
Definition: NeuronGroup.h:51
AurynStateVector * default_exc_target_state
Definition: NeuronGroup.h:50
int auryn_AlignOffset(const int N, const void *vp, const int inc, const int align)
Determines memory alignment (adapted from ATLAS library)
Definition: auryn_definitions.cpp:34
AurynStateVector * g_nmda
Definition: NeuronGroup.h:70
AurynStateVector * g_gaba
Definition: NeuronGroup.h:68
AurynStateVector * mem
Definition: NeuronGroup.h:64
AurynStateVector * thr
Definition: NeuronGroup.h:75
Here is the call graph for this function:

◆ init_state()

void NeuronGroup::init_state ( )
virtual
94 {
95 
96 }

◆ random_mem()

void NeuronGroup::random_mem ( AurynState  mean = -60e-3,
AurynState  sigma = 5e-3 
)
82 {
83  randomize_state_vector_gauss("mem",mean,sigma,42);
84  init_state();
85 }
virtual void init_state()
Definition: NeuronGroup.cpp:93
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...
Definition: SpikingGroup.cpp:792
Here is the call graph for this function:

◆ safe_tadd()

void NeuronGroup::safe_tadd ( NeuronID  id,
AurynWeight  amount,
TransmitterType  t = GLUT 
)
88 {
89  if (localrank(id))
90  tadd(id, amount, t);
91 }
bool localrank(NeuronID i)
Checks if the global NeuronID i is integrated on this MPI rank.
Definition: SpikingGroup.cpp:531
void tadd(NeuronID id, AurynWeight amount, TransmitterType t=GLUT)
Definition: NeuronGroup.cpp:98
Here is the call graph for this function:

◆ set_state() [1/2]

void NeuronGroup::set_state ( std::string  name,
AurynState  val 
)

Conveniently sets all values in a state vector identified by name in this group.

This sets all values in a state vector identified by its string name. All string identified operations are slow, so do not use them in evolve or propagate functions, but only for initialization.

Parameters
nameThe state name to address
valThe value to set all entries to
133 {
134  AurynStateVector * tmp = find_state_vector(name);
135  if (tmp) tmp->set_all(val);
136  else { logger->warning("State not found."); }
137 }
void set_all(const T v)
Set all elements to value v.
Definition: AurynVector.h:232
void warning(std::string text)
Definition: Logger.cpp:136
AurynStateVector * find_state_vector(std::string key)
Returns existing state vector by name or NULL if it does not exist.
Definition: SpikingGroup.cpp:748
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Default AurynVectorFloat class for performance computation.
Definition: AurynVector.h:796
Here is the call graph for this function:

◆ set_state() [2/2]

void NeuronGroup::set_state ( std::string  name,
NeuronID  i,
AurynState  val 
)

Conveniently sets a single value of element i in a state vector identified by name in this group.

Parameters
nameThe state name to address
iThe local neuron id to set (this needs to be a translated value for MPI simulations)
valThe value to set all entries to.
126 {
127  AurynStateVector * tmp = find_state_vector(name);
128  if (tmp) { tmp->set(i,val); }
129  else { logger->warning("State not found."); }
130 }
void warning(std::string text)
Definition: Logger.cpp:136
void set(IndexType i, T value)
Sets element i in vector to value.
Definition: AurynVector.h:224
AurynStateVector * find_state_vector(std::string key)
Returns existing state vector by name or NULL if it does not exist.
Definition: SpikingGroup.cpp:748
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Default AurynVectorFloat class for performance computation.
Definition: AurynVector.h:796
Here is the call graph for this function:

◆ tadd() [1/2]

void NeuronGroup::tadd ( NeuronID  id,
AurynWeight  amount,
TransmitterType  t = GLUT 
)

Adds given transmitter to neuron as from a synaptic event. DEPRECATED. Moving slowly to SparseConnection transmit.

99 {
100  NeuronID localid = global2rank(id);
101  switch ( t ) {
102  case GABA:
103  g_gaba->add_specific(localid,amount);
104  break;
105  case MEM:
106  mem->add_specific(localid,amount);
107  break;
108  case NMDA:
109  g_nmda->add_specific(localid,amount);
110  break;
111  case GLUT:
112  case AMPA:
113  default:
114  g_ampa->add_specific(localid,amount);
115  }
116 }
Current based synapse. Adds the transmitted quantity directly to membrane voltage.
Definition: auryn_definitions.h:143
Standard Glutamatergic (excitatory) transmission.
Definition: auryn_definitions.h:139
NeuronID global2rank(NeuronID i)
Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank.
Definition: SpikingGroup.h:446
Only targets NMDA.
Definition: auryn_definitions.h:142
AurynStateVector * g_ampa
Definition: NeuronGroup.h:66
AurynStateVector * g_nmda
Definition: NeuronGroup.h:70
Standard Gabaergic (inhibitory) transmission.
Definition: auryn_definitions.h:140
Only targets AMPA channels.
Definition: auryn_definitions.h:141
void add_specific(const IndexType i, const T c)
Adds the value c to specific vector element i.
Definition: AurynVector.h:263
AurynStateVector * g_gaba
Definition: NeuronGroup.h:68
AurynStateVector * mem
Definition: NeuronGroup.h:64
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
Here is the call graph for this function:

◆ tadd() [2/2]

void NeuronGroup::tadd ( AurynStateVector state,
NeuronID  id,
AurynWeight  amount 
)

Adds given amount of transmitter to neuron state/id.

120 {
121  NeuronID localid = global2rank(id);
122  state->add_specific( localid, amount);
123 }
NeuronID global2rank(NeuronID i)
Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank.
Definition: SpikingGroup.h:446
void add_specific(const IndexType i, const T c)
Adds the value c to specific vector element i.
Definition: AurynVector.h:263
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
Here is the call graph for this function:

Member Data Documentation

◆ default_exc_target_state

AurynStateVector* auryn::NeuronGroup::default_exc_target_state
protected

◆ default_inh_target_state

AurynStateVector* auryn::NeuronGroup::default_inh_target_state
protected

◆ g_ampa

AurynStateVector* auryn::NeuronGroup::g_ampa

Stores the AMPA conductances of each point neuron.

◆ g_gaba

AurynStateVector* auryn::NeuronGroup::g_gaba

Stores the GABA conductances of each point neuron.

◆ g_nmda

AurynStateVector* auryn::NeuronGroup::g_nmda

Stores the NMDA conductances of each point neuron.

◆ mem

AurynStateVector* auryn::NeuronGroup::mem

Stores the membrane potentials.

◆ thr

AurynStateVector* auryn::NeuronGroup::thr

Stores threshold terms for moving thresholds.

TODO Remove and move to downstream.


The documentation for this class was generated from the following files: