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

Macros

#define NE   20000
 
#define NI   20000/4
 

Functions

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

Macro Definition Documentation

◆ NE

#define NE   20000

◆ NI

#define NI   20000/4

Function Documentation

◆ main()

int main ( int  ac,
char *  av[] 
)
30  {
31  string dir = ".";
32 
33  string infilename = "";
34  string ratemodfile = "./ratemod.dat";
35  string simname = "dense";
36  string strbuf ;
37  string msg;
38 
39  double w = 0.2;
40  double wext = 0.22;
41  double gamma = 5;
42  double sparseness = 0.1;
43  double simtime = 1000.;
44 
45  double tau_stdp = 20e-3;
46 
47  double eta = 0;
48  double wmax = 10*gamma*w;
49  double kappa = 0.2;
50 
51  int errcode = 0;
52 
53 
54 
55  try {
56 
57  po::options_description desc("Allowed options");
58  desc.add_options()
59  ("help", "produce help message")
60  ("simtime", po::value<double>(), "simulation time in seconds")
61  ("dir", po::value<string>(), "dir for output files")
62  ("load", po::value<string>(), "basename to load network from")
63  ("ratefile", po::value<string>(), "file containing the timeseries with the rate modulation")
64  ;
65 
66  po::variables_map vm;
67  po::store(po::parse_command_line(ac, av, desc), vm);
68  po::notify(vm);
69 
70  if (vm.count("help")) {
71  std::cout << desc << "\n";
72  return 1;
73  }
74 
75  if (vm.count("load")) {
76  infilename = vm["load"].as<string>();
77  }
78 
79  if (vm.count("simtime")) {
80  simtime = vm["simtime"].as<double>();
81  }
82 
83  if (vm.count("dir")) {
84  dir = vm["dir"].as<string>();
85  }
86 
87  if (vm.count("ratefile")) {
88  ratemodfile = vm["ratefile"].as<string>();
89  }
90 
91  }
92  catch(std::exception& e) {
93  std::cerr << "error: " << e.what() << "\n";
94  return 1;
95  }
96  catch(...) {
97  std::cerr << "Exception of unknown type!\n";
98  }
99 
100  auryn_init(ac, av, dir, simname);
101 
102  std::stringstream oss;
103  oss << dir << "/" << simname << "." << sys->mpi_rank() << ".";
104  string outputfile = oss.str();
105 
106 
107 
108  logger->msg("Setting up neuron groups ...",PROGRESS,true);
109  IFGroup * neurons_e = new IFGroup( NE);
110  neurons_e->set_ampa_nmda_ratio(1.0);
111  neurons_e->randomize_state_vector_gauss("g_nmda",0.1,1);
112  IFGroup * neurons_i = new IFGroup( NI);
113  neurons_i->set_ampa_nmda_ratio(1.0);
114  neurons_i->set_tau_mem(10e-3);
115 
116  FileModulatedPoissonGroup * poisson
117  = new FileModulatedPoissonGroup(2000,ratemodfile);
118  SparseConnection * con_exte
119  = new SparseConnection( poisson, neurons_e, wext, sparseness, GLUT);
120  SparseConnection * con_exti
121  = new SparseConnection( poisson, neurons_i, wext, sparseness, GLUT);
122 
123  logger->msg("Setting up connections ...",PROGRESS,true);
124 
125  SparseConnection * con_ee = new SparseConnection(
126  neurons_e,
127  neurons_e,
128  w,sparseness,
129  GLUT);
130  SparseConnection * con_ei = new SparseConnection(
131  neurons_e,
132  neurons_i,
133  w,sparseness,
134  GLUT);
135  SparseConnection * con_ii = new SparseConnection(
136  neurons_i,
137  neurons_i,
138  0.9*gamma*w,sparseness,
139  GABA);
140  SparseConnection * con_ie = new SparseConnection(
141  neurons_i,
142  neurons_e,
143  0.9*gamma*w,sparseness,
144  GABA);
145 
146 
147  if (!infilename.empty()) {
148  logger->msg("Loading network state ...",PROGRESS,true);
149  sys->load_network_state(outputfile);
150  }
151 
152  msg = "Setting up monitors ...";
153  logger->msg(msg,PROGRESS,true);
154 
155  std::stringstream filename;
156  filename << outputfile << "e.ras";
157  SpikeMonitor * smon_e = new SpikeMonitor( neurons_e, filename.str().c_str() );
158 
159  filename.str("");
160  filename.clear();
161  filename << outputfile << "i.ras";
162  SpikeMonitor * smon_i = new SpikeMonitor( neurons_i, filename.str().c_str() );
163 
164  filename.str("");
165  filename.clear();
166  filename << outputfile << "p.ras";
167  SpikeMonitor * smon_p = new SpikeMonitor( poisson, filename.str().c_str() );
168 
169  filename.str("");
170  filename.clear();
171  filename << outputfile << "e.prate";
172  PopulationRateMonitor * pmon_e = new PopulationRateMonitor( neurons_e, filename.str().c_str(), 1.0 );
173 
174  filename.str("");
175  filename.clear();
176  filename << outputfile << "e.mem";
177  VoltageMonitor * vmon = new VoltageMonitor( neurons_e, 123, filename.str().c_str() );
178 
179  RateChecker * chk = new RateChecker( neurons_e , -1.0 , 40. , 100e-3);
180 
181  for (int j = 0; j<1000 ; j++) {
182  neurons_e->tadd(j,5.);
183  }
184 
185  logger->msg("Simulating ..." ,PROGRESS,true);
186  if (!sys->run(simtime,true))
187  errcode = 1;
188 
189  logger->msg("Saving network state ..." ,PROGRESS,true);
190  sys->save_network_state(outputfile);
191 
192 
193  if (errcode)
194  auryn_abort(errcode);
195 
196  logger->msg("Freeing ..." ,PROGRESS,true);
197  auryn_free();
198 
199  return errcode;
200 }
void auryn_free()
Cleanly shuts down Auryn simulation environment.
Definition: auryn_global.cpp:107
Standard Glutamatergic (excitatory) transmission.
Definition: auryn_definitions.h:139
unsigned int mpi_rank()
Returns current rank.
Definition: System.cpp:1009
void load_network_state(std::string basename)
Loads network state from a netstate file.
Definition: System.cpp:812
A Checker class that tracks population firing rate as a moving average and breaks a run if it goes ou...
Definition: RateChecker.h:59
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 set_ampa_nmda_ratio(AurynFloat ratio)
Set ratio between ampa/nmda contribution to excitatory conductance.
Definition: IFGroup.cpp:209
The standard Monitor object to record spikes from a SpikingGroup and write them to a text file...
Definition: SpikeMonitor.h:52
void set_tau_mem(AurynFloat taum)
Sets the membrane time constant.
Definition: IFGroup.cpp:154
A special Poisson generator that reads its instantaneous firing rate from a tiser file...
Definition: FileModulatedPoissonGroup.h:46
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
Records the membrane potential from one unit from the source neuron group to a file.
Definition: VoltageMonitor.h:48
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
#define NI
Definition: sim_dense.cpp:24
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
Monitor class to record population firing rates.
Definition: PopulationRateMonitor.h:46
void save_network_state(std::string basename)
Saves network state to a netstate file.
Definition: System.cpp:694
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
Implements the standard integrate and file model used in Auryn.
Definition: IFGroup.h:47
void tadd(NeuronID id, AurynWeight amount, TransmitterType t=GLUT)
Definition: NeuronGroup.cpp:98
#define NE
Definition: sim_dense.cpp:23
Here is the call graph for this function: