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/09/12 10:46] – Updates tutorial with new syntax for example. zenkeexamples:sim_coba_benchmark [2015/06/01 17:58] zenke
Line 28: 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 43: 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 80: 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 119: 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 139: 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 150: Line 153:
  NeuronID ni = 800;  NeuronID ni = 800;
  
- bool prime = false; 
  bool fast = false;  bool fast = false;
  
Line 162: 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 182: 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 237: 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 244: 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 265: 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 304: 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 312: 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 335: 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