examples:sim_coba_benchmark
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
examples:sim_coba_benchmark [2015/06/01 17:58] – zenke | examples:sim_coba_benchmark [2016/07/05 23:40] (current) – typos zenke | ||
---|---|---|---|
Line 43: | Line 43: | ||
neurons_i-> | neurons_i-> | ||
</ | </ | ||
- | This part instatiates | + | This part instantiates |
Line 65: | Line 65: | ||
- | The folling | + | The following |
<code c++> | <code c++> | ||
if (!sys-> | if (!sys-> | ||
Line 77: | 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.1433181509.txt.gz · Last modified: 2015/06/01 17:58 by zenke