Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Functions
sim_coba_binmon.cpp File Reference
#include "auryn.h"
Include dependency graph for sim_coba_binmon.cpp:

Functions

int main (int ac, char *av[])
 

Function Documentation

◆ main()

int main ( int  ac,
char *  av[] 
)
30  {
31  string dir = "/tmp";
32 
33  string fwmat_ee = "";
34  string fwmat_ei = "";
35  string fwmat_ie = "";
36  string fwmat_ii = "";
37 
38  std::stringstream oss;
39  string strbuf ;
40  string msg;
41 
42  double w = 0.4; // [g_leak]
43  double wi = 5.1; // [g_leak]
44 
45 
46 
47  double sparseness = 0.02;
48  double simtime = 20.;
49 
50  NeuronID ne = 3200;
51  NeuronID ni = 800;
52 
53  bool fast = false;
54 
55  int errcode = 0;
56 
57 
58  try {
59 
60  po::options_description desc("Allowed options");
61  desc.add_options()
62  ("help", "produce help message")
63  ("simtime", po::value<double>(), "simulation time")
64  ("fast", "turns off most monitoring to reduce IO")
65  ("dir", po::value<string>(), "load/save directory")
66  ("fee", po::value<string>(), "file with EE connections")
67  ("fei", po::value<string>(), "file with EI connections")
68  ("fie", po::value<string>(), "file with IE connections")
69  ("fii", po::value<string>(), "file with II connections")
70  ;
71 
72  po::variables_map vm;
73  po::store(po::parse_command_line(ac, av, desc), vm);
74  po::notify(vm);
75 
76  if (vm.count("help")) {
77  std::cout << desc << "\n";
78  return 1;
79  }
80 
81  if (vm.count("simtime")) {
82  simtime = vm["simtime"].as<double>();
83  }
84 
85  if (vm.count("fast")) {
86  fast = true;
87  }
88 
89  if (vm.count("dir")) {
90  dir = vm["dir"].as<string>();
91  }
92 
93  if (vm.count("fee")) {
94  fwmat_ee = vm["fee"].as<string>();
95  }
96 
97  if (vm.count("fie")) {
98  fwmat_ie = vm["fie"].as<string>();
99  }
100 
101  if (vm.count("fei")) {
102  fwmat_ei = vm["fei"].as<string>();
103  }
104 
105  if (vm.count("fii")) {
106  fwmat_ii = vm["fii"].as<string>();
107  }
108 
109  }
110  catch(std::exception& e) {
111  std::cerr << "error: " << e.what() << "\n";
112  return 1;
113  }
114  catch(...) {
115  std::cerr << "Exception of unknown type!\n";
116  }
117 
118 
119  auryn_init(ac, av);
120 
121  oss << dir << "/coba." << sys->mpi_rank() << ".";
122  string outputfile = oss.str();
123 
124 
125  logger->msg("Setting up neuron groups ...",PROGRESS,true);
126 
127  TIFGroup * neurons_e = new TIFGroup( ne);
128  TIFGroup * neurons_i = new TIFGroup( ni);
129 
130  neurons_e->set_refractory_period(5.0e-3); // minimal ISI 5.1ms
131  neurons_i->set_refractory_period(5.0e-3);
132 
133  neurons_e->set_state("bg_current",2e-2); // corresponding to 200pF for C=200pF and tau=20ms
134  neurons_i->set_state("bg_current",2e-2);
135 
136 
137  logger->msg("Setting up E connections ...",PROGRESS,true);
138 
139  SparseConnection * con_ee
140  = new SparseConnection( neurons_e,neurons_e, w, sparseness, GLUT);
141 
142  SparseConnection * con_ei
143  = new SparseConnection( neurons_e,neurons_i, w,sparseness,GLUT);
144 
145 
146 
147  logger->msg("Setting up I connections ...",PROGRESS,true);
148  SparseConnection * con_ie
149  = new SparseConnection( neurons_i,neurons_e,wi,sparseness,GABA);
150 
151  SparseConnection * con_ii
152  = new SparseConnection( neurons_i,neurons_i,wi,sparseness,GABA);
153 
154  if ( !fwmat_ee.empty() ) con_ee->load_from_complete_file(fwmat_ee);
155  if ( !fwmat_ei.empty() ) con_ei->load_from_complete_file(fwmat_ei);
156  if ( !fwmat_ie.empty() ) con_ie->load_from_complete_file(fwmat_ie);
157  if ( !fwmat_ii.empty() ) con_ii->load_from_complete_file(fwmat_ii);
158 
159 
160 
161  if ( !fast ) {
162  logger->msg("Use --fast option to turn off IO for benchmarking!", WARNING);
163 
164  msg = "Setting up monitors ...";
165  logger->msg(msg,PROGRESS,true);
166 
167  std::stringstream filename;
168  filename << outputfile << "e.spk";
169  BinarySpikeMonitor * smon_e = new BinarySpikeMonitor( neurons_e, filename.str().c_str() );
170 
171  filename.str("");
172  filename.clear();
173  filename << outputfile << "i.spk";
174  BinarySpikeMonitor * smon_i = new BinarySpikeMonitor( neurons_i, filename.str().c_str() );
175  }
176 
177 
178  RateChecker * chk = new RateChecker( neurons_e , -0.1 , 1000. , 100e-3);
179 
180  logger->msg("Simulating ..." ,PROGRESS,true);
181  if (!sys->run(simtime,true))
182  errcode = 1;
183 
184 
185  if (errcode)
186  auryn_abort(errcode);
187 
188  logger->msg("Freeing ..." ,PROGRESS,true);
189  auryn_free();
190  return errcode;
191 }
void auryn_free()
Cleanly shuts down Auryn simulation environment.
Definition: auryn_global.cpp:107
Standard Glutamatergic (excitatory) transmission.
Definition: auryn_definitions.h:139
The standard Monitor object to record spikes from a SpikingGroup and write them to a binary file...
Definition: BinarySpikeMonitor.h:48
unsigned int mpi_rank()
Returns current rank.
Definition: System.cpp:1009
void set_state(std::string name, AurynState val)
Conveniently sets all values in a state vector identified by name in this group.
Definition: NeuronGroup.cpp:132
A Checker class that tracks population firing rate as a moving average and breaks a run if it goes ou...
Definition: RateChecker.h:59
Definition: Logger.h:41
virtual bool load_from_complete_file(string filename)
Loads weight matrix from a single file.
Definition: SparseConnection.cpp:921
The base class to create sparse random connections.
Definition: SparseConnection.h:66
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
void auryn_abort(int errcode)
Terminates Auryn simulation abnormally.
Definition: auryn_global.cpp:113
System * sys
Global pointer to instance of System which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:37
Conductance based LIF neuron model with absolute refractoriness as used in Vogels and Abbott 2005...
Definition: TIFGroup.h:38
void auryn_init(int ac, char *av[], string dir, string simulation_name, string logfile_prefix, LogMessageType filelog_level, LogMessageType consolelog_level)
Initalizes MPI and the Auryn simulation environment.
Definition: auryn_global.cpp:84
Standard Gabaergic (inhibitory) transmission.
Definition: auryn_definitions.h:140
void msg(std::string text, LogMessageType type=NOTIFICATION, bool global=false, int line=-1, std::string srcfile="")
Definition: Logger.cpp:74
Definition: Logger.h:41
void set_refractory_period(AurynDouble t)
Setter for refractory time [s].
Definition: TIFGroup.cpp:204
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: