Auryn simulator

Simulator for spiking neural networks with synaptic plasticity

User Tools

Site Tools


examples:sim_coba_benchmark

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
examples:sim_coba_benchmark [2014/01/13 11:18] – Adds link to parallel execution zenkeexamples:sim_coba_benchmark [2015/06/01 17:58] zenke
Line 8: Line 8:
 To run the program the network first needs priming with external Poisson noise before it can self-sustain its activity. To do that invoke the program with the following command line arguments To run the program the network first needs priming with external Poisson noise before it can self-sustain its activity. To do that invoke the program with the following command line arguments
 <code shell> <code shell>
-./sim_coba_benchmark --dir /tmp --prime --simtime 0.050 
 ./sim_coba_benchmark --dir /tmp --simtime 5 ./sim_coba_benchmark --dir /tmp --simtime 5
 </code> </code>
 The ''prime'' keyword in the first command causes the network to run with external Poisson input and save its network state at the end of the run to a set of files created under ''/tmp''. Note that you can give any other directory name where you want the files to be created. The second call to the progrem without the ''--prime'' argument causes the program to read the current network state from these saved files and runs the network for the specified period in ''simtime''. All spiking output and the memory trace ([[mem]] file) of a single neuron are written to the directory specified with ''--dir'' and are prefixed with ''coba.*''. The ''prime'' keyword in the first command causes the network to run with external Poisson input and save its network state at the end of the run to a set of files created under ''/tmp''. Note that you can give any other directory name where you want the files to be created. The second call to the progrem without the ''--prime'' argument causes the program to read the current network state from these saved files and runs the network for the specified period in ''simtime''. All spiking output and the memory trace ([[mem]] file) of a single neuron are written to the directory specified with ''--dir'' and are prefixed with ''coba.*''.
  
-If you are interested in running the code in parallel please see the [[parallel execution]] howto.+If you are interested in running the code in parallel please see the [[manual:parallel execution]] howto.
  
 ==== Output example ==== ==== Output example ====
Line 29: Line 28:
  
 {{ :examples:coba_ras.png?300 |}} {{ :examples:coba_ras.png?300 |}}
-This figure shows the rasterplot of the spiking activity of the excitatory population written to ''/tmp/coba.0.e.ras''.+This figure shows the raster plot of the spiking activity of the excitatory population written to ''/tmp/coba.0.e.ras''.
  
  
Line 44: Line 43:
 neurons_i->random_mem(-70e-3,10e-3); neurons_i->random_mem(-70e-3,10e-3);
 </code> </code>
