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 [2014/01/13 11:15] – Adds the program code zenke | examples:sim_coba_benchmark [2016/07/05 23:40] (current) – typos 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 27: | Line 28: | ||
| {{ : | {{ : | ||
| - | This figure shows the rasterplot  | + | This figure shows the raster plot of the spiking activity of the excitatory population written to ''/ | 
| Line 42: | Line 43: | ||
| neurons_i-> | neurons_i-> | ||
| </ | </ | ||
| - | This part instatiates  | + | This part instantiates  | 
| 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  | + | |
| + | The following  | ||
| <code c++> | <code c++> | ||
| if (!sys-> | if (!sys-> | ||
| 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 ===== | ||
| - | <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 " | ||
| - | |||
| - | 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; | ||
| - | double wi = 5.1; | ||
| - | |||
| - | |||
| - | |||
| - | double sparseness = 0.02; | ||
| - | double simtime = 20.; | ||
| - | |||
| - | NeuronID ne = 3200; | ||
| - | NeuronID ni = 800; | ||
| - | |||
| - | bool prime = false; | ||
| - | 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(" | ||
| - | prime = true; | ||
| - | } | ||
| - | |||
| - |         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 | ||
| - | |||
| - | |||
| - | // double primetime = 10; | ||
| - | 	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 ( 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 ( !fwmat_ee.empty() ) con_ee-> | ||
| - | 	if ( !fwmat_ei.empty() ) con_ei-> | ||
| - | 	if ( !fwmat_ie.empty() ) con_ie-> | ||
| - | 	if ( !fwmat_ii.empty() ) con_ii-> | ||
| - | |||
| - | |||
| - | // pruning here impairs performance -- probably due to cache poisoning | ||
| - | 	con_ee-> | ||
| - | 	con_ei-> | ||
| - | 	con_ie-> | ||
| - | 	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 << " | ||
| - | SpikeMonitor * smon_i = new SpikeMonitor( neurons_i, filename.str().c_str() ); | ||
| - | |||
| - | 		filename.str("" | ||
| - | 		filename << outputfile << " | ||
| - | 		StateMonitor * smon_mem = new StateMonitor( neurons_e, 3, " | ||
| - | |||
| - | 		filename.str("" | ||
| - | 		filename << outputfile << " | ||
| - | 		StateMonitor * smon_ampa = new StateMonitor( neurons_e, 3, " | ||
| - | |||
| - | 		filename.str("" | ||
| - | 		filename << outputfile << " | ||
| - | 		StateMonitor * smon_gaba = new StateMonitor( neurons_e, 3, " | ||
| - | } | ||
| - | |||
| - | |||
| - | 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; | ||
| - | |||
| - | if ( prime ) { | ||
| - | 		oss.str("" | ||
| - | 		oss << dir << "/ | ||
| - | 		sys-> | ||
| - | } | ||
| - | |||
| - | 	logger-> | ||
| - | delete sys; | ||
| - | |||
| - | if (errcode) | ||
| - | 		env.abort(errcode); | ||
| - | |||
| - | return errcode; | ||
| - | } | ||
| - | </ | ||
examples/sim_coba_benchmark.1389611756.txt.gz · Last modified: 2014/01/13 11:15 by zenke
                
                