26 #ifndef SPIKINGGROUP_H_ 27 #define SPIKINGGROUP_H_ 38 #include <boost/serialization/vector.hpp> 39 #include <boost/serialization/map.hpp> 41 #include <boost/archive/text_oarchive.hpp> 42 #include <boost/archive/text_iarchive.hpp> 43 #include <boost/archive/binary_oarchive.hpp> 44 #include <boost/archive/binary_iarchive.hpp> 72 template<
class Archive>
73 void serialize(Archive & ar,
const unsigned int version)
81 unsigned int mpi_rank;
82 unsigned int mpi_size;
90 void lock_range(
double rank_fraction );
92 unsigned int locked_rank;
94 unsigned int locked_range;
96 static int last_locked_rank;
98 bool evolve_locally_bool;
135 virtual void virtual_serialize(boost::archive::binary_oarchive & ar,
const unsigned int version );
138 virtual void virtual_serialize(boost::archive::binary_iarchive & ar,
const unsigned int version );
249 virtual void evolve() = 0;
429 #ifdef CODE_GATHER_STATS_WAITALL_TIME 431 boost::timer waitall_timer;
432 static double waitall_time;
433 static double waitall_time2;
441 #ifdef AURYN_CODE_USE_MPI 443 #endif // AURYN_CODE_USE_MPI 447 return i/locked_range;
NeuronID get_rank_size()
Returns the size on this rank.
Definition: SpikingGroup.h:450
Locks to single rank (this is a special case of BLOCKLOCK.
Definition: SpikingGroup.h:54
virtual std::string get_output_line(NeuronID i)
Definition: SpikingGroup.cpp:809
AurynStateVector * get_existing_state_vector(std::string key)
Returns an existing state with the supplied name.
Definition: SpikingGroup.cpp:760
void conditional_evolve()
Conditional evolve functino which is called by System.
Definition: SpikingGroup.cpp:234
void set_delay(int d)
Sets axonal delay for this SpikingGroup.
Definition: SpikingGroup.cpp:345
AurynStateVector * create_state_vector(std::string key)
Creates a new state vector and throws an exception if a vector with the same name exists...
Definition: SpikingGroup.cpp:764
Tries to make a smart choice.
Definition: SpikingGroup.h:51
virtual bool load_from_file(const char *filename)
Reads current states of SpikingGroup to human-readible textfile if implemented in derived class...
Definition: SpikingGroup.cpp:585
std::string get_file_name()
Extracts the class name of the connection from the file name.
Definition: SpikingGroup.cpp:517
std::vector< AurynFloat > post_state_traces_spike_biases
Definition: SpikingGroup.h:112
bool localrank(NeuronID i)
Checks if the global NeuronID i is integrated on this MPI rank.
Definition: SpikingGroup.cpp:531
std::vector< Trace * > posttraces
Posttraces.
Definition: SpikingGroup.h:108
NeuronID global2rank(NeuronID i)
Converts global NeuronID within the SpikingGroup to the local NeuronID on this rank.
Definition: SpikingGroup.h:446
std::vector< NeuronID > SpikeContainer
Spike container type. Used for storing spikes.
Definition: auryn_definitions.h:161
NeuronID ranksize()
Returns size (num of neurons) on the current rank.
Definition: SpikingGroup.cpp:300
std::string group_name
Identifying name for object.
Definition: SpikingGroup.h:116
friend class boost::serialization::access
Definition: SpikingGroup.h:71
virtual void evolve_traces()
Evolves traces.
Definition: SpikingGroup.cpp:463
Default mode of distribution.
Definition: SpikingGroup.h:52
Abstract base class of all objects producing spikes.
Definition: SpikingGroup.h:67
NeuronID get_uid()
Get the unique ID of the class.
Definition: SpikingGroup.cpp:265
std::vector< float > AttributeContainer
Attribute container type. Used for storing spike attributes that are needed for efficient STP impleme...
Definition: auryn_definitions.h:162
SpikeContainer * get_spikes()
Returns pointer to a spike container that contains spikes which arrive in this timestep from all neur...
Definition: SpikingGroup.cpp:245
SpikingGroup(NeuronID size, NodeDistributionMode mode=AUTO)
Default constructor.
Definition: SpikingGroup.cpp:38
std::vector< Trace * > pretraces
Pretraces.
Definition: SpikingGroup.h:105
std::vector< AurynStateVector * > post_state_traces_states
Definition: SpikingGroup.h:113
AurynStateVector * get_state_vector(std::string key)
Creates a new or returns an existing state vector by name.
Definition: SpikingGroup.cpp:781
NeuronID rank_size
Stores the size of the group on this rank.
Definition: SpikingGroup.h:121
Abstract base class of synaptic traces.
Definition: Trace.h:36
Delay object for spikes which is synchronized between nodes using the SyncBuffer formalism implemente...
Definition: SpikeDelay.h:47
virtual void load_input_line(NeuronID i, const char *buf)
Definition: SpikingGroup.cpp:840
mpi::communicator * mpicommunicator
Global pointer to instance of mpi::mpicommunicator which needs to be initialized in every simulation ...
Definition: auryn_global.cpp:32
virtual void virtual_serialize(boost::archive::binary_oarchive &ar, const unsigned int version)
Implementatinon of serialize function for writing.
Definition: SpikingGroup.cpp:632
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...
Definition: SpikingGroup.cpp:457
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
bool evolve_locally()
Returns true if the calling instance has units which are integrated on the current rank...
Definition: SpikingGroup.cpp:323
bool active
Toggles group active.
Definition: SpikingGroup.h:149
std::map< std::string, AurynStateVector * > state_vectors
Definition: SpikingGroup.h:153
Definition: ABSConnection.h:38
A generic logger class that logs to screen and a log-file.
Definition: Logger.h:48
void remove_state_vector(std::string key)
Removes a state vector passed as an argument to the dictinary.
Definition: SpikingGroup.cpp:743
Trace * get_pre_trace(AurynFloat x)
Returns a pre trace with time constant x.
Definition: SpikingGroup.cpp:359
void set_clock_ptr(AurynTime *clock)
Definition: SpikingGroup.cpp:228
AurynFloat AurynState
Type for Auryn state variables (default single precision since it needs to be compatible with auryn_v...
Definition: auryn_definitions.h:160
std::string get_log_name()
Returns a string which is the combination of file and connection name for logging.
Definition: SpikingGroup.cpp:523
Tries to implement block lock.
Definition: SpikingGroup.h:53
SpikeContainer * spikes
SpikeContainers to store spikes produced during one step of evolve.
Definition: SpikingGroup.h:123
void add_state_vector(std::string key, AurynStateVector *state_vector)
Adds a state vector passed as an argument to the dictinary.
Definition: SpikingGroup.cpp:729
void add_post_trace(Trace *tr)
Adds trace to posttrace stack of a connection.
Definition: SpikingGroup.cpp:408
NeuronID get_vector_size()
Rank size but rounded up to multiples of 4 (or potentially some other and larger number in future ver...
Definition: SpikingGroup.cpp:901
float AurynFloat
Low precision floating point datatype.
Definition: auryn_definitions.h:157
virtual ~SpikingGroup()
Default destructor.
Definition: SpikingGroup.cpp:43
NeuronID calculate_rank_size(int rank=-1)
Determines rank size and stores it in local variable.
Definition: SpikingGroup.cpp:281
NeuronID rank2global(NeuronID i)
Converts local NeuronID from the local rank to a global NeuronID.
Definition: SpikingGroup.cpp:319
void push_spike(NeuronID spike)
Pushes a local NeuronID as spike into the axonal SpikeDelay buffer.
Definition: SpikingGroup.cpp:270
void free()
Frees potentially allocated memory.
Definition: SpikingGroup.cpp:182
unsigned int get_locked_range()
Returns locked range of ranks for SpikingGroups which are not distributed across all ranks...
Definition: SpikingGroup.cpp:334
void add_pre_trace(Trace *tr)
Adds trace to pretrace stack of a connection.
Definition: SpikingGroup.cpp:376
Trace * get_post_trace(AurynFloat x)
Returns a post trace with time constant x.
Definition: SpikingGroup.cpp:390
void clear_spikes()
Clears all spikes stored in the delays which is useful to reset a network during runtime.
Definition: SpikingGroup.cpp:339
NeuronID get_size()
Returns the size of the group.
Definition: SpikingGroup.cpp:304
AttributeContainer * attribs
Definition: SpikingGroup.h:124
NeuronID size
Stores the size of the group.
Definition: SpikingGroup.h:119
SpikeDelay * delay
Definition: SpikingGroup.h:144
SpikeContainer * get_spikes_immediate()
Returns pointer to SpikeContainer of spikes generated during the last evolve() step.
Definition: SpikingGroup.cpp:250
NeuronID get_post_size()
Returns the size on this rank.
Definition: SpikingGroup.cpp:314
Default AurynVectorFloat class for performance computation.
Definition: AurynVector.h:796
void set_name(std::string s)
Set connection name.
Definition: SpikingGroup.cpp:507
static AurynTime * clock_ptr
Definition: SpikingGroup.h:127
NeuronID AurynTime
Defines Auryns discrete time unit of the System clock. Change to AurynLong if 120h of simtime are not...
Definition: auryn_definitions.h:155
std::map< std::string, AurynState > state_variables
Definition: SpikingGroup.h:156
virtual bool write_to_file(const char *filename)
Writes current states of SpikingGroup to human-readible textfile if implemented in derived class...
Definition: SpikingGroup.cpp:549
void push_attribute(AurynFloat attrib)
Pushes a spike attribute into the axonal SpikeDelay buffer.
Definition: SpikingGroup.cpp:275
int get_num_spike_attributes()
Definition: SpikingGroup.cpp:915
AttributeContainer * get_attributes_immediate()
Returns pointer to Attributecontainer of spikes generated during the last evolve() step...
Definition: SpikingGroup.cpp:260
AurynState * get_state_variable(std::string key)
Creates a new group-wide state variable or returns an existing group-wide variable by name then retur...
Definition: SpikingGroup.cpp:921
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
std::vector< Trace * > post_state_traces
Post state traces.
Definition: SpikingGroup.h:111
void inc_num_spike_attributes(int x)
Instructs SpikingGroup to increase the number of spike attributes by x.
Definition: SpikingGroup.cpp:906
std::string string
Standard library string type which is imported into Auryn namespace.
Definition: auryn_definitions.h:156
std::string get_name()
Retrieves the groups name.
Definition: SpikingGroup.cpp:512
unsigned int get_locked_rank()
Returns locked rank for SpikingGroups which are not distributed across all ranks. ...
Definition: SpikingGroup.cpp:329
virtual void evolve()=0
Virtual pure evolve function which needs to be implemented by derived classes.
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
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.
Definition: SpikingGroup.cpp:255
NodeDistributionMode
Specifies howto distribute different neurons across ranks when simulation is run in parallel...
Definition: SpikingGroup.h:50
NeuronID get_pre_size()
Returns the size of the group.
Definition: SpikingGroup.cpp:309