-This part instatiates two groups of neurons of type [[TIFGroup]] which corresponds to the conductance based model with exponentially decaying PSCs and an absolute refractoriness of 5ms. The ''random_mem'' methods randomize the initial membrane potentials with a Gaussian (mean=-70mV and standard deviation 10e-3mV).+This part instatiates two groups of neurons of type [[TIFGroup]] which corresponds to the conductance based model with exponentially decaying PSCs and an absolute refractoriness of 5ms. The ''random_mem'' methods randomize the initial membrane potentials with a Gaussian (mean=-70mV and standard deviation 10mV).
  
  
Line 64: Line 63:
  
  
-To implement the priming mechanism we find the following conditional branch: +
-<code c++> +
-if ( prime ) {  +
-    msg = "Setting up external input ..."; +
-    logger->msg(msg,PROGRESS,true); +
-     +
-    PoissonGroup * poisson= new PoissonGroup(200,10); +
-    poisson->seed(132341);  +
-    // this will give the same seed on each rank, +
-    // but since the group should be locked to a single +
-    // rank we do not care. +
-     +
-    SparseConnection * con_ext_e = new SparseConnection(poisson,neurons_e,1,sparseness/2,GLUT); +
-    SparseConnection * con_ext_i = new SparseConnection(poisson,neurons_i,1,sparseness/2,GLUT); +
-} else { +
-    oss.str(""); +
-    oss << dir << "/save"; +
-    sys->load_network_state(oss.str()); +
-+
-</code> +
-If the ''prime'' directive is set (via the command line) this code will create a [[PoissonGroup]] and connect it to the excitatory and inhibitory populations. If ''prime==false'' this will try to load the network state from the hopefully existing save files stored under ''/tmp/save*'' in our example.+
  
 The folling code snipped is responsible for running the simulation for ''simtime'' seconds. The second parameter ''true'' indicates that we wan the simulation to be interrupted if the [[RateChecker]] detects too high firing rates, which usually suggests that something is going wrong. The folling code snipped is responsible for running the simulation for ''simtime'' seconds. The second parameter ''true'' indicates that we wan the simulation to be interrupted if the [[RateChecker]] detects too high firing rates, which usually suggests that something is going wrong.
Line 101: Line 80:
  
 ===== The full program ===== ===== The full program =====
 +**Note** you might find a more recent version of this code in the ''auryn/examples'' directory.
 +
 <code c++> <code c++>
 /*  /* 
Line 140: Line 121:
 #include "WeightSumMonitor.h" #include "WeightSumMonitor.h"
 #include "SpikeMonitor.h" #include "SpikeMonitor.h"
 +#include "DelayedSpikeMonitor.h"
 #include "StateMonitor.h" #include "StateMonitor.h"
 #include "RateChecker.h" #include "RateChecker.h"
Line 160: Line 142:
  string msg;  string msg;
  
- double w = 0.4; + double w = 0.4; // [g_leak] 
- double wi = 5.1;+ double wi = 5.1; // [g_leak]
  
  
Line 171: Line 153:
  NeuronID ni = 800;  NeuronID ni = 800;
  
- bool prime = false; 
  bool fast = false;  bool fast = false;
  
Line 183: Line 164:
             ("help", "produce help message")             ("help", "produce help message")
             ("simtime", po::value<double>(), "simulation time")             ("simtime", po::value<double>(), "simulation time")
-            ("prime", "switch input modalities") 
             ("fast", "turns off most monitoring to reduce IO")             ("fast", "turns off most monitoring to reduce IO")
             ("dir", po::value<string>(), "load/save directory")             ("dir", po::value<string>(), "load/save directory")
Line 203: Line 183:
         if (vm.count("simtime")) {         if (vm.count("simtime")) {
  simtime = vm["simtime"].as<double>();  simtime = vm["simtime"].as<double>();
-        }  
- 
-        if (vm.count("prime")) { 
- prime = true; 
         }          } 
  
Line 258: Line 234:
  // END Global stuff  // END Global stuff
  
- 
- // double primetime = 10; 
  logger->msg("Setting up neuron groups ...",PROGRESS,true);  logger->msg("Setting up neuron groups ...",PROGRESS,true);
  
Line 265: Line 239:
  TIFGroup * neurons_i = new TIFGroup( ni);  TIFGroup * neurons_i = new TIFGroup( ni);
  
- neurons_e->random_mem(-70e-3,10e-3); + neurons_e->set_state("bg_current",2e-2); // corresponding to 200pF for C=200pF and tau=20ms 
- neurons_i->random_mem(-70e-3,10e-3);+ neurons_i->set_state("bg_current",2e-2);
  
  
Line 286: Line 260:
  = new SparseConnection( neurons_i,neurons_i,wi,sparseness,GABA);  = new SparseConnection( neurons_i,neurons_i,wi,sparseness,GABA);
  
- if ( prime ) {  + if ( !fwmat_ee.empty() ) con_ee->load_from_complete_file(fwmat_ee); 
- msg = "Setting up external input ..."; + if ( !fwmat_ei.empty() ) con_ei->load_from_complete_file(fwmat_ei); 
- logger->msg(msg,PROGRESS,true); + if ( !fwmat_ie.empty() ) con_ie->load_from_complete_file(fwmat_ie); 
- + if ( !fwmat_ii.empty() ) con_ii->load_from_complete_file(fwmat_ii);
- PoissonGroup * poisson= new PoissonGroup(200,10); +
- poisson->seed(132341);  +
- // this will give the same seed on each rank, +
- // but since the group should be locked to a single +
- // rank we do not care. +
- +
- SparseConnection * con_ext_e = new SparseConnection(poisson,neurons_e,1,sparseness/2,GLUT); +
- SparseConnection * con_ext_i = new SparseConnection(poisson,neurons_i,1,sparseness/2,GLUT); +
- +
- } else { +
- oss.str(""); +
- oss << dir << "/save"; +
- sys->load_network_state(oss.str()); +
-+
- +
- if ( !fwmat_ee.empty() ) con_ee->load_from_file(fwmat_ee); +
- if ( !fwmat_ei.empty() ) con_ei->load_from_file(fwmat_ei); +
- if ( !fwmat_ie.empty() ) con_ie->load_from_file(fwmat_ie); +
- if ( !fwmat_ii.empty() ) con_ii->load_from_file(fwmat_ii); +
- +
- +
- // pruning here impairs performance -- probably due to cache poisoning +
- con_ee->prune(); +
- con_ei->prune(); +
- con_ie->prune(); +
- con_ii->prune();+
  
  
Line 325: Line 273:
  filename << outputfile << "e.ras";  filename << outputfile << "e.ras";
  SpikeMonitor * smon_e = new SpikeMonitor( neurons_e, filename.str().c_str() );  SpikeMonitor * smon_e = new SpikeMonitor( neurons_e, filename.str().c_str() );
 +
 + // filename.str("");
 + // filename.clear();
 + // filename << outputfile << "e.dras";
 + // DelayedSpikeMonitor * dsmon_e = new DelayedSpikeMonitor( neurons_e, filename.str().c_str() );
  
  filename.str("");  filename.str("");
Line 333: Line 286:
  filename.str("");  filename.str("");
  filename << outputfile << "e.mem";  filename << outputfile << "e.mem";
- StateMonitor * smon_mem = new StateMonitor( neurons_e, 3, "mem", filename.str() ); + StateMonitor * smon_mem = new StateMonitor( neurons_e, 7, "mem", filename.str() ,dt ); 
   
  filename.str("");  filename.str("");
  filename << outputfile << "e.ampa";  filename << outputfile << "e.ampa";
- StateMonitor * smon_ampa = new StateMonitor( neurons_e, 3, "g_ampa", filename.str() );+ StateMonitor * smon_ampa = new StateMonitor( neurons_e, 7, "g_ampa", filename.str() );
  
  filename.str("");  filename.str("");
  filename << outputfile << "e.gaba";  filename << outputfile << "e.gaba";
- StateMonitor * smon_gaba = new StateMonitor( neurons_e, 3, "g_gaba", filename.str() );+ StateMonitor * smon_gaba = new StateMonitor( neurons_e, 7, "g_gaba", filename.str() );
  }  }
  
Line 356: Line 309:
  if (!sys->run(simtime,true))   if (!sys->run(simtime,true)) 
  errcode = 1;  errcode = 1;
- 
- if ( prime ) {  
- oss.str(""); 
- oss << dir << "/save"; 
- sys->save_network_state(oss.str()); 
- } 
  
  logger->msg("Freeing ..." ,PROGRESS,true);  logger->msg("Freeing ..." ,PROGRESS,true);
examples/sim_coba_benchmark.txt · Last modified: 2016/07/05 23:40 by zenke