Auryn simulator
v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
|
Class that implements system wide variables and methods to manage and run simulations. More...
#include <System.h>
Public Member Functions | |
System (mpi::communicator *communicator) | |
Default constructor for MPI enabled. More... | |
void | set_simulation_name (std::string name) |
Sets the simulation name. More... | |
std::string | get_simulation_name () |
Returns the simulation name. More... | |
void | set_output_dir (std::string path) |
Set output dir for fn function. More... | |
virtual | ~System () |
void | set_online_rate_monitor_target (SpikingGroup *group=NULL) |
Sets the target group for online rate estimate. More... | |
void | set_online_rate_monitor_id (unsigned int id=0) |
Sets the SpikingGroup used to display the rate estimate in the progressbar. More... | |
void | set_online_rate_monitor_tau (AurynDouble tau=100e-3) |
Sets the timeconstant to compute the online rate average for the status bar. More... | |
double | get_last_elapsed_time () |
Returns last elapsed time in seconds. More... | |
double | get_total_elapsed_time () |
Returns total elapsed time in seconds. More... | |
void | save_network_state (std::string basename) |
Saves network state to a netstate file. More... | |
void | load_network_state (std::string basename) |
Loads network state from a netstate file. More... | |
void | save_network_state_text (std::string basename) |
Saves the network state to human readable text files. More... | |
void | flush_devices () |
Flush devices. More... | |
void | register_spiking_group (SpikingGroup *spiking_group) |
Registers an instance of SpikingGroup to the spiking_groups vector. More... | |
void | register_connection (Connection *connection) |
Registers an instance of Connection to the connections vector. More... | |
void | register_device (Device *device) |
Registers an instance of Device to the devices vector. More... | |
void | register_checker (Checker *checker) |
Registers an instance of Checker to the checkers vector. More... | |
bool | run (AurynFloat simulation_time, bool checking=true) |
Runs a simulation for a given amount of time. More... | |
bool | run_chunk (AurynFloat chunk_time, AurynFloat interval_start, AurynFloat interval_end, bool checking=true) |
Runs simulation for a given amount of time. More... | |
AurynDouble | get_time () |
Gets the current system time in [s]. More... | |
AurynTime | get_clock () |
Gets the current clock value in AurynTime. More... | |
AurynTime * | get_clock_ptr () |
Gets a pointer to the current clock. More... | |
AurynLong | get_total_neurons () |
Get total number of registered neurons. More... | |
AurynDouble | get_total_effective_load () |
Get total effective load. More... | |
AurynLong | get_total_synapses () |
Get total number of registered synapses. More... | |
string | fn (std::string extension) |
Format output file name. More... | |
string | fn (std::string name, std::string extension) |
Format output file name. More... | |
string | fn (std::string name, NeuronID index, std::string extension) |
Format output file name. More... | |
mpi::communicator * | get_com () |
Returns global mpi communicator. More... | |
unsigned int | mpi_size () |
Returns number of ranks. More... | |
unsigned int | mpi_rank () |
Returns current rank. More... | |
void | set_master_seed (unsigned int seed=123) |
Set master seed. More... | |
unsigned int | get_seed () |
Returns a random seed which is different on each rank. More... | |
unsigned int | get_synced_seed () |
Returns a random seed which is the same on each rank. More... | |
Public Attributes | |
bool | quiet |
Switch to turn output to quiet mode (no progress bar). More... | |
AurynVersion | build |
Version info. More... | |
unsigned int | progressbar_update_interval |
The progressbar update interval in timesteps of auryn_timestep. More... | |
Class that implements system wide variables and methods to manage and run simulations.
This Class contains methods to manage and run sets of classes that make up the simulation. In particular it distinguishes between constituents of types SpikingGroup, Connection, Monitor and Checker. A MPI implementation should implement communicators and all that stuff in here. All the constituent object of a single simulation are stored in STL vectors. The methods evolve() and propagate() from each object in these vectors are called alternatingly from within the run procedure.
System::System | ( | mpi::communicator * | communicator | ) |
Default constructor for MPI enabled.
void System::flush_devices | ( | ) |
string System::fn | ( | std::string | extension | ) |
Format output file name.
Formats output files according to the following convention: <outputdir>/<name>.<rank>.<extension> where <name> is taken from System->get_name() and returns it as a c string;
string System::fn | ( | std::string | name, |
std::string | extension | ||
) |
Format output file name.
Formats output files according to the following convention: <outputdir>/<name>.<rank>.<extension> and returns it as a c string;
Format output file name.
Formats output files according to the following convention: <outputdir>/<name><index>.<rank>.<extension> and returns it as a c string;
AurynTime System::get_clock | ( | ) |
AurynTime * System::get_clock_ptr | ( | ) |
mpi::communicator * System::get_com | ( | ) |
AurynDouble System::get_last_elapsed_time | ( | ) |
unsigned int System::get_seed | ( | ) |
std::string System::get_simulation_name | ( | ) |
unsigned int System::get_synced_seed | ( | ) |
Returns a random seed which is the same on each rank.
Can be used to synchronize randomness across ranks StimulusGroup etc
AurynDouble System::get_time | ( | ) |
Gets the current system time in [s].
AurynDouble auryn::System::get_total_effective_load | ( | ) |
Get total effective load.
AurynDouble System::get_total_elapsed_time | ( | ) |
AurynLong System::get_total_neurons | ( | ) |
Get total number of registered neurons.
AurynLong System::get_total_synapses | ( | ) |
Get total number of registered synapses.
void System::load_network_state | ( | std::string | basename | ) |
Loads network state from a netstate file.
basename | (directory and prefix of file) of the netstate file without extension |
unsigned int System::mpi_rank | ( | ) |
unsigned int System::mpi_size | ( | ) |
void System::register_checker | ( | Checker * | checker | ) |
void System::register_connection | ( | Connection * | connection | ) |
Registers an instance of Connection to the connections vector.
Called internally by constructor of Connection.
void System::register_device | ( | Device * | device | ) |
void System::register_spiking_group | ( | SpikingGroup * | spiking_group | ) |
Registers an instance of SpikingGroup to the spiking_groups vector.
Called internally by constructor of SpikingGroup.
bool System::run | ( | AurynFloat | simulation_time, |
bool | checking = true |
||
) |
Runs a simulation for a given amount of time.
simulation_time | time to run the simulation in seconds. |
checking | true if checkers can break the run (e.g. if a frequency get's to high and the network explodes) |
bool System::run_chunk | ( | AurynFloat | chunk_time, |
AurynFloat | interval_start, | ||
AurynFloat | interval_end, | ||
bool | checking = true |
||
) |
Runs simulation for a given amount of time.
Exposes the interface to the progressbar params. Can be used to run a single progress bar, but cut it in different chunks to turn on and off stuff in the simulation without perturbing the output. interval_start and end define the total duration of the simulation (this is used to build the progress bar, while chung_time is the actual time that is simulated for each call.
void System::save_network_state | ( | std::string | basename | ) |
Saves network state to a netstate file.
This function saves the network state to one serialized file. The network state includes the internal state variables of all neurons and the synaptic connections. It currently does not save the state of any random number generators (v0.5) but this is planned to change in the future. Note that netstate files do not contain any parameters either. This was done to allow to run a simulation with a certain parameter set for a given amount of time. Save the network state and then continue the simulation from that point with a changed parameter set (e.g. a new stimulus set or similar).
basename | (including directory path) of the netstate file without extension |
void System::save_network_state_text | ( | std::string | basename | ) |
Saves the network state to human readable text files.
This deprecated method of saving the network state generates a large number of files because each Connection object or SpikingGroup creates their own respective file. This function might still be useful if you have code in which you analaze these files offline. In most cases you will want to use save_network_state and only dump a limited subset (e.g. all the plastic connections) in human-readable text files for analysis.
Basename | (directory and prefix of file) of the netstate file without extension |
void System::set_master_seed | ( | unsigned int | seed = 123 | ) |
Set master seed.
Set the master seed from which other seeds are drawn. When the master seed is set to 0 a master seed is generated from ctime and will be different at each run.
void System::set_online_rate_monitor_id | ( | unsigned int | id = 0 | ) |
Sets the SpikingGroup used to display the rate estimate in the progressbar.
This typically is reflected by the order in which you define the SpikingGroup and NeuronGroup classes. It starts numbering from 0.
void System::set_online_rate_monitor_target | ( | SpikingGroup * | group = NULL | ) |
void System::set_online_rate_monitor_tau | ( | AurynDouble | tau = 100e-3 | ) |
Sets the timeconstant to compute the online rate average for the status bar.
void System::set_output_dir | ( | std::string | path | ) |
void System::set_simulation_name | ( | std::string | name | ) |
AurynVersion auryn::System::build |
Version info.
unsigned int auryn::System::progressbar_update_interval |
The progressbar update interval in timesteps of auryn_timestep.
bool auryn::System::quiet |
Switch to turn output to quiet mode (no progress bar).