examples:sim_coba_benchmark
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
examples:sim_coba_benchmark [2014/01/13 11:15] – Adds more explanation to important bits. zenke | examples:sim_coba_benchmark [2015/05/29 17:14] – 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> | ||
- | ./ | ||
./ | ./ | ||
</ | </ | ||
The '' | The '' | ||
+ | |||
+ | If you are interested in running the code in parallel please see the [[manual: | ||
==== Output example ==== | ==== Output example ==== | ||
Line 42: | Line 43: | ||
neurons_i-> | neurons_i-> | ||
</ | </ | ||
- | 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 '' | + | 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 '' |
Line 62: | Line 63: | ||
- | To implement the priming mechanism we find the following conditional branch: | + | |
- | <code c++> | + | |
- | if ( prime ) { | + | |
- | msg = " | + | |
- | logger-> | + | |
- | + | ||
- | PoissonGroup * poisson= new PoissonGroup(200, | + | |
- | poisson-> | + | |
- | // 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, | + | |
- | SparseConnection * con_ext_i = new SparseConnection(poisson, | + | |
- | } else { | + | |
- | oss.str("" | + | |
- | oss << dir << "/ | + | |
- | sys-> | + | |
- | } | + | |
- | </ | + | |
- | If the '' | + | |
The folling code snipped is responsible for running the simulation for '' | The folling code snipped is responsible for running the simulation for '' | ||
Line 96: | Line 77: | ||
</ | </ | ||
The second part of the above code saves the network state if '' | The second part of the above code saves the network state if '' | ||
+ | |||
+ | |||
+ | ===== The full program ===== | ||
+ | **Note** you might find a more recent version of this code in the '' | ||
+ | |||
+ | <code c++> | ||
+ | /* | ||
+ | * Copyright 2014 Friedemann Zenke | ||
+ | * | ||
+ | * This file is part of Auryn, a simulation package for plastic | ||
+ | * spiking neural networks. | ||
+ | * | ||
+ | * Auryn is free software: you can redistribute it and/or modify | ||
+ | * it under the terms of the GNU General Public License as published by | ||
+ | * the Free Software Foundation, either version 3 of the License, or | ||
+ | * (at your option) any later version. | ||
+ | * | ||
+ | * Auryn is distributed in the hope that it will be useful, | ||
+ | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | * GNU General Public License for more details. | ||
+ | * | ||
+ | * You should have received a copy of the GNU General Public License | ||
+ | * along with Auryn. | ||
+ | */ | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | #include " | ||
+ | |||
+ | using namespace std; | ||
+ | |||
+ | namespace po = boost:: | ||
+ | namespace mpi = boost::mpi; | ||
+ | |||
+ | int main(int ac,char *av[]) { | ||
+ | string dir = "/ | ||
+ | |||
+ | string fwmat_ee = ""; | ||
+ | string fwmat_ei = ""; | ||
+ | string fwmat_ie = ""; | ||
+ | string fwmat_ii = ""; | ||
+ | |||
+ | stringstream oss; | ||
+ | string strbuf ; | ||
+ | string msg; | ||
+ | |||
+ | double w = 0.4; // [g_leak] | ||
+ | double wi = 5.1; // [g_leak] | ||
+ | |||
+ | |||
+ | |||
+ | double sparseness = 0.02; | ||
+ | double simtime = 20.; | ||
+ | |||
+ | NeuronID ne = 3200; | ||
+ | NeuronID ni = 800; | ||
+ | |||
+ | bool fast = false; | ||
+ | |||
+ | int errcode = 0; | ||
+ | |||
+ | |||
+ | try { | ||
+ | |||
+ | po:: | ||
+ | desc.add_options() | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | (" | ||
+ | ; | ||
+ | |||
+ | po:: | ||
+ | po:: | ||
+ | po:: | ||
+ | |||
+ | if (vm.count(" | ||
+ | cout << desc << " | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | if (vm.count(" | ||
+ | simtime = vm[" | ||
+ | } | ||
+ | |||
+ | if (vm.count(" | ||
+ | fast = true; | ||
+ | } | ||
+ | |||
+ | if (vm.count(" | ||
+ | dir = vm[" | ||
+ | } | ||
+ | |||
+ | if (vm.count(" | ||
+ | fwmat_ee = vm[" | ||
+ | } | ||
+ | |||
+ | if (vm.count(" | ||
+ | fwmat_ie = vm[" | ||
+ | } | ||
+ | |||
+ | if (vm.count(" | ||
+ | fwmat_ei = vm[" | ||
+ | } | ||
+ | |||
+ | if (vm.count(" | ||
+ | fwmat_ii = vm[" | ||
+ | } | ||
+ | |||
+ | } | ||
+ | catch(exception& | ||
+ | cerr << " | ||
+ | return 1; | ||
+ | } | ||
+ | catch(...) { | ||
+ | cerr << " | ||
+ | } | ||
+ | |||
+ | // BEGIN Global stuff | ||
+ | mpi:: | ||
+ | mpi:: | ||
+ | communicator = &world; | ||
+ | |||
+ | oss << dir << "/ | ||
+ | string outputfile = oss.str(); | ||
+ | |||
+ | char tmp [255]; | ||
+ | stringstream logfile; | ||
+ | logfile << outputfile << " | ||
+ | logger = new Logger(logfile.str(), | ||
+ | |||
+ | sys = new System(& | ||
+ | // END Global stuff | ||
+ | |||
+ | logger-> | ||
+ | |||
+ | TIFGroup * neurons_e = new TIFGroup( ne); | ||
+ | TIFGroup * neurons_i = new TIFGroup( ni); | ||
+ | |||
+ | neurons_e-> | ||
+ | neurons_i-> | ||
+ | |||
+ | |||
+ | logger-> | ||
+ | |||
+ | SparseConnection * con_ee | ||
+ | = new SparseConnection( neurons_e, | ||
+ | |||
+ | SparseConnection * con_ei | ||
+ | = new SparseConnection( neurons_e, | ||
+ | |||
+ | |||
+ | |||
+ | logger-> | ||
+ | SparseConnection * con_ie | ||
+ | = new SparseConnection( neurons_i, | ||
+ | |||
+ | SparseConnection * con_ii | ||
+ | = new SparseConnection( neurons_i, | ||
+ | |||
+ | if ( !fwmat_ee.empty() ) con_ee-> | ||
+ | if ( !fwmat_ei.empty() ) con_ei-> | ||
+ | if ( !fwmat_ie.empty() ) con_ie-> | ||
+ | if ( !fwmat_ii.empty() ) con_ii-> | ||
+ | |||
+ | |||
+ | if ( !fast ) { | ||
+ | msg = " | ||
+ | logger-> | ||
+ | |||
+ | stringstream filename; | ||
+ | filename << outputfile << " | ||
+ | SpikeMonitor * smon_e = new SpikeMonitor( neurons_e, filename.str().c_str() ); | ||
+ | |||
+ | // filename.str("" | ||
+ | // filename.clear(); | ||
+ | // filename << outputfile << " | ||
+ | // DelayedSpikeMonitor * dsmon_e = new DelayedSpikeMonitor( neurons_e, filename.str().c_str() ); | ||
+ | |||
+ | filename.str("" | ||
+ | filename.clear(); | ||
+ | filename << outputfile << " | ||
+ | SpikeMonitor * smon_i = new SpikeMonitor( neurons_i, filename.str().c_str() ); | ||
+ | |||
+ | filename.str("" | ||
+ | filename << outputfile << " | ||
+ | StateMonitor * smon_mem = new StateMonitor( neurons_e, 7, " | ||
+ | |||
+ | filename.str("" | ||
+ | filename << outputfile << " | ||
+ | StateMonitor * smon_ampa = new StateMonitor( neurons_e, 7, " | ||
+ | |||
+ | filename.str("" | ||
+ | filename << outputfile << " | ||
+ | StateMonitor * smon_gaba = new StateMonitor( neurons_e, 7, " | ||
+ | } | ||
+ | |||
+ | |||
+ | RateChecker * chk = new RateChecker( neurons_e , -0.1 , 1000. , 100e-3); | ||
+ | |||
+ | logger-> | ||
+ | con_ee-> | ||
+ | con_ei-> | ||
+ | con_ie-> | ||
+ | con_ii-> | ||
+ | |||
+ | logger-> | ||
+ | if (!sys-> | ||
+ | errcode = 1; | ||
+ | |||
+ | logger-> | ||
+ | delete sys; | ||
+ | |||
+ | if (errcode) | ||
+ | env.abort(errcode); | ||
+ | |||
+ | return errcode; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ |
examples/sim_coba_benchmark.txt · Last modified: 2016/07/05 23:40 by zenke