From 1e0b3203d117ae473da08775256748416db0787b Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Wed, 10 Aug 2016 17:19:55 -0700 Subject: [PATCH 01/77] Fixes bug in Python library --- tools/python/auryn_binary_tools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/python/auryn_binary_tools.py b/tools/python/auryn_binary_tools.py index a01ffc92..de9808e1 100755 --- a/tools/python/auryn_binary_tools.py +++ b/tools/python/auryn_binary_tools.py @@ -222,9 +222,10 @@ def time_triggered_histogram(self, trigger_times, time_offset=0.0, time_window=1 for t_spike in trigger_times: ts = t_spike+time_offset spikes = self.get_spikes(ts, ts+time_window) - sar = np.array(spikes, dtype=int)[:,1] - counts = np.bincount(sar, minlength=max_neuron_id) - hist += counts + if len(spikes): + sar = np.array(spikes, dtype=int)[:,1] + counts = np.bincount(sar, minlength=max_neuron_id) + hist += counts return hist From 1e6c81517f6c021171c737eac96cfdd1b89e5260 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Wed, 10 Aug 2016 17:19:55 -0700 Subject: [PATCH 02/77] Fixes bug in Python library --- tools/python/auryn_binary_tools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/python/auryn_binary_tools.py b/tools/python/auryn_binary_tools.py index a01ffc92..de9808e1 100755 --- a/tools/python/auryn_binary_tools.py +++ b/tools/python/auryn_binary_tools.py @@ -222,9 +222,10 @@ def time_triggered_histogram(self, trigger_times, time_offset=0.0, time_window=1 for t_spike in trigger_times: ts = t_spike+time_offset spikes = self.get_spikes(ts, ts+time_window) - sar = np.array(spikes, dtype=int)[:,1] - counts = np.bincount(sar, minlength=max_neuron_id) - hist += counts + if len(spikes): + sar = np.array(spikes, dtype=int)[:,1] + counts = np.bincount(sar, minlength=max_neuron_id) + hist += counts return hist From fab831afc3f1dd661c372fcdf96a4ffe1346816f Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 01:58:38 -0700 Subject: [PATCH 03/77] Adds new master seed mechanisms to System --- examples/sim_poisson.cpp | 2 +- src/PoissonGroup.cpp | 7 ++++--- src/System.cpp | 30 ++++++++++++++++++++++++++++++ src/System.h | 28 ++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/examples/sim_poisson.cpp b/examples/sim_poisson.cpp index 556196bb..5176705a 100644 --- a/examples/sim_poisson.cpp +++ b/examples/sim_poisson.cpp @@ -35,7 +35,7 @@ int main(int ac, char* av[]) string msg; NeuronID size = 1000; - NeuronID seed = 1; + unsigned int seed = 1; double kappa = 5.; double simtime = 1.; diff --git a/src/PoissonGroup.cpp b/src/PoissonGroup.cpp index 9eeab364..13739ed3 100644 --- a/src/PoissonGroup.cpp +++ b/src/PoissonGroup.cpp @@ -36,7 +36,7 @@ void PoissonGroup::init(AurynDouble rate) dist = new boost::uniform_01<> (); die = new boost::variate_generator > ( gen, *dist ); - seed(620349123); + gen.seed(sys->get_seed()); x = 0; set_rate( rate ); @@ -94,8 +94,9 @@ void PoissonGroup::evolve() x -= get_rank_size(); } -void PoissonGroup::seed(int s) +void PoissonGroup::seed(unsigned int s) { - gen.seed(s+sys->mpi_rank()); // TODO solve seeding problem + unsigned int tmp = s + sys->get_seed(); // adds salt to user seed + gen.seed( tmp ); } diff --git a/src/System.cpp b/src/System.cpp index 4c04d2b6..8ddf4614 100644 --- a/src/System.cpp +++ b/src/System.cpp @@ -93,6 +93,12 @@ void System::init() { auryn::logger->msg(oss.str(),ERROR); } + // init random number generator + // gen = boost::mt19937(); + dist = new boost::random::uniform_int_distribution<> (); + die = new boost::variate_generator > ( gen, *dist ); + set_master_seed(3521); + #ifndef NDEBUG oss.str(""); oss << "Warning Auryn was compiled with debugging features which will impair performance."; @@ -925,3 +931,27 @@ unsigned int System::mpi_rank() { return mpi_rank_; } + +void System::set_master_seed( unsigned int seed ) +{ + if ( seed == 0 ) { + seed = static_cast(std::time(0)); + } + + const unsigned int master_seed_multiplier = 257; + gen.seed(seed*master_seed_multiplier*mpi_rank()); +} + +unsigned int System::get_seed() +{ + return (*die)(); +} + +unsigned int System::get_synced_seed() +{ + unsigned int value; + if ( mpi_rank() == 0 ) value = get_seed(); + broadcast(*mpicom, value, 0); + // std::cout << mpi_rank() << " " << value << std::endl; + return value; +} diff --git a/src/System.h b/src/System.h index afaf3c21..8bde08f2 100644 --- a/src/System.h +++ b/src/System.h @@ -42,6 +42,11 @@ #include #include +#include +#include +#include +#include + #define PROGRESSBAR_DEFAULT_UPDATE_INTERVAL 1000 #define LOGGER_MARK_INTERVAL (10000*1000) // 1000s @@ -78,6 +83,10 @@ namespace auryn { string outputdir; + boost::mt19937 gen; + boost::random::uniform_int_distribution<> * dist; + boost::variate_generator > * die; + double simulation_time_realtime_ratio; /*! Store elapsed time for last call of run */ @@ -319,6 +328,25 @@ namespace auryn { * without mpi. */ unsigned int mpi_rank(); + /*! \brief Set master seed + * + * Set the master seed from which other seeds are drawn. + * When the master seed is set to 0 a master seed is generated + * from ctime and will be different at each run. + * */ + void set_master_seed( unsigned int seed = 123); + + /*! \brief Returns a random seed which is different on each rank + * + * */ + unsigned int get_seed(); + + /*! \brief Returns a random seed which is the same on each rank + * + * Can be used to synchronize randomness across ranks StimulusGroup etc + * */ + unsigned int get_synced_seed(); + #ifdef CODE_COLLECT_SYNC_TIMING_STATS AurynDouble deltaT; AurynDouble measurement_start; From 1ed7763f34b119dcc7ed7ba1e64c858f8356bf27 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 02:03:14 -0700 Subject: [PATCH 04/77] Adds salt to PoissonGroup --- src/PoissonGroup.cpp | 6 +++--- src/PoissonGroup.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PoissonGroup.cpp b/src/PoissonGroup.cpp index 13739ed3..8888019d 100644 --- a/src/PoissonGroup.cpp +++ b/src/PoissonGroup.cpp @@ -36,7 +36,8 @@ void PoissonGroup::init(AurynDouble rate) dist = new boost::uniform_01<> (); die = new boost::variate_generator > ( gen, *dist ); - gen.seed(sys->get_seed()); + salt = sys->get_seed(); + seed(sys->get_seed()); x = 0; set_rate( rate ); @@ -96,7 +97,6 @@ void PoissonGroup::evolve() void PoissonGroup::seed(unsigned int s) { - unsigned int tmp = s + sys->get_seed(); // adds salt to user seed - gen.seed( tmp ); + gen.seed( s + salt ); } diff --git a/src/PoissonGroup.h b/src/PoissonGroup.h index fe352d93..c47e3f82 100644 --- a/src/PoissonGroup.h +++ b/src/PoissonGroup.h @@ -60,6 +60,8 @@ class PoissonGroup : public SpikingGroup boost::uniform_01<> * dist; boost::variate_generator > * die; + unsigned int salt; + void init(AurynDouble rate); protected: @@ -84,7 +86,7 @@ class PoissonGroup : public SpikingGroup /*! Standard getter for the firing rate variable. */ AurynDouble get_rate(); /*! Use this to seed the random number generator. */ - void seed(int s); + void seed(unsigned int s); }; } From 7a387edfd521cfc639fb1c90f039b2a013a8a874 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 02:08:45 -0700 Subject: [PATCH 05/77] Adds salt --- src/SpikingGroup.cpp | 5 ++++- src/SpikingGroup.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SpikingGroup.cpp b/src/SpikingGroup.cpp index daa79d2a..1d46d8d8 100644 --- a/src/SpikingGroup.cpp +++ b/src/SpikingGroup.cpp @@ -58,6 +58,8 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) active = true; effective_load_multiplier = loadmultiplier; + salt = sys->get_seed(); + if ( total > 0 ) { anticipated_total = total; std::stringstream oss; @@ -98,6 +100,7 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) evolve_locally_bool = evolve_locally_bool && ( get_rank_size() > 0 ); + // some safety checks // Issue a warning for large neuron groups to check SyncBuffer delta datatype @@ -729,7 +732,7 @@ AurynStateVector * SpikingGroup::find_state_vector(std::string key) void SpikingGroup::randomize_state_vector_gauss(std::string state_vector_name, AurynState mean, AurynState sigma, int seed) { - boost::mt19937 ng_gen(seed+auryn::mpicommunicator->rank()); // produces same series every time + boost::mt19937 ng_gen(seed + salt); // produces same series every time boost::normal_distribution<> dist((double)mean, (double)sigma); boost::variate_generator > die(ng_gen, dist); AurynState rv; diff --git a/src/SpikingGroup.h b/src/SpikingGroup.h index 30eba83d..1f9dbe2f 100644 --- a/src/SpikingGroup.h +++ b/src/SpikingGroup.h @@ -111,6 +111,8 @@ class SpikingGroup SpikeContainer * spikes; AttributeContainer * attribs; + unsigned int salt; + /*! Stores the length of output delay */ static AurynTime * clock_ptr; From 24c7fd0130d378f798aa61885695ca99f1462361 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 02:10:54 -0700 Subject: [PATCH 06/77] Revert "Adds salt" This reverts commit 7a387edfd521cfc639fb1c90f039b2a013a8a874. --- src/SpikingGroup.cpp | 5 +---- src/SpikingGroup.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/SpikingGroup.cpp b/src/SpikingGroup.cpp index 1d46d8d8..daa79d2a 100644 --- a/src/SpikingGroup.cpp +++ b/src/SpikingGroup.cpp @@ -58,8 +58,6 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) active = true; effective_load_multiplier = loadmultiplier; - salt = sys->get_seed(); - if ( total > 0 ) { anticipated_total = total; std::stringstream oss; @@ -100,7 +98,6 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) evolve_locally_bool = evolve_locally_bool && ( get_rank_size() > 0 ); - // some safety checks // Issue a warning for large neuron groups to check SyncBuffer delta datatype @@ -732,7 +729,7 @@ AurynStateVector * SpikingGroup::find_state_vector(std::string key) void SpikingGroup::randomize_state_vector_gauss(std::string state_vector_name, AurynState mean, AurynState sigma, int seed) { - boost::mt19937 ng_gen(seed + salt); // produces same series every time + boost::mt19937 ng_gen(seed+auryn::mpicommunicator->rank()); // produces same series every time boost::normal_distribution<> dist((double)mean, (double)sigma); boost::variate_generator > die(ng_gen, dist); AurynState rv; diff --git a/src/SpikingGroup.h b/src/SpikingGroup.h index 1f9dbe2f..30eba83d 100644 --- a/src/SpikingGroup.h +++ b/src/SpikingGroup.h @@ -111,8 +111,6 @@ class SpikingGroup SpikeContainer * spikes; AttributeContainer * attribs; - unsigned int salt; - /*! Stores the length of output delay */ static AurynTime * clock_ptr; From c9f3f694d2dab3ee713a89488aeba39bb72d983c Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 10:03:01 -0700 Subject: [PATCH 07/77] Hotfix changes to aligned allocation in AurynVector Makes aligned memory allocation conditional on CODE_ALIGNED_SIMD_INSTRUCTIONS switch. --- src/AurynVector.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/AurynVector.h b/src/AurynVector.h index 6e25b7f4..b1c7f7fd 100644 --- a/src/AurynVector.h +++ b/src/AurynVector.h @@ -85,18 +85,26 @@ namespace auryn { /*! \brief Implements aligned memory allocation */ void allocate(const NeuronID n) { +#ifdef CODE_ALIGNED_SIMD_INSTRUCTIONS T * ptr = (T*)aligned_alloc(sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS,sizeof(T)*n); if ( ptr == NULL ) { // TODO implement proper exception handling throw AurynMemoryAlignmentException(); } +#else + T * ptr = new T[n]; +#endif data = ptr; size = n; set_zero(); } void freebuf() { +#ifdef CODE_ALIGNED_SIMD_INSTRUCTIONS free(data); +#else + delete [] data; +#endif } /*! \brief Computes approximation of exp(x) via fast series approximation up to n=256. */ From 175bc96cc00cb19fa76652682887c25db66a2a7a Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 10:18:29 -0700 Subject: [PATCH 08/77] Switches to master seed mechanism --- src/ProfilePoissonGroup.cpp | 2 +- src/SparseConnection.cpp | 2 +- src/StimulusGroup.cpp | 15 +++------------ 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/ProfilePoissonGroup.cpp b/src/ProfilePoissonGroup.cpp index 48c07bd8..1b92d554 100644 --- a/src/ProfilePoissonGroup.cpp +++ b/src/ProfilePoissonGroup.cpp @@ -37,7 +37,7 @@ void ProfilePoissonGroup::init(AurynDouble rate) dist = new boost::uniform_01<> (); die = new boost::variate_generator > ( gen, *dist ); - seed(sys->mpi_rank()); // seeding problem + seed(sys->get_seed()); // seeding problem x = 0; jumpsize = 0; diff --git a/src/SparseConnection.cpp b/src/SparseConnection.cpp index bf0ad194..21c27d33 100644 --- a/src/SparseConnection.cpp +++ b/src/SparseConnection.cpp @@ -131,7 +131,7 @@ void SparseConnection::init() else skip_diagonal = false; if ( !has_been_seeded ) { // seed it only once - int rseed = 12345*sys->mpi_rank() ; + unsigned int rseed = sys->get_seed(); seed(rseed); } diff --git a/src/StimulusGroup.cpp b/src/StimulusGroup.cpp index 4fe95644..a5c25f8d 100644 --- a/src/StimulusGroup.cpp +++ b/src/StimulusGroup.cpp @@ -554,21 +554,12 @@ void StimulusGroup::set_stimulation_mode( StimulusGroupModeType mode ) { void StimulusGroup::seed(int rndseed) { - order_gen.seed(rndseed); // has to be seeded identically on all ranks! - - boost::uniform_int<> dist(0,std::numeric_limits::max()); - boost::variate_generator > die(order_gen, dist); - - NeuronID rnd = die(); - for (int i = 0 ; i < sys->mpi_rank() ; ++i ) { - rnd = die(); - } - - order_gen.seed(rndseed); // has to be again here otherwise it is different on all ranks + order_gen.seed(sys->get_synced_seed()); // has to be seeded identically on all ranks! + unsigned int rnd = rndseed + sys->get_seed(); // adds salt to make it different across ranks std::stringstream oss; oss << "StimulusGroup:: " - << "seeding poisson generator with " + << "seeding Poisson generator with " << rnd; auryn::logger->msg(oss.str(),VERBOSE); From d07cf0bf5f5d3a25ce233f708a31b0d4d8d2606d Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Wed, 10 Aug 2016 17:19:55 -0700 Subject: [PATCH 09/77] Fixes bug in Python library --- tools/python/auryn_binary_tools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/python/auryn_binary_tools.py b/tools/python/auryn_binary_tools.py index a01ffc92..de9808e1 100755 --- a/tools/python/auryn_binary_tools.py +++ b/tools/python/auryn_binary_tools.py @@ -222,9 +222,10 @@ def time_triggered_histogram(self, trigger_times, time_offset=0.0, time_window=1 for t_spike in trigger_times: ts = t_spike+time_offset spikes = self.get_spikes(ts, ts+time_window) - sar = np.array(spikes, dtype=int)[:,1] - counts = np.bincount(sar, minlength=max_neuron_id) - hist += counts + if len(spikes): + sar = np.array(spikes, dtype=int)[:,1] + counts = np.bincount(sar, minlength=max_neuron_id) + hist += counts return hist From 294aa438f44bee9da220924a7c51c397aba9d0c0 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 01:58:38 -0700 Subject: [PATCH 10/77] Adds new master seed mechanisms to System --- examples/sim_poisson.cpp | 2 +- src/PoissonGroup.cpp | 7 ++++--- src/System.cpp | 30 ++++++++++++++++++++++++++++++ src/System.h | 28 ++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/examples/sim_poisson.cpp b/examples/sim_poisson.cpp index 556196bb..5176705a 100644 --- a/examples/sim_poisson.cpp +++ b/examples/sim_poisson.cpp @@ -35,7 +35,7 @@ int main(int ac, char* av[]) string msg; NeuronID size = 1000; - NeuronID seed = 1; + unsigned int seed = 1; double kappa = 5.; double simtime = 1.; diff --git a/src/PoissonGroup.cpp b/src/PoissonGroup.cpp index 9eeab364..13739ed3 100644 --- a/src/PoissonGroup.cpp +++ b/src/PoissonGroup.cpp @@ -36,7 +36,7 @@ void PoissonGroup::init(AurynDouble rate) dist = new boost::uniform_01<> (); die = new boost::variate_generator > ( gen, *dist ); - seed(620349123); + gen.seed(sys->get_seed()); x = 0; set_rate( rate ); @@ -94,8 +94,9 @@ void PoissonGroup::evolve() x -= get_rank_size(); } -void PoissonGroup::seed(int s) +void PoissonGroup::seed(unsigned int s) { - gen.seed(s+sys->mpi_rank()); // TODO solve seeding problem + unsigned int tmp = s + sys->get_seed(); // adds salt to user seed + gen.seed( tmp ); } diff --git a/src/System.cpp b/src/System.cpp index 58843166..9b1ba6c4 100644 --- a/src/System.cpp +++ b/src/System.cpp @@ -93,6 +93,12 @@ void System::init() { auryn::logger->msg(oss.str(),ERROR); } + // init random number generator + // gen = boost::mt19937(); + dist = new boost::random::uniform_int_distribution<> (); + die = new boost::variate_generator > ( gen, *dist ); + set_master_seed(3521); + #ifndef NDEBUG oss.str(""); oss << "Warning Auryn was compiled with debugging features which will impair performance."; @@ -918,3 +924,27 @@ unsigned int System::mpi_rank() { return mpi_rank_; } + +void System::set_master_seed( unsigned int seed ) +{ + if ( seed == 0 ) { + seed = static_cast(std::time(0)); + } + + const unsigned int master_seed_multiplier = 257; + gen.seed(seed*master_seed_multiplier*mpi_rank()); +} + +unsigned int System::get_seed() +{ + return (*die)(); +} + +unsigned int System::get_synced_seed() +{ + unsigned int value; + if ( mpi_rank() == 0 ) value = get_seed(); + broadcast(*mpicom, value, 0); + // std::cout << mpi_rank() << " " << value << std::endl; + return value; +} diff --git a/src/System.h b/src/System.h index afaf3c21..8bde08f2 100644 --- a/src/System.h +++ b/src/System.h @@ -42,6 +42,11 @@ #include #include +#include +#include +#include +#include + #define PROGRESSBAR_DEFAULT_UPDATE_INTERVAL 1000 #define LOGGER_MARK_INTERVAL (10000*1000) // 1000s @@ -78,6 +83,10 @@ namespace auryn { string outputdir; + boost::mt19937 gen; + boost::random::uniform_int_distribution<> * dist; + boost::variate_generator > * die; + double simulation_time_realtime_ratio; /*! Store elapsed time for last call of run */ @@ -319,6 +328,25 @@ namespace auryn { * without mpi. */ unsigned int mpi_rank(); + /*! \brief Set master seed + * + * Set the master seed from which other seeds are drawn. + * When the master seed is set to 0 a master seed is generated + * from ctime and will be different at each run. + * */ + void set_master_seed( unsigned int seed = 123); + + /*! \brief Returns a random seed which is different on each rank + * + * */ + unsigned int get_seed(); + + /*! \brief Returns a random seed which is the same on each rank + * + * Can be used to synchronize randomness across ranks StimulusGroup etc + * */ + unsigned int get_synced_seed(); + #ifdef CODE_COLLECT_SYNC_TIMING_STATS AurynDouble deltaT; AurynDouble measurement_start; From e0a5e962761d2a9b6e2f87004f26e2e8b1a53a73 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 02:03:14 -0700 Subject: [PATCH 11/77] Adds salt to PoissonGroup --- src/PoissonGroup.cpp | 6 +++--- src/PoissonGroup.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PoissonGroup.cpp b/src/PoissonGroup.cpp index 13739ed3..8888019d 100644 --- a/src/PoissonGroup.cpp +++ b/src/PoissonGroup.cpp @@ -36,7 +36,8 @@ void PoissonGroup::init(AurynDouble rate) dist = new boost::uniform_01<> (); die = new boost::variate_generator > ( gen, *dist ); - gen.seed(sys->get_seed()); + salt = sys->get_seed(); + seed(sys->get_seed()); x = 0; set_rate( rate ); @@ -96,7 +97,6 @@ void PoissonGroup::evolve() void PoissonGroup::seed(unsigned int s) { - unsigned int tmp = s + sys->get_seed(); // adds salt to user seed - gen.seed( tmp ); + gen.seed( s + salt ); } diff --git a/src/PoissonGroup.h b/src/PoissonGroup.h index fe352d93..c47e3f82 100644 --- a/src/PoissonGroup.h +++ b/src/PoissonGroup.h @@ -60,6 +60,8 @@ class PoissonGroup : public SpikingGroup boost::uniform_01<> * dist; boost::variate_generator > * die; + unsigned int salt; + void init(AurynDouble rate); protected: @@ -84,7 +86,7 @@ class PoissonGroup : public SpikingGroup /*! Standard getter for the firing rate variable. */ AurynDouble get_rate(); /*! Use this to seed the random number generator. */ - void seed(int s); + void seed(unsigned int s); }; } From 775d03cc5a946493a2ca25b1c277bfbc4e02552b Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 02:08:45 -0700 Subject: [PATCH 12/77] Adds salt --- src/SpikingGroup.cpp | 5 ++++- src/SpikingGroup.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/SpikingGroup.cpp b/src/SpikingGroup.cpp index daa79d2a..1d46d8d8 100644 --- a/src/SpikingGroup.cpp +++ b/src/SpikingGroup.cpp @@ -58,6 +58,8 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) active = true; effective_load_multiplier = loadmultiplier; + salt = sys->get_seed(); + if ( total > 0 ) { anticipated_total = total; std::stringstream oss; @@ -98,6 +100,7 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) evolve_locally_bool = evolve_locally_bool && ( get_rank_size() > 0 ); + // some safety checks // Issue a warning for large neuron groups to check SyncBuffer delta datatype @@ -729,7 +732,7 @@ AurynStateVector * SpikingGroup::find_state_vector(std::string key) void SpikingGroup::randomize_state_vector_gauss(std::string state_vector_name, AurynState mean, AurynState sigma, int seed) { - boost::mt19937 ng_gen(seed+auryn::mpicommunicator->rank()); // produces same series every time + boost::mt19937 ng_gen(seed + salt); // produces same series every time boost::normal_distribution<> dist((double)mean, (double)sigma); boost::variate_generator > die(ng_gen, dist); AurynState rv; diff --git a/src/SpikingGroup.h b/src/SpikingGroup.h index 30eba83d..1f9dbe2f 100644 --- a/src/SpikingGroup.h +++ b/src/SpikingGroup.h @@ -111,6 +111,8 @@ class SpikingGroup SpikeContainer * spikes; AttributeContainer * attribs; + unsigned int salt; + /*! Stores the length of output delay */ static AurynTime * clock_ptr; From 133240b7efea8a49e796c5ab5f3563cf6ba3fc06 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 02:10:54 -0700 Subject: [PATCH 13/77] Revert "Adds salt" This reverts commit 7a387edfd521cfc639fb1c90f039b2a013a8a874. --- src/SpikingGroup.cpp | 5 +---- src/SpikingGroup.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/SpikingGroup.cpp b/src/SpikingGroup.cpp index 1d46d8d8..daa79d2a 100644 --- a/src/SpikingGroup.cpp +++ b/src/SpikingGroup.cpp @@ -58,8 +58,6 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) active = true; effective_load_multiplier = loadmultiplier; - salt = sys->get_seed(); - if ( total > 0 ) { anticipated_total = total; std::stringstream oss; @@ -100,7 +98,6 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) evolve_locally_bool = evolve_locally_bool && ( get_rank_size() > 0 ); - // some safety checks // Issue a warning for large neuron groups to check SyncBuffer delta datatype @@ -732,7 +729,7 @@ AurynStateVector * SpikingGroup::find_state_vector(std::string key) void SpikingGroup::randomize_state_vector_gauss(std::string state_vector_name, AurynState mean, AurynState sigma, int seed) { - boost::mt19937 ng_gen(seed + salt); // produces same series every time + boost::mt19937 ng_gen(seed+auryn::mpicommunicator->rank()); // produces same series every time boost::normal_distribution<> dist((double)mean, (double)sigma); boost::variate_generator > die(ng_gen, dist); AurynState rv; diff --git a/src/SpikingGroup.h b/src/SpikingGroup.h index 1f9dbe2f..30eba83d 100644 --- a/src/SpikingGroup.h +++ b/src/SpikingGroup.h @@ -111,8 +111,6 @@ class SpikingGroup SpikeContainer * spikes; AttributeContainer * attribs; - unsigned int salt; - /*! Stores the length of output delay */ static AurynTime * clock_ptr; From 9f1bdb667562af40aefa3090421a03339c57672a Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 11:18:06 -0700 Subject: [PATCH 14/77] Adds refresh function for file wrapper in python tools --- tools/python/auryn_binary_tools.py | 36 +++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/tools/python/auryn_binary_tools.py b/tools/python/auryn_binary_tools.py index de9808e1..4fa95435 100755 --- a/tools/python/auryn_binary_tools.py +++ b/tools/python/auryn_binary_tools.py @@ -45,11 +45,8 @@ def find_frame(self, time=0, lower=False): def read_frames(self, bufsize): return self.datafile.read(bufsize*self.frame_size) - def open_file(self): - - # TODO add exception handling - self.frame_size = struct.calcsize(self.data_format) - self.datafile = open(self.filename, "rb") + def refresh(self): + ''' Reload file internal properties in case the file has changed''' # Reader spk file header data = self.datafile.read(self.frame_size) @@ -79,6 +76,15 @@ def open_file(self): at,val = self.get_frame(self.last_frame) self.t_max = at*self.timestep + def open_file(self): + + # TODO add exception handling + self.frame_size = struct.calcsize(self.data_format) + self.datafile = open(self.filename, "rb") + + self.refresh() + + class AurynBinaryStateFile(AurynBinaryFile): ''' This class gives abstract access to binary Auryn state monitor file. @@ -151,6 +157,26 @@ def get_spikes( self, t_start=0.0, t_stop=1e32, max_id=1e32 ): spikes.append((self.timestep*at, nid)) return spikes + def get_spike_counts( self, t_start=0.0, t_stop=1e32, min_size=1 ): + idx_start = self.find_frame( t_start, lower=False ) + idx_stop = self.find_frame( t_stop, lower=True ) + start_pos = idx_start*self.frame_size + num_elements = idx_stop-idx_start + + self.datafile.seek(start_pos,0) + data = self.datafile.read(num_elements*self.frame_size) + + counts = np.zeros(min_size) + for i in xrange(num_elements): + at, nid = struct.unpack_from(self.data_format, data, i*self.frame_size) + if nid >= len(counts): + counts.resize(nid+1) + counts[nid] += 1 + return counts + + def get_firing_rates( self, t_start=0.0, t_stop=1e32, min_size=1 ): + return self.get_spike_counts( t_start, t_stop, min_size )/(t_stop-t_start) + def get_last( self, seconds=1.0 ): ''' Returns the last x seconds of spikes''' return self.get_spikes(t_start=self.t_max-seconds) From b27b8f418716d4ed20c3f352dd2c561bf917e136 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 11:44:36 -0700 Subject: [PATCH 15/77] Implements boost alignment --- CMakeLists.txt | 4 ++-- src/AurynVector.h | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 757b0c42..334d39f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,8 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic") FIND_PACKAGE(MPI REQUIRED) # Required Boost libraries -SET(BOOST_MIN_VERSION "1.41.0") -FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization program_options date_time unit_test_framework system filesystem) +SET(BOOST_MIN_VERSION "1.56.0") +FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization program_options date_time unit_test_framework system filesystem align) # Recommended: Doxygen FIND_PACKAGE(Doxygen) diff --git a/src/AurynVector.h b/src/AurynVector.h index 2473b834..4929a010 100644 --- a/src/AurynVector.h +++ b/src/AurynVector.h @@ -29,6 +29,7 @@ #include #include #include "auryn_definitions.h" +#include namespace auryn { @@ -91,16 +92,11 @@ namespace auryn { /*! \brief Implements aligned memory allocation */ void allocate(const NeuronID n) { #ifdef CODE_ALIGNED_SIMD_INSTRUCTIONS - std::size_t mem_alignment = sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS; - std::size_t mem_size = sizeof(T)*n; - mem = malloc(mem_size+mem_alignment-1); // adds padding to allocated memory - T * ptr = (T*)mem; - if ( (unsigned long)mem%mem_alignment ) ptr = (T*)(((unsigned long)mem/mem_alignment+1)*mem_alignment); - if ( mem == NULL ) { + T * ptr = (T*)boost::alignment::aligned_alloc(sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS,sizeof(T)*n); + if ( ptr == NULL ) { // TODO implement proper exception handling throw AurynMemoryAlignmentException(); } - assert(((unsigned long)ptr % mem_alignment) == 0); #else T * ptr = new T[n]; #endif @@ -111,7 +107,7 @@ namespace auryn { void freebuf() { #ifdef CODE_ALIGNED_SIMD_INSTRUCTIONS - free(mem); + boost::alignment::aligned_free(data); #else delete [] data; #endif From efd513b82bbb1356ee03d38ded6dedc689324f57 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 12:48:05 -0700 Subject: [PATCH 16/77] Adds new version requirements to CMakeLists.txt --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 334d39f3..9171ee23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,9 @@ FIND_PACKAGE(MPI REQUIRED) # Required Boost libraries SET(BOOST_MIN_VERSION "1.56.0") -FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization program_options date_time unit_test_framework system filesystem align) +FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization program_options date_time unit_test_framework system filesystem) +# TODO should add align to the components list but for some reason CMake does not find it +# Maybe because it is header only? # Recommended: Doxygen FIND_PACKAGE(Doxygen) From 98e695b3ef1baa6ae2c2ae80add7cb55e598c326 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 11 Aug 2016 13:45:31 -0700 Subject: [PATCH 17/77] Moves Doxygen mainpage to doc --- doc/Doxyfile | 2 +- {src => doc}/mainpage.md | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {src => doc}/mainpage.md (100%) diff --git a/doc/Doxyfile b/doc/Doxyfile index ad9a8ffa..98f76d78 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -598,7 +598,7 @@ WARN_LOGFILE = # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = ../src ../examples/ +INPUT = . ../src ../examples/ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is diff --git a/src/mainpage.md b/doc/mainpage.md similarity index 100% rename from src/mainpage.md rename to doc/mainpage.md From 812b916ac705d98d29fa342461c1ba2b54969e67 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 12 Aug 2016 09:53:58 -0700 Subject: [PATCH 18/77] Uses master seeding mechanisms in example --- examples/sim_poisson.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sim_poisson.cpp b/examples/sim_poisson.cpp index 5176705a..2fc6e6b6 100644 --- a/examples/sim_poisson.cpp +++ b/examples/sim_poisson.cpp @@ -101,9 +101,9 @@ int main(int ac, char* av[]) } auryn_init(ac, av); + sys->set_master_seed(seed); PoissonGroup * poisson = new PoissonGroup(size,kappa); - poisson->seed(seed); sprintf(strbuf, "%s/%s.%d.ras", dir.c_str(), file_prefix.c_str(), sys->mpi_rank() ); SpikeMonitor * smon_e = new SpikeMonitor( poisson, strbuf, size); From 22d1f68359cecf566bc75d515cb90ed5866d6b11 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 12 Aug 2016 15:28:17 -0700 Subject: [PATCH 19/77] Implements flush() in BinarySpikeMonitor --- src/BinarySpikeMonitor.cpp | 5 +++++ src/BinarySpikeMonitor.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BinarySpikeMonitor.cpp b/src/BinarySpikeMonitor.cpp index 5a8b3870..8c645a0e 100644 --- a/src/BinarySpikeMonitor.cpp +++ b/src/BinarySpikeMonitor.cpp @@ -121,3 +121,8 @@ void BinarySpikeMonitor::propagate() } } } + +void BinarySpikeMonitor::flush() +{ + outfile.flush(); +} diff --git a/src/BinarySpikeMonitor.h b/src/BinarySpikeMonitor.h index f9f3488c..231d2d74 100644 --- a/src/BinarySpikeMonitor.h +++ b/src/BinarySpikeMonitor.h @@ -66,7 +66,8 @@ class BinarySpikeMonitor : public Monitor void set_offset(NeuronID of); void set_every(NeuronID every); virtual ~BinarySpikeMonitor(); - void propagate(); + virtual void propagate(); + virtual void flush(); }; From d3288609a2539ac0817e97739c25fec9301b75bd Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Sun, 14 Aug 2016 21:40:41 -0700 Subject: [PATCH 20/77] Changes interface of Connection member function --- src/Connection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Connection.h b/src/Connection.h index 551bda5a..1775083f 100644 --- a/src/Connection.h +++ b/src/Connection.h @@ -250,7 +250,7 @@ class Connection /*! \brief Transmits a spike to a given target group and state * * The method exposes the transmit interface and should not be used unless you know exactly what you are doing. */ - void targeted_transmit(NeuronGroup * target_group, AurynStateVector * target_state, const NeuronID id, const AurynWeight amount); + void targeted_transmit(SpikingGroup * target_group, AurynStateVector * target_state, const NeuronID id, const AurynWeight amount); /*! \brief Same as transmit but first checks if the target neuron exists and avoids segfaults that way (but it's also slower). */ void safe_transmit(NeuronID id, AurynWeight amount); @@ -284,7 +284,7 @@ class Connection BOOST_SERIALIZATION_ASSUME_ABSTRACT(Connection) -inline void Connection::targeted_transmit(NeuronGroup * target_group, AurynStateVector * target_state, const NeuronID id, const AurynWeight amount) +inline void Connection::targeted_transmit(SpikingGroup * target_group, AurynStateVector * target_state, const NeuronID id, const AurynWeight amount) { const NeuronID localid = target_group->global2rank(id); target_state->data[localid]+=amount; From 0b9b74bcf6f37a2ab75ccb622419ebadbccb6ac9 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Sun, 14 Aug 2016 22:47:57 -0700 Subject: [PATCH 21/77] Updates requirements for boost libs in travis file --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3c32cf52..47042570 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ compiler: - gcc install: - sudo apt-get update -qq - - sudo apt-get install -y -qq mpi-default-bin mpi-default-dev libboost-all-dev cmake + - sudo apt-get install -y -qq mpi-default-bin mpi-default-dev cmake + - sudo apt-get install -y -qq libboost1.56-all-dev script: - cd build/release && cmake ../../ -DCMAKE_BUILD_TYPE=Release && make && cd ../../test && ./run_tests.sh From 12156c12a8ba881e5649430aa6ad752b0da7e23d Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Sun, 14 Aug 2016 22:56:18 -0700 Subject: [PATCH 22/77] Reverts new boost based alignment for Travis CI --- src/AurynVector.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/AurynVector.h b/src/AurynVector.h index 4929a010..8b3f0e44 100644 --- a/src/AurynVector.h +++ b/src/AurynVector.h @@ -29,7 +29,6 @@ #include #include #include "auryn_definitions.h" -#include namespace auryn { @@ -92,11 +91,18 @@ namespace auryn { /*! \brief Implements aligned memory allocation */ void allocate(const NeuronID n) { #ifdef CODE_ALIGNED_SIMD_INSTRUCTIONS - T * ptr = (T*)boost::alignment::aligned_alloc(sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS,sizeof(T)*n); - if ( ptr == NULL ) { + std::size_t mem_alignment = sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS; + std::size_t mem_size = sizeof(T)*n; + mem = malloc(mem_size+mem_alignment-1); // adds padding to allocated memory + T * ptr = (T*)mem; + if ( (unsigned long)mem%mem_alignment ) ptr = (T*)(((unsigned long)mem/mem_alignment+1)*mem_alignment); + //! \todo TODO Replace above alignment code with boost code once boost 1.56 is commonly available with the dists + // T * ptr = (T*)boost::alignment::aligned_alloc(sizeof(T)*SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS,sizeof(T)*n); + if ( mem == NULL ) { // TODO implement proper exception handling throw AurynMemoryAlignmentException(); } + assert(((unsigned long)ptr % mem_alignment) == 0); #else T * ptr = new T[n]; #endif @@ -107,7 +113,9 @@ namespace auryn { void freebuf() { #ifdef CODE_ALIGNED_SIMD_INSTRUCTIONS - boost::alignment::aligned_free(data); + free(mem); + //! \todo TODO Replace above alignment code with boost code once boost 1.56 is commonly available with the dists + // boost::alignment::aligned_free(data); #else delete [] data; #endif From 5c36b81ab4cc2d09c23f8ffcc2b986be89c9f032 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Sun, 14 Aug 2016 22:56:36 -0700 Subject: [PATCH 23/77] Revert "Updates requirements for boost libs in travis file" This reverts commit 0b9b74bcf6f37a2ab75ccb622419ebadbccb6ac9. --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 47042570..3c32cf52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ compiler: - gcc install: - sudo apt-get update -qq - - sudo apt-get install -y -qq mpi-default-bin mpi-default-dev cmake - - sudo apt-get install -y -qq libboost1.56-all-dev + - sudo apt-get install -y -qq mpi-default-bin mpi-default-dev libboost-all-dev cmake script: - cd build/release && cmake ../../ -DCMAKE_BUILD_TYPE=Release && make && cd ../../test && ./run_tests.sh From efc554e322bb5dafca3563076576de9f8707c8a4 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Sun, 14 Aug 2016 23:00:34 -0700 Subject: [PATCH 24/77] Reverst required boost version to 1.41 --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9171ee23..d8aadbb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,10 +17,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic") FIND_PACKAGE(MPI REQUIRED) # Required Boost libraries -SET(BOOST_MIN_VERSION "1.56.0") +SET(BOOST_MIN_VERSION "1.41.0") FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization program_options date_time unit_test_framework system filesystem) -# TODO should add align to the components list but for some reason CMake does not find it -# Maybe because it is header only? +# TODO add align to the components list once AurynVector uses it # Recommended: Doxygen FIND_PACKAGE(Doxygen) From 03ad77ff70ba2d1ea9274843902b0fe7d7aa3012 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Mon, 15 Aug 2016 10:02:23 -0700 Subject: [PATCH 25/77] Makes CMakeLists nicer --- CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8aadbb5..a0ab7bc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ -cmake_minimum_required (VERSION 2.8.11) -project (Auryn) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) +PROJECT(Auryn) # The version number. -set (Auryn_VERSION_MAJOR 0) -set (Auryn_VERSION_MINOR 8) +SET(Auryn_VERSION_MAJOR 0) +SET(Auryn_VERSION_MINOR 8) # Important GCC Compiler flags for Auryn's performance -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native -ffast-math -pipe") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic") +SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native -ffast-math -pipe") +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic") # Display flags (for debugging only) # message("CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}") @@ -24,7 +24,6 @@ FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization pr # Recommended: Doxygen FIND_PACKAGE(Doxygen) - INCLUDE_DIRECTORIES( ${MPI_CXX_INCLUDE_PATH} ) INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ) INCLUDE_DIRECTORIES(src) From f53d84ae6c27c52896cc1afaab482ea217c5144b Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Mon, 15 Aug 2016 10:51:44 -0700 Subject: [PATCH 26/77] Changes directory structure for clean install --- examples/sim_bg_lowpass.cpp | 1 - src/CMakeLists.txt | 16 +- src/auryn.h | 137 +++++++++--------- src/{ => auryn}/ABSConnection.cpp | 0 src/{ => auryn}/ABSConnection.h | 0 src/{ => auryn}/AIF2Group.cpp | 0 src/{ => auryn}/AIF2Group.h | 0 src/{ => auryn}/AIFGroup.cpp | 0 src/{ => auryn}/AIFGroup.h | 0 src/{ => auryn}/AdExGroup.cpp | 0 src/{ => auryn}/AdExGroup.h | 0 src/{ => auryn}/AllToAllConnection.cpp | 0 src/{ => auryn}/AllToAllConnection.h | 0 src/{ => auryn}/AuditoryBeepGroup.cpp | 0 src/{ => auryn}/AuditoryBeepGroup.h | 0 src/{ => auryn}/AurynVector.cpp | 0 src/{ => auryn}/AurynVector.h | 0 src/{ => auryn}/AurynVersion.cpp | 0 src/{ => auryn}/AurynVersion.h | 0 src/{ => auryn}/BinarySpikeMonitor.cpp | 0 src/{ => auryn}/BinarySpikeMonitor.h | 0 src/{ => auryn}/BinaryStateMonitor.cpp | 0 src/{ => auryn}/BinaryStateMonitor.h | 0 src/{ => auryn}/Checker.cpp | 0 src/{ => auryn}/Checker.h | 0 src/{ => auryn}/ComplexMatrix.cpp | 0 src/{ => auryn}/ComplexMatrix.h | 0 src/{ => auryn}/Connection.cpp | 0 src/{ => auryn}/Connection.h | 0 src/{ => auryn}/CorrelatedPoissonGroup.cpp | 0 src/{ => auryn}/CorrelatedPoissonGroup.h | 0 src/{ => auryn}/CubaIFGroup.cpp | 0 src/{ => auryn}/CubaIFGroup.h | 0 src/{ => auryn}/CurrentInjector.cpp | 0 src/{ => auryn}/CurrentInjector.h | 0 src/{ => auryn}/DelayedSpikeMonitor.cpp | 0 src/{ => auryn}/DelayedSpikeMonitor.h | 0 src/{ => auryn}/Device.cpp | 0 src/{ => auryn}/Device.h | 0 src/{ => auryn}/DuplexConnection.cpp | 0 src/{ => auryn}/DuplexConnection.h | 0 src/{ => auryn}/EulerTrace.cpp | 0 src/{ => auryn}/EulerTrace.h | 0 src/{ => auryn}/FileInputGroup.cpp | 0 src/{ => auryn}/FileInputGroup.h | 0 src/{ => auryn}/FileModulatedPoissonGroup.cpp | 0 src/{ => auryn}/FileModulatedPoissonGroup.h | 0 src/{ => auryn}/IFGroup.cpp | 0 src/{ => auryn}/IFGroup.h | 0 src/{ => auryn}/IafPscDeltaGroup.cpp | 0 src/{ => auryn}/IafPscDeltaGroup.h | 0 src/{ => auryn}/IafPscExpGroup.cpp | 0 src/{ => auryn}/IafPscExpGroup.h | 0 src/{ => auryn}/IdentityConnection.cpp | 0 src/{ => auryn}/IdentityConnection.h | 0 src/{ => auryn}/IzhikevichGroup.cpp | 0 src/{ => auryn}/IzhikevichGroup.h | 0 src/{ => auryn}/LPTripletConnection.cpp | 0 src/{ => auryn}/LPTripletConnection.h | 0 src/{ => auryn}/LinearTrace.cpp | 0 src/{ => auryn}/LinearTrace.h | 0 src/{ => auryn}/Logger.cpp | 0 src/{ => auryn}/Logger.h | 0 src/{ => auryn}/Monitor.cpp | 0 src/{ => auryn}/Monitor.h | 0 src/{ => auryn}/MovingBumpGroup.cpp | 0 src/{ => auryn}/MovingBumpGroup.h | 0 src/{ => auryn}/NeuronGroup.cpp | 0 src/{ => auryn}/NeuronGroup.h | 0 src/{ => auryn}/NormalStimulator.cpp | 0 src/{ => auryn}/NormalStimulator.h | 0 src/{ => auryn}/PairInteractionConnection.cpp | 0 src/{ => auryn}/PairInteractionConnection.h | 0 src/{ => auryn}/PatternMonitor.cpp | 0 src/{ => auryn}/PatternMonitor.h | 0 src/{ => auryn}/PatternStimulator.cpp | 0 src/{ => auryn}/PatternStimulator.h | 0 src/{ => auryn}/PoissonGroup.cpp | 0 src/{ => auryn}/PoissonGroup.h | 0 src/{ => auryn}/PoissonStimulator.cpp | 0 src/{ => auryn}/PoissonStimulator.h | 0 src/{ => auryn}/PopulationRateMonitor.cpp | 0 src/{ => auryn}/PopulationRateMonitor.h | 0 src/{ => auryn}/ProfilePoissonGroup.cpp | 0 src/{ => auryn}/ProfilePoissonGroup.h | 0 src/{ => auryn}/RateChecker.cpp | 0 src/{ => auryn}/RateChecker.h | 0 src/{ => auryn}/RateModulatedConnection.cpp | 0 src/{ => auryn}/RateModulatedConnection.h | 0 src/{ => auryn}/RateMonitor.cpp | 0 src/{ => auryn}/RateMonitor.h | 0 src/{ => auryn}/RealTimeMonitor.cpp | 0 src/{ => auryn}/RealTimeMonitor.h | 0 src/{ => auryn}/STDPConnection.cpp | 0 src/{ => auryn}/STDPConnection.h | 0 src/{ => auryn}/STDPwdConnection.cpp | 0 src/{ => auryn}/STDPwdConnection.h | 0 src/{ => auryn}/STPConnection.cpp | 0 src/{ => auryn}/STPConnection.h | 0 src/{ => auryn}/SimpleMatrix.cpp | 0 src/{ => auryn}/SimpleMatrix.h | 0 src/{ => auryn}/SparseConnection.cpp | 0 src/{ => auryn}/SparseConnection.h | 0 src/{ => auryn}/SpikeDelay.cpp | 0 src/{ => auryn}/SpikeDelay.h | 0 src/{ => auryn}/SpikeMonitor.cpp | 0 src/{ => auryn}/SpikeMonitor.h | 0 src/{ => auryn}/SpikeTimingStimGroup.cpp | 0 src/{ => auryn}/SpikeTimingStimGroup.h | 0 src/{ => auryn}/SpikingGroup.cpp | 0 src/{ => auryn}/SpikingGroup.h | 0 src/{ => auryn}/StateMonitor.cpp | 0 src/{ => auryn}/StateMonitor.h | 0 src/{ => auryn}/StimulusGroup.cpp | 0 src/{ => auryn}/StimulusGroup.h | 0 src/{ => auryn}/StructuredPoissonGroup.cpp | 0 src/{ => auryn}/StructuredPoissonGroup.h | 0 src/{ => auryn}/SymmetricSTDPConnection.cpp | 0 src/{ => auryn}/SymmetricSTDPConnection.h | 0 src/{ => auryn}/SyncBuffer.cpp | 0 src/{ => auryn}/SyncBuffer.h | 0 src/{ => auryn}/System.cpp | 0 src/{ => auryn}/System.h | 0 src/{ => auryn}/TIFGroup.cpp | 0 src/{ => auryn}/TIFGroup.h | 0 src/{ => auryn}/TripletConnection.cpp | 0 src/{ => auryn}/TripletConnection.h | 0 src/{ => auryn}/TripletDecayConnection.cpp | 0 src/{ => auryn}/TripletDecayConnection.h | 0 src/{ => auryn}/TripletScalingConnection.cpp | 0 src/{ => auryn}/TripletScalingConnection.h | 0 src/{ => auryn}/VoltageMonitor.cpp | 0 src/{ => auryn}/VoltageMonitor.h | 0 src/{ => auryn}/WeightChecker.cpp | 0 src/{ => auryn}/WeightChecker.h | 0 src/{ => auryn}/WeightMatrixMonitor.cpp | 0 src/{ => auryn}/WeightMatrixMonitor.h | 0 src/{ => auryn}/WeightMonitor.cpp | 0 src/{ => auryn}/WeightMonitor.h | 0 src/{ => auryn}/WeightPatternMonitor.cpp | 0 src/{ => auryn}/WeightPatternMonitor.h | 0 src/{ => auryn}/WeightStatsMonitor.cpp | 0 src/{ => auryn}/WeightStatsMonitor.h | 0 src/{ => auryn}/WeightSumMonitor.cpp | 0 src/{ => auryn}/WeightSumMonitor.h | 0 src/{ => auryn}/auryn_definitions.cpp | 0 src/{ => auryn}/auryn_definitions.h | 0 src/{ => auryn}/auryn_global.cpp | 0 src/{ => auryn}/auryn_global.h | 0 src/{ => auryn}/mk_version_info.sh | 0 test/src/test_AurynStateVector.cpp | 4 +- test/src/test_AurynVector.cpp | 2 +- test/src/test_ComplexMatrix.cpp | 2 +- tools/aube.cpp | 2 +- tools/aubs.cpp | 2 +- 155 files changed, 90 insertions(+), 76 deletions(-) rename src/{ => auryn}/ABSConnection.cpp (100%) rename src/{ => auryn}/ABSConnection.h (100%) rename src/{ => auryn}/AIF2Group.cpp (100%) rename src/{ => auryn}/AIF2Group.h (100%) rename src/{ => auryn}/AIFGroup.cpp (100%) rename src/{ => auryn}/AIFGroup.h (100%) rename src/{ => auryn}/AdExGroup.cpp (100%) rename src/{ => auryn}/AdExGroup.h (100%) rename src/{ => auryn}/AllToAllConnection.cpp (100%) rename src/{ => auryn}/AllToAllConnection.h (100%) rename src/{ => auryn}/AuditoryBeepGroup.cpp (100%) rename src/{ => auryn}/AuditoryBeepGroup.h (100%) rename src/{ => auryn}/AurynVector.cpp (100%) rename src/{ => auryn}/AurynVector.h (100%) rename src/{ => auryn}/AurynVersion.cpp (100%) rename src/{ => auryn}/AurynVersion.h (100%) rename src/{ => auryn}/BinarySpikeMonitor.cpp (100%) rename src/{ => auryn}/BinarySpikeMonitor.h (100%) rename src/{ => auryn}/BinaryStateMonitor.cpp (100%) rename src/{ => auryn}/BinaryStateMonitor.h (100%) rename src/{ => auryn}/Checker.cpp (100%) rename src/{ => auryn}/Checker.h (100%) rename src/{ => auryn}/ComplexMatrix.cpp (100%) rename src/{ => auryn}/ComplexMatrix.h (100%) rename src/{ => auryn}/Connection.cpp (100%) rename src/{ => auryn}/Connection.h (100%) rename src/{ => auryn}/CorrelatedPoissonGroup.cpp (100%) rename src/{ => auryn}/CorrelatedPoissonGroup.h (100%) rename src/{ => auryn}/CubaIFGroup.cpp (100%) rename src/{ => auryn}/CubaIFGroup.h (100%) rename src/{ => auryn}/CurrentInjector.cpp (100%) rename src/{ => auryn}/CurrentInjector.h (100%) rename src/{ => auryn}/DelayedSpikeMonitor.cpp (100%) rename src/{ => auryn}/DelayedSpikeMonitor.h (100%) rename src/{ => auryn}/Device.cpp (100%) rename src/{ => auryn}/Device.h (100%) rename src/{ => auryn}/DuplexConnection.cpp (100%) rename src/{ => auryn}/DuplexConnection.h (100%) rename src/{ => auryn}/EulerTrace.cpp (100%) rename src/{ => auryn}/EulerTrace.h (100%) rename src/{ => auryn}/FileInputGroup.cpp (100%) rename src/{ => auryn}/FileInputGroup.h (100%) rename src/{ => auryn}/FileModulatedPoissonGroup.cpp (100%) rename src/{ => auryn}/FileModulatedPoissonGroup.h (100%) rename src/{ => auryn}/IFGroup.cpp (100%) rename src/{ => auryn}/IFGroup.h (100%) rename src/{ => auryn}/IafPscDeltaGroup.cpp (100%) rename src/{ => auryn}/IafPscDeltaGroup.h (100%) rename src/{ => auryn}/IafPscExpGroup.cpp (100%) rename src/{ => auryn}/IafPscExpGroup.h (100%) rename src/{ => auryn}/IdentityConnection.cpp (100%) rename src/{ => auryn}/IdentityConnection.h (100%) rename src/{ => auryn}/IzhikevichGroup.cpp (100%) rename src/{ => auryn}/IzhikevichGroup.h (100%) rename src/{ => auryn}/LPTripletConnection.cpp (100%) rename src/{ => auryn}/LPTripletConnection.h (100%) rename src/{ => auryn}/LinearTrace.cpp (100%) rename src/{ => auryn}/LinearTrace.h (100%) rename src/{ => auryn}/Logger.cpp (100%) rename src/{ => auryn}/Logger.h (100%) rename src/{ => auryn}/Monitor.cpp (100%) rename src/{ => auryn}/Monitor.h (100%) rename src/{ => auryn}/MovingBumpGroup.cpp (100%) rename src/{ => auryn}/MovingBumpGroup.h (100%) rename src/{ => auryn}/NeuronGroup.cpp (100%) rename src/{ => auryn}/NeuronGroup.h (100%) rename src/{ => auryn}/NormalStimulator.cpp (100%) rename src/{ => auryn}/NormalStimulator.h (100%) rename src/{ => auryn}/PairInteractionConnection.cpp (100%) rename src/{ => auryn}/PairInteractionConnection.h (100%) rename src/{ => auryn}/PatternMonitor.cpp (100%) rename src/{ => auryn}/PatternMonitor.h (100%) rename src/{ => auryn}/PatternStimulator.cpp (100%) rename src/{ => auryn}/PatternStimulator.h (100%) rename src/{ => auryn}/PoissonGroup.cpp (100%) rename src/{ => auryn}/PoissonGroup.h (100%) rename src/{ => auryn}/PoissonStimulator.cpp (100%) rename src/{ => auryn}/PoissonStimulator.h (100%) rename src/{ => auryn}/PopulationRateMonitor.cpp (100%) rename src/{ => auryn}/PopulationRateMonitor.h (100%) rename src/{ => auryn}/ProfilePoissonGroup.cpp (100%) rename src/{ => auryn}/ProfilePoissonGroup.h (100%) rename src/{ => auryn}/RateChecker.cpp (100%) rename src/{ => auryn}/RateChecker.h (100%) rename src/{ => auryn}/RateModulatedConnection.cpp (100%) rename src/{ => auryn}/RateModulatedConnection.h (100%) rename src/{ => auryn}/RateMonitor.cpp (100%) rename src/{ => auryn}/RateMonitor.h (100%) rename src/{ => auryn}/RealTimeMonitor.cpp (100%) rename src/{ => auryn}/RealTimeMonitor.h (100%) rename src/{ => auryn}/STDPConnection.cpp (100%) rename src/{ => auryn}/STDPConnection.h (100%) rename src/{ => auryn}/STDPwdConnection.cpp (100%) rename src/{ => auryn}/STDPwdConnection.h (100%) rename src/{ => auryn}/STPConnection.cpp (100%) rename src/{ => auryn}/STPConnection.h (100%) rename src/{ => auryn}/SimpleMatrix.cpp (100%) rename src/{ => auryn}/SimpleMatrix.h (100%) rename src/{ => auryn}/SparseConnection.cpp (100%) rename src/{ => auryn}/SparseConnection.h (100%) rename src/{ => auryn}/SpikeDelay.cpp (100%) rename src/{ => auryn}/SpikeDelay.h (100%) rename src/{ => auryn}/SpikeMonitor.cpp (100%) rename src/{ => auryn}/SpikeMonitor.h (100%) rename src/{ => auryn}/SpikeTimingStimGroup.cpp (100%) rename src/{ => auryn}/SpikeTimingStimGroup.h (100%) rename src/{ => auryn}/SpikingGroup.cpp (100%) rename src/{ => auryn}/SpikingGroup.h (100%) rename src/{ => auryn}/StateMonitor.cpp (100%) rename src/{ => auryn}/StateMonitor.h (100%) rename src/{ => auryn}/StimulusGroup.cpp (100%) rename src/{ => auryn}/StimulusGroup.h (100%) rename src/{ => auryn}/StructuredPoissonGroup.cpp (100%) rename src/{ => auryn}/StructuredPoissonGroup.h (100%) rename src/{ => auryn}/SymmetricSTDPConnection.cpp (100%) rename src/{ => auryn}/SymmetricSTDPConnection.h (100%) rename src/{ => auryn}/SyncBuffer.cpp (100%) rename src/{ => auryn}/SyncBuffer.h (100%) rename src/{ => auryn}/System.cpp (100%) rename src/{ => auryn}/System.h (100%) rename src/{ => auryn}/TIFGroup.cpp (100%) rename src/{ => auryn}/TIFGroup.h (100%) rename src/{ => auryn}/TripletConnection.cpp (100%) rename src/{ => auryn}/TripletConnection.h (100%) rename src/{ => auryn}/TripletDecayConnection.cpp (100%) rename src/{ => auryn}/TripletDecayConnection.h (100%) rename src/{ => auryn}/TripletScalingConnection.cpp (100%) rename src/{ => auryn}/TripletScalingConnection.h (100%) rename src/{ => auryn}/VoltageMonitor.cpp (100%) rename src/{ => auryn}/VoltageMonitor.h (100%) rename src/{ => auryn}/WeightChecker.cpp (100%) rename src/{ => auryn}/WeightChecker.h (100%) rename src/{ => auryn}/WeightMatrixMonitor.cpp (100%) rename src/{ => auryn}/WeightMatrixMonitor.h (100%) rename src/{ => auryn}/WeightMonitor.cpp (100%) rename src/{ => auryn}/WeightMonitor.h (100%) rename src/{ => auryn}/WeightPatternMonitor.cpp (100%) rename src/{ => auryn}/WeightPatternMonitor.h (100%) rename src/{ => auryn}/WeightStatsMonitor.cpp (100%) rename src/{ => auryn}/WeightStatsMonitor.h (100%) rename src/{ => auryn}/WeightSumMonitor.cpp (100%) rename src/{ => auryn}/WeightSumMonitor.h (100%) rename src/{ => auryn}/auryn_definitions.cpp (100%) rename src/{ => auryn}/auryn_definitions.h (100%) rename src/{ => auryn}/auryn_global.cpp (100%) rename src/{ => auryn}/auryn_global.h (100%) rename src/{ => auryn}/mk_version_info.sh (100%) diff --git a/examples/sim_bg_lowpass.cpp b/examples/sim_bg_lowpass.cpp index 32354a7a..f4e85d51 100644 --- a/examples/sim_bg_lowpass.cpp +++ b/examples/sim_bg_lowpass.cpp @@ -20,7 +20,6 @@ #include "auryn.h" -#include "LPTripletConnection.h" #define N_REC_WEIGHTS 5000 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0864f3cb..5fcbc60d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,21 @@ # Include all files in the src directory -FILE(GLOB auryn_SRC "*.h" "*.cpp" ) +FILE(GLOB auryn_SRC "*.h" "*.cpp" "auryn/*.cpp" "auryn/*.h" ) ADD_LIBRARY( auryn STATIC ${auryn_SRC} ) # Dependencies to external libraries TARGET_LINK_LIBRARIES( auryn ${MPI_CXX_LIBRARIES} ${Boost_LIBRARIES}) TARGET_INCLUDE_DIRECTORIES( auryn PUBLIC ${Boost_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH}) + +# Add dynamic library +ADD_LIBRARY( auryn_shared SHARED ${auryn_SRC} ) +SET_TARGET_PROPERTIES(auryn_shared PROPERTIES OUTPUT_NAME auryn) +TARGET_LINK_LIBRARIES( auryn_shared ${MPI_CXX_LIBRARIES} ${Boost_LIBRARIES}) +TARGET_INCLUDE_DIRECTORIES( auryn_shared PUBLIC ${Boost_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH}) + + +INSTALL(TARGETS auryn + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +INSTALL(TARGETS auryn_shared DESTINATION lib) +INSTALL(FILES auryn.h DESTINATION include) +INSTALL(DIRECTORY auryn DESTINATION include FILES_MATCHING PATTERN "*.h") diff --git a/src/auryn.h b/src/auryn.h index 4a0848f2..0070980a 100644 --- a/src/auryn.h +++ b/src/auryn.h @@ -37,87 +37,88 @@ #include // Core simulator definitions -#include "auryn_global.h" -#include "auryn_definitions.h" -#include "AurynVector.h" -#include "System.h" -#include "SyncBuffer.h" -#include "Logger.h" -#include "SpikeDelay.h" +#include "auryn/auryn_global.h" +#include "auryn/auryn_definitions.h" +#include "auryn/AurynVector.h" +#include "auryn/System.h" +#include "auryn/SyncBuffer.h" +#include "auryn/Logger.h" +#include "auryn/SpikeDelay.h" // Trace definitions -#include "LinearTrace.h" -#include "EulerTrace.h" +#include "auryn/LinearTrace.h" +#include "auryn/EulerTrace.h" // Connection definitions -#include "Connection.h" -#include "SparseConnection.h" -#include "RateModulatedConnection.h" -#include "STDPConnection.h" -#include "STDPwdConnection.h" -#include "SymmetricSTDPConnection.h" -#include "STPConnection.h" -#include "ABSConnection.h" -#include "DuplexConnection.h" -#include "TripletConnection.h" -#include "TripletDecayConnection.h" -#include "TripletScalingConnection.h" -#include "IdentityConnection.h" -#include "AllToAllConnection.h" +#include "auryn/Connection.h" +#include "auryn/SparseConnection.h" +#include "auryn/RateModulatedConnection.h" +#include "auryn/STDPConnection.h" +#include "auryn/STDPwdConnection.h" +#include "auryn/SymmetricSTDPConnection.h" +#include "auryn/STPConnection.h" +#include "auryn/ABSConnection.h" +#include "auryn/DuplexConnection.h" +#include "auryn/TripletConnection.h" +#include "auryn/LPTripletConnection.h" +#include "auryn/TripletDecayConnection.h" +#include "auryn/TripletScalingConnection.h" +#include "auryn/IdentityConnection.h" +#include "auryn/AllToAllConnection.h" // Spiking and input group definitions -#include "SpikingGroup.h" -#include "NeuronGroup.h" -#include "PoissonGroup.h" -#include "FileInputGroup.h" -#include "FileModulatedPoissonGroup.h" -#include "StimulusGroup.h" -#include "SpikeTimingStimGroup.h" -#include "ProfilePoissonGroup.h" -#include "StructuredPoissonGroup.h" -#include "CorrelatedPoissonGroup.h" -#include "MovingBumpGroup.h" -#include "AuditoryBeepGroup.h" +#include "auryn/SpikingGroup.h" +#include "auryn/NeuronGroup.h" +#include "auryn/PoissonGroup.h" +#include "auryn/FileInputGroup.h" +#include "auryn/FileModulatedPoissonGroup.h" +#include "auryn/StimulusGroup.h" +#include "auryn/SpikeTimingStimGroup.h" +#include "auryn/ProfilePoissonGroup.h" +#include "auryn/StructuredPoissonGroup.h" +#include "auryn/CorrelatedPoissonGroup.h" +#include "auryn/MovingBumpGroup.h" +#include "auryn/AuditoryBeepGroup.h" // NeuronGroups -#include "IFGroup.h" -#include "CubaIFGroup.h" -#include "TIFGroup.h" -#include "AIFGroup.h" -#include "AIF2Group.h" -#include "AdExGroup.h" -#include "IafPscDeltaGroup.h" -#include "IafPscExpGroup.h" -#include "IzhikevichGroup.h" +#include "auryn/IFGroup.h" +#include "auryn/CubaIFGroup.h" +#include "auryn/TIFGroup.h" +#include "auryn/AIFGroup.h" +#include "auryn/AIF2Group.h" +#include "auryn/AdExGroup.h" +#include "auryn/IafPscDeltaGroup.h" +#include "auryn/IafPscExpGroup.h" +#include "auryn/IzhikevichGroup.h" // Checker definitions -#include "Checker.h" -#include "RateChecker.h" -#include "WeightChecker.h" +#include "auryn/Checker.h" +#include "auryn/RateChecker.h" +#include "auryn/WeightChecker.h" // Monitor and stimulator definitions -#include "Device.h" -#include "Monitor.h" -#include "VoltageMonitor.h" -#include "SpikeMonitor.h" -#include "BinarySpikeMonitor.h" -#include "BinaryStateMonitor.h" -#include "DelayedSpikeMonitor.h" -#include "RealTimeMonitor.h" -#include "RateMonitor.h" -#include "PopulationRateMonitor.h" -#include "StateMonitor.h" -#include "WeightSumMonitor.h" -#include "PatternMonitor.h" -#include "WeightPatternMonitor.h" -#include "WeightStatsMonitor.h" -#include "WeightMonitor.h" -#include "WeightMatrixMonitor.h" -#include "PoissonStimulator.h" -#include "NormalStimulator.h" -#include "PatternStimulator.h" -#include "CurrentInjector.h" +#include "auryn/Device.h" +#include "auryn/Monitor.h" +#include "auryn/VoltageMonitor.h" +#include "auryn/SpikeMonitor.h" +#include "auryn/BinarySpikeMonitor.h" +#include "auryn/BinaryStateMonitor.h" +#include "auryn/DelayedSpikeMonitor.h" +#include "auryn/RealTimeMonitor.h" +#include "auryn/RateMonitor.h" +#include "auryn/PopulationRateMonitor.h" +#include "auryn/StateMonitor.h" +#include "auryn/WeightSumMonitor.h" +#include "auryn/PatternMonitor.h" +#include "auryn/WeightPatternMonitor.h" +#include "auryn/WeightStatsMonitor.h" +#include "auryn/WeightMonitor.h" +#include "auryn/WeightMatrixMonitor.h" +#include "auryn/PoissonStimulator.h" +#include "auryn/NormalStimulator.h" +#include "auryn/PatternStimulator.h" +#include "auryn/CurrentInjector.h" #endif /*AURYN_H__*/ diff --git a/src/ABSConnection.cpp b/src/auryn/ABSConnection.cpp similarity index 100% rename from src/ABSConnection.cpp rename to src/auryn/ABSConnection.cpp diff --git a/src/ABSConnection.h b/src/auryn/ABSConnection.h similarity index 100% rename from src/ABSConnection.h rename to src/auryn/ABSConnection.h diff --git a/src/AIF2Group.cpp b/src/auryn/AIF2Group.cpp similarity index 100% rename from src/AIF2Group.cpp rename to src/auryn/AIF2Group.cpp diff --git a/src/AIF2Group.h b/src/auryn/AIF2Group.h similarity index 100% rename from src/AIF2Group.h rename to src/auryn/AIF2Group.h diff --git a/src/AIFGroup.cpp b/src/auryn/AIFGroup.cpp similarity index 100% rename from src/AIFGroup.cpp rename to src/auryn/AIFGroup.cpp diff --git a/src/AIFGroup.h b/src/auryn/AIFGroup.h similarity index 100% rename from src/AIFGroup.h rename to src/auryn/AIFGroup.h diff --git a/src/AdExGroup.cpp b/src/auryn/AdExGroup.cpp similarity index 100% rename from src/AdExGroup.cpp rename to src/auryn/AdExGroup.cpp diff --git a/src/AdExGroup.h b/src/auryn/AdExGroup.h similarity index 100% rename from src/AdExGroup.h rename to src/auryn/AdExGroup.h diff --git a/src/AllToAllConnection.cpp b/src/auryn/AllToAllConnection.cpp similarity index 100% rename from src/AllToAllConnection.cpp rename to src/auryn/AllToAllConnection.cpp diff --git a/src/AllToAllConnection.h b/src/auryn/AllToAllConnection.h similarity index 100% rename from src/AllToAllConnection.h rename to src/auryn/AllToAllConnection.h diff --git a/src/AuditoryBeepGroup.cpp b/src/auryn/AuditoryBeepGroup.cpp similarity index 100% rename from src/AuditoryBeepGroup.cpp rename to src/auryn/AuditoryBeepGroup.cpp diff --git a/src/AuditoryBeepGroup.h b/src/auryn/AuditoryBeepGroup.h similarity index 100% rename from src/AuditoryBeepGroup.h rename to src/auryn/AuditoryBeepGroup.h diff --git a/src/AurynVector.cpp b/src/auryn/AurynVector.cpp similarity index 100% rename from src/AurynVector.cpp rename to src/auryn/AurynVector.cpp diff --git a/src/AurynVector.h b/src/auryn/AurynVector.h similarity index 100% rename from src/AurynVector.h rename to src/auryn/AurynVector.h diff --git a/src/AurynVersion.cpp b/src/auryn/AurynVersion.cpp similarity index 100% rename from src/AurynVersion.cpp rename to src/auryn/AurynVersion.cpp diff --git a/src/AurynVersion.h b/src/auryn/AurynVersion.h similarity index 100% rename from src/AurynVersion.h rename to src/auryn/AurynVersion.h diff --git a/src/BinarySpikeMonitor.cpp b/src/auryn/BinarySpikeMonitor.cpp similarity index 100% rename from src/BinarySpikeMonitor.cpp rename to src/auryn/BinarySpikeMonitor.cpp diff --git a/src/BinarySpikeMonitor.h b/src/auryn/BinarySpikeMonitor.h similarity index 100% rename from src/BinarySpikeMonitor.h rename to src/auryn/BinarySpikeMonitor.h diff --git a/src/BinaryStateMonitor.cpp b/src/auryn/BinaryStateMonitor.cpp similarity index 100% rename from src/BinaryStateMonitor.cpp rename to src/auryn/BinaryStateMonitor.cpp diff --git a/src/BinaryStateMonitor.h b/src/auryn/BinaryStateMonitor.h similarity index 100% rename from src/BinaryStateMonitor.h rename to src/auryn/BinaryStateMonitor.h diff --git a/src/Checker.cpp b/src/auryn/Checker.cpp similarity index 100% rename from src/Checker.cpp rename to src/auryn/Checker.cpp diff --git a/src/Checker.h b/src/auryn/Checker.h similarity index 100% rename from src/Checker.h rename to src/auryn/Checker.h diff --git a/src/ComplexMatrix.cpp b/src/auryn/ComplexMatrix.cpp similarity index 100% rename from src/ComplexMatrix.cpp rename to src/auryn/ComplexMatrix.cpp diff --git a/src/ComplexMatrix.h b/src/auryn/ComplexMatrix.h similarity index 100% rename from src/ComplexMatrix.h rename to src/auryn/ComplexMatrix.h diff --git a/src/Connection.cpp b/src/auryn/Connection.cpp similarity index 100% rename from src/Connection.cpp rename to src/auryn/Connection.cpp diff --git a/src/Connection.h b/src/auryn/Connection.h similarity index 100% rename from src/Connection.h rename to src/auryn/Connection.h diff --git a/src/CorrelatedPoissonGroup.cpp b/src/auryn/CorrelatedPoissonGroup.cpp similarity index 100% rename from src/CorrelatedPoissonGroup.cpp rename to src/auryn/CorrelatedPoissonGroup.cpp diff --git a/src/CorrelatedPoissonGroup.h b/src/auryn/CorrelatedPoissonGroup.h similarity index 100% rename from src/CorrelatedPoissonGroup.h rename to src/auryn/CorrelatedPoissonGroup.h diff --git a/src/CubaIFGroup.cpp b/src/auryn/CubaIFGroup.cpp similarity index 100% rename from src/CubaIFGroup.cpp rename to src/auryn/CubaIFGroup.cpp diff --git a/src/CubaIFGroup.h b/src/auryn/CubaIFGroup.h similarity index 100% rename from src/CubaIFGroup.h rename to src/auryn/CubaIFGroup.h diff --git a/src/CurrentInjector.cpp b/src/auryn/CurrentInjector.cpp similarity index 100% rename from src/CurrentInjector.cpp rename to src/auryn/CurrentInjector.cpp diff --git a/src/CurrentInjector.h b/src/auryn/CurrentInjector.h similarity index 100% rename from src/CurrentInjector.h rename to src/auryn/CurrentInjector.h diff --git a/src/DelayedSpikeMonitor.cpp b/src/auryn/DelayedSpikeMonitor.cpp similarity index 100% rename from src/DelayedSpikeMonitor.cpp rename to src/auryn/DelayedSpikeMonitor.cpp diff --git a/src/DelayedSpikeMonitor.h b/src/auryn/DelayedSpikeMonitor.h similarity index 100% rename from src/DelayedSpikeMonitor.h rename to src/auryn/DelayedSpikeMonitor.h diff --git a/src/Device.cpp b/src/auryn/Device.cpp similarity index 100% rename from src/Device.cpp rename to src/auryn/Device.cpp diff --git a/src/Device.h b/src/auryn/Device.h similarity index 100% rename from src/Device.h rename to src/auryn/Device.h diff --git a/src/DuplexConnection.cpp b/src/auryn/DuplexConnection.cpp similarity index 100% rename from src/DuplexConnection.cpp rename to src/auryn/DuplexConnection.cpp diff --git a/src/DuplexConnection.h b/src/auryn/DuplexConnection.h similarity index 100% rename from src/DuplexConnection.h rename to src/auryn/DuplexConnection.h diff --git a/src/EulerTrace.cpp b/src/auryn/EulerTrace.cpp similarity index 100% rename from src/EulerTrace.cpp rename to src/auryn/EulerTrace.cpp diff --git a/src/EulerTrace.h b/src/auryn/EulerTrace.h similarity index 100% rename from src/EulerTrace.h rename to src/auryn/EulerTrace.h diff --git a/src/FileInputGroup.cpp b/src/auryn/FileInputGroup.cpp similarity index 100% rename from src/FileInputGroup.cpp rename to src/auryn/FileInputGroup.cpp diff --git a/src/FileInputGroup.h b/src/auryn/FileInputGroup.h similarity index 100% rename from src/FileInputGroup.h rename to src/auryn/FileInputGroup.h diff --git a/src/FileModulatedPoissonGroup.cpp b/src/auryn/FileModulatedPoissonGroup.cpp similarity index 100% rename from src/FileModulatedPoissonGroup.cpp rename to src/auryn/FileModulatedPoissonGroup.cpp diff --git a/src/FileModulatedPoissonGroup.h b/src/auryn/FileModulatedPoissonGroup.h similarity index 100% rename from src/FileModulatedPoissonGroup.h rename to src/auryn/FileModulatedPoissonGroup.h diff --git a/src/IFGroup.cpp b/src/auryn/IFGroup.cpp similarity index 100% rename from src/IFGroup.cpp rename to src/auryn/IFGroup.cpp diff --git a/src/IFGroup.h b/src/auryn/IFGroup.h similarity index 100% rename from src/IFGroup.h rename to src/auryn/IFGroup.h diff --git a/src/IafPscDeltaGroup.cpp b/src/auryn/IafPscDeltaGroup.cpp similarity index 100% rename from src/IafPscDeltaGroup.cpp rename to src/auryn/IafPscDeltaGroup.cpp diff --git a/src/IafPscDeltaGroup.h b/src/auryn/IafPscDeltaGroup.h similarity index 100% rename from src/IafPscDeltaGroup.h rename to src/auryn/IafPscDeltaGroup.h diff --git a/src/IafPscExpGroup.cpp b/src/auryn/IafPscExpGroup.cpp similarity index 100% rename from src/IafPscExpGroup.cpp rename to src/auryn/IafPscExpGroup.cpp diff --git a/src/IafPscExpGroup.h b/src/auryn/IafPscExpGroup.h similarity index 100% rename from src/IafPscExpGroup.h rename to src/auryn/IafPscExpGroup.h diff --git a/src/IdentityConnection.cpp b/src/auryn/IdentityConnection.cpp similarity index 100% rename from src/IdentityConnection.cpp rename to src/auryn/IdentityConnection.cpp diff --git a/src/IdentityConnection.h b/src/auryn/IdentityConnection.h similarity index 100% rename from src/IdentityConnection.h rename to src/auryn/IdentityConnection.h diff --git a/src/IzhikevichGroup.cpp b/src/auryn/IzhikevichGroup.cpp similarity index 100% rename from src/IzhikevichGroup.cpp rename to src/auryn/IzhikevichGroup.cpp diff --git a/src/IzhikevichGroup.h b/src/auryn/IzhikevichGroup.h similarity index 100% rename from src/IzhikevichGroup.h rename to src/auryn/IzhikevichGroup.h diff --git a/src/LPTripletConnection.cpp b/src/auryn/LPTripletConnection.cpp similarity index 100% rename from src/LPTripletConnection.cpp rename to src/auryn/LPTripletConnection.cpp diff --git a/src/LPTripletConnection.h b/src/auryn/LPTripletConnection.h similarity index 100% rename from src/LPTripletConnection.h rename to src/auryn/LPTripletConnection.h diff --git a/src/LinearTrace.cpp b/src/auryn/LinearTrace.cpp similarity index 100% rename from src/LinearTrace.cpp rename to src/auryn/LinearTrace.cpp diff --git a/src/LinearTrace.h b/src/auryn/LinearTrace.h similarity index 100% rename from src/LinearTrace.h rename to src/auryn/LinearTrace.h diff --git a/src/Logger.cpp b/src/auryn/Logger.cpp similarity index 100% rename from src/Logger.cpp rename to src/auryn/Logger.cpp diff --git a/src/Logger.h b/src/auryn/Logger.h similarity index 100% rename from src/Logger.h rename to src/auryn/Logger.h diff --git a/src/Monitor.cpp b/src/auryn/Monitor.cpp similarity index 100% rename from src/Monitor.cpp rename to src/auryn/Monitor.cpp diff --git a/src/Monitor.h b/src/auryn/Monitor.h similarity index 100% rename from src/Monitor.h rename to src/auryn/Monitor.h diff --git a/src/MovingBumpGroup.cpp b/src/auryn/MovingBumpGroup.cpp similarity index 100% rename from src/MovingBumpGroup.cpp rename to src/auryn/MovingBumpGroup.cpp diff --git a/src/MovingBumpGroup.h b/src/auryn/MovingBumpGroup.h similarity index 100% rename from src/MovingBumpGroup.h rename to src/auryn/MovingBumpGroup.h diff --git a/src/NeuronGroup.cpp b/src/auryn/NeuronGroup.cpp similarity index 100% rename from src/NeuronGroup.cpp rename to src/auryn/NeuronGroup.cpp diff --git a/src/NeuronGroup.h b/src/auryn/NeuronGroup.h similarity index 100% rename from src/NeuronGroup.h rename to src/auryn/NeuronGroup.h diff --git a/src/NormalStimulator.cpp b/src/auryn/NormalStimulator.cpp similarity index 100% rename from src/NormalStimulator.cpp rename to src/auryn/NormalStimulator.cpp diff --git a/src/NormalStimulator.h b/src/auryn/NormalStimulator.h similarity index 100% rename from src/NormalStimulator.h rename to src/auryn/NormalStimulator.h diff --git a/src/PairInteractionConnection.cpp b/src/auryn/PairInteractionConnection.cpp similarity index 100% rename from src/PairInteractionConnection.cpp rename to src/auryn/PairInteractionConnection.cpp diff --git a/src/PairInteractionConnection.h b/src/auryn/PairInteractionConnection.h similarity index 100% rename from src/PairInteractionConnection.h rename to src/auryn/PairInteractionConnection.h diff --git a/src/PatternMonitor.cpp b/src/auryn/PatternMonitor.cpp similarity index 100% rename from src/PatternMonitor.cpp rename to src/auryn/PatternMonitor.cpp diff --git a/src/PatternMonitor.h b/src/auryn/PatternMonitor.h similarity index 100% rename from src/PatternMonitor.h rename to src/auryn/PatternMonitor.h diff --git a/src/PatternStimulator.cpp b/src/auryn/PatternStimulator.cpp similarity index 100% rename from src/PatternStimulator.cpp rename to src/auryn/PatternStimulator.cpp diff --git a/src/PatternStimulator.h b/src/auryn/PatternStimulator.h similarity index 100% rename from src/PatternStimulator.h rename to src/auryn/PatternStimulator.h diff --git a/src/PoissonGroup.cpp b/src/auryn/PoissonGroup.cpp similarity index 100% rename from src/PoissonGroup.cpp rename to src/auryn/PoissonGroup.cpp diff --git a/src/PoissonGroup.h b/src/auryn/PoissonGroup.h similarity index 100% rename from src/PoissonGroup.h rename to src/auryn/PoissonGroup.h diff --git a/src/PoissonStimulator.cpp b/src/auryn/PoissonStimulator.cpp similarity index 100% rename from src/PoissonStimulator.cpp rename to src/auryn/PoissonStimulator.cpp diff --git a/src/PoissonStimulator.h b/src/auryn/PoissonStimulator.h similarity index 100% rename from src/PoissonStimulator.h rename to src/auryn/PoissonStimulator.h diff --git a/src/PopulationRateMonitor.cpp b/src/auryn/PopulationRateMonitor.cpp similarity index 100% rename from src/PopulationRateMonitor.cpp rename to src/auryn/PopulationRateMonitor.cpp diff --git a/src/PopulationRateMonitor.h b/src/auryn/PopulationRateMonitor.h similarity index 100% rename from src/PopulationRateMonitor.h rename to src/auryn/PopulationRateMonitor.h diff --git a/src/ProfilePoissonGroup.cpp b/src/auryn/ProfilePoissonGroup.cpp similarity index 100% rename from src/ProfilePoissonGroup.cpp rename to src/auryn/ProfilePoissonGroup.cpp diff --git a/src/ProfilePoissonGroup.h b/src/auryn/ProfilePoissonGroup.h similarity index 100% rename from src/ProfilePoissonGroup.h rename to src/auryn/ProfilePoissonGroup.h diff --git a/src/RateChecker.cpp b/src/auryn/RateChecker.cpp similarity index 100% rename from src/RateChecker.cpp rename to src/auryn/RateChecker.cpp diff --git a/src/RateChecker.h b/src/auryn/RateChecker.h similarity index 100% rename from src/RateChecker.h rename to src/auryn/RateChecker.h diff --git a/src/RateModulatedConnection.cpp b/src/auryn/RateModulatedConnection.cpp similarity index 100% rename from src/RateModulatedConnection.cpp rename to src/auryn/RateModulatedConnection.cpp diff --git a/src/RateModulatedConnection.h b/src/auryn/RateModulatedConnection.h similarity index 100% rename from src/RateModulatedConnection.h rename to src/auryn/RateModulatedConnection.h diff --git a/src/RateMonitor.cpp b/src/auryn/RateMonitor.cpp similarity index 100% rename from src/RateMonitor.cpp rename to src/auryn/RateMonitor.cpp diff --git a/src/RateMonitor.h b/src/auryn/RateMonitor.h similarity index 100% rename from src/RateMonitor.h rename to src/auryn/RateMonitor.h diff --git a/src/RealTimeMonitor.cpp b/src/auryn/RealTimeMonitor.cpp similarity index 100% rename from src/RealTimeMonitor.cpp rename to src/auryn/RealTimeMonitor.cpp diff --git a/src/RealTimeMonitor.h b/src/auryn/RealTimeMonitor.h similarity index 100% rename from src/RealTimeMonitor.h rename to src/auryn/RealTimeMonitor.h diff --git a/src/STDPConnection.cpp b/src/auryn/STDPConnection.cpp similarity index 100% rename from src/STDPConnection.cpp rename to src/auryn/STDPConnection.cpp diff --git a/src/STDPConnection.h b/src/auryn/STDPConnection.h similarity index 100% rename from src/STDPConnection.h rename to src/auryn/STDPConnection.h diff --git a/src/STDPwdConnection.cpp b/src/auryn/STDPwdConnection.cpp similarity index 100% rename from src/STDPwdConnection.cpp rename to src/auryn/STDPwdConnection.cpp diff --git a/src/STDPwdConnection.h b/src/auryn/STDPwdConnection.h similarity index 100% rename from src/STDPwdConnection.h rename to src/auryn/STDPwdConnection.h diff --git a/src/STPConnection.cpp b/src/auryn/STPConnection.cpp similarity index 100% rename from src/STPConnection.cpp rename to src/auryn/STPConnection.cpp diff --git a/src/STPConnection.h b/src/auryn/STPConnection.h similarity index 100% rename from src/STPConnection.h rename to src/auryn/STPConnection.h diff --git a/src/SimpleMatrix.cpp b/src/auryn/SimpleMatrix.cpp similarity index 100% rename from src/SimpleMatrix.cpp rename to src/auryn/SimpleMatrix.cpp diff --git a/src/SimpleMatrix.h b/src/auryn/SimpleMatrix.h similarity index 100% rename from src/SimpleMatrix.h rename to src/auryn/SimpleMatrix.h diff --git a/src/SparseConnection.cpp b/src/auryn/SparseConnection.cpp similarity index 100% rename from src/SparseConnection.cpp rename to src/auryn/SparseConnection.cpp diff --git a/src/SparseConnection.h b/src/auryn/SparseConnection.h similarity index 100% rename from src/SparseConnection.h rename to src/auryn/SparseConnection.h diff --git a/src/SpikeDelay.cpp b/src/auryn/SpikeDelay.cpp similarity index 100% rename from src/SpikeDelay.cpp rename to src/auryn/SpikeDelay.cpp diff --git a/src/SpikeDelay.h b/src/auryn/SpikeDelay.h similarity index 100% rename from src/SpikeDelay.h rename to src/auryn/SpikeDelay.h diff --git a/src/SpikeMonitor.cpp b/src/auryn/SpikeMonitor.cpp similarity index 100% rename from src/SpikeMonitor.cpp rename to src/auryn/SpikeMonitor.cpp diff --git a/src/SpikeMonitor.h b/src/auryn/SpikeMonitor.h similarity index 100% rename from src/SpikeMonitor.h rename to src/auryn/SpikeMonitor.h diff --git a/src/SpikeTimingStimGroup.cpp b/src/auryn/SpikeTimingStimGroup.cpp similarity index 100% rename from src/SpikeTimingStimGroup.cpp rename to src/auryn/SpikeTimingStimGroup.cpp diff --git a/src/SpikeTimingStimGroup.h b/src/auryn/SpikeTimingStimGroup.h similarity index 100% rename from src/SpikeTimingStimGroup.h rename to src/auryn/SpikeTimingStimGroup.h diff --git a/src/SpikingGroup.cpp b/src/auryn/SpikingGroup.cpp similarity index 100% rename from src/SpikingGroup.cpp rename to src/auryn/SpikingGroup.cpp diff --git a/src/SpikingGroup.h b/src/auryn/SpikingGroup.h similarity index 100% rename from src/SpikingGroup.h rename to src/auryn/SpikingGroup.h diff --git a/src/StateMonitor.cpp b/src/auryn/StateMonitor.cpp similarity index 100% rename from src/StateMonitor.cpp rename to src/auryn/StateMonitor.cpp diff --git a/src/StateMonitor.h b/src/auryn/StateMonitor.h similarity index 100% rename from src/StateMonitor.h rename to src/auryn/StateMonitor.h diff --git a/src/StimulusGroup.cpp b/src/auryn/StimulusGroup.cpp similarity index 100% rename from src/StimulusGroup.cpp rename to src/auryn/StimulusGroup.cpp diff --git a/src/StimulusGroup.h b/src/auryn/StimulusGroup.h similarity index 100% rename from src/StimulusGroup.h rename to src/auryn/StimulusGroup.h diff --git a/src/StructuredPoissonGroup.cpp b/src/auryn/StructuredPoissonGroup.cpp similarity index 100% rename from src/StructuredPoissonGroup.cpp rename to src/auryn/StructuredPoissonGroup.cpp diff --git a/src/StructuredPoissonGroup.h b/src/auryn/StructuredPoissonGroup.h similarity index 100% rename from src/StructuredPoissonGroup.h rename to src/auryn/StructuredPoissonGroup.h diff --git a/src/SymmetricSTDPConnection.cpp b/src/auryn/SymmetricSTDPConnection.cpp similarity index 100% rename from src/SymmetricSTDPConnection.cpp rename to src/auryn/SymmetricSTDPConnection.cpp diff --git a/src/SymmetricSTDPConnection.h b/src/auryn/SymmetricSTDPConnection.h similarity index 100% rename from src/SymmetricSTDPConnection.h rename to src/auryn/SymmetricSTDPConnection.h diff --git a/src/SyncBuffer.cpp b/src/auryn/SyncBuffer.cpp similarity index 100% rename from src/SyncBuffer.cpp rename to src/auryn/SyncBuffer.cpp diff --git a/src/SyncBuffer.h b/src/auryn/SyncBuffer.h similarity index 100% rename from src/SyncBuffer.h rename to src/auryn/SyncBuffer.h diff --git a/src/System.cpp b/src/auryn/System.cpp similarity index 100% rename from src/System.cpp rename to src/auryn/System.cpp diff --git a/src/System.h b/src/auryn/System.h similarity index 100% rename from src/System.h rename to src/auryn/System.h diff --git a/src/TIFGroup.cpp b/src/auryn/TIFGroup.cpp similarity index 100% rename from src/TIFGroup.cpp rename to src/auryn/TIFGroup.cpp diff --git a/src/TIFGroup.h b/src/auryn/TIFGroup.h similarity index 100% rename from src/TIFGroup.h rename to src/auryn/TIFGroup.h diff --git a/src/TripletConnection.cpp b/src/auryn/TripletConnection.cpp similarity index 100% rename from src/TripletConnection.cpp rename to src/auryn/TripletConnection.cpp diff --git a/src/TripletConnection.h b/src/auryn/TripletConnection.h similarity index 100% rename from src/TripletConnection.h rename to src/auryn/TripletConnection.h diff --git a/src/TripletDecayConnection.cpp b/src/auryn/TripletDecayConnection.cpp similarity index 100% rename from src/TripletDecayConnection.cpp rename to src/auryn/TripletDecayConnection.cpp diff --git a/src/TripletDecayConnection.h b/src/auryn/TripletDecayConnection.h similarity index 100% rename from src/TripletDecayConnection.h rename to src/auryn/TripletDecayConnection.h diff --git a/src/TripletScalingConnection.cpp b/src/auryn/TripletScalingConnection.cpp similarity index 100% rename from src/TripletScalingConnection.cpp rename to src/auryn/TripletScalingConnection.cpp diff --git a/src/TripletScalingConnection.h b/src/auryn/TripletScalingConnection.h similarity index 100% rename from src/TripletScalingConnection.h rename to src/auryn/TripletScalingConnection.h diff --git a/src/VoltageMonitor.cpp b/src/auryn/VoltageMonitor.cpp similarity index 100% rename from src/VoltageMonitor.cpp rename to src/auryn/VoltageMonitor.cpp diff --git a/src/VoltageMonitor.h b/src/auryn/VoltageMonitor.h similarity index 100% rename from src/VoltageMonitor.h rename to src/auryn/VoltageMonitor.h diff --git a/src/WeightChecker.cpp b/src/auryn/WeightChecker.cpp similarity index 100% rename from src/WeightChecker.cpp rename to src/auryn/WeightChecker.cpp diff --git a/src/WeightChecker.h b/src/auryn/WeightChecker.h similarity index 100% rename from src/WeightChecker.h rename to src/auryn/WeightChecker.h diff --git a/src/WeightMatrixMonitor.cpp b/src/auryn/WeightMatrixMonitor.cpp similarity index 100% rename from src/WeightMatrixMonitor.cpp rename to src/auryn/WeightMatrixMonitor.cpp diff --git a/src/WeightMatrixMonitor.h b/src/auryn/WeightMatrixMonitor.h similarity index 100% rename from src/WeightMatrixMonitor.h rename to src/auryn/WeightMatrixMonitor.h diff --git a/src/WeightMonitor.cpp b/src/auryn/WeightMonitor.cpp similarity index 100% rename from src/WeightMonitor.cpp rename to src/auryn/WeightMonitor.cpp diff --git a/src/WeightMonitor.h b/src/auryn/WeightMonitor.h similarity index 100% rename from src/WeightMonitor.h rename to src/auryn/WeightMonitor.h diff --git a/src/WeightPatternMonitor.cpp b/src/auryn/WeightPatternMonitor.cpp similarity index 100% rename from src/WeightPatternMonitor.cpp rename to src/auryn/WeightPatternMonitor.cpp diff --git a/src/WeightPatternMonitor.h b/src/auryn/WeightPatternMonitor.h similarity index 100% rename from src/WeightPatternMonitor.h rename to src/auryn/WeightPatternMonitor.h diff --git a/src/WeightStatsMonitor.cpp b/src/auryn/WeightStatsMonitor.cpp similarity index 100% rename from src/WeightStatsMonitor.cpp rename to src/auryn/WeightStatsMonitor.cpp diff --git a/src/WeightStatsMonitor.h b/src/auryn/WeightStatsMonitor.h similarity index 100% rename from src/WeightStatsMonitor.h rename to src/auryn/WeightStatsMonitor.h diff --git a/src/WeightSumMonitor.cpp b/src/auryn/WeightSumMonitor.cpp similarity index 100% rename from src/WeightSumMonitor.cpp rename to src/auryn/WeightSumMonitor.cpp diff --git a/src/WeightSumMonitor.h b/src/auryn/WeightSumMonitor.h similarity index 100% rename from src/WeightSumMonitor.h rename to src/auryn/WeightSumMonitor.h diff --git a/src/auryn_definitions.cpp b/src/auryn/auryn_definitions.cpp similarity index 100% rename from src/auryn_definitions.cpp rename to src/auryn/auryn_definitions.cpp diff --git a/src/auryn_definitions.h b/src/auryn/auryn_definitions.h similarity index 100% rename from src/auryn_definitions.h rename to src/auryn/auryn_definitions.h diff --git a/src/auryn_global.cpp b/src/auryn/auryn_global.cpp similarity index 100% rename from src/auryn_global.cpp rename to src/auryn/auryn_global.cpp diff --git a/src/auryn_global.h b/src/auryn/auryn_global.h similarity index 100% rename from src/auryn_global.h rename to src/auryn/auryn_global.h diff --git a/src/mk_version_info.sh b/src/auryn/mk_version_info.sh similarity index 100% rename from src/mk_version_info.sh rename to src/auryn/mk_version_info.sh diff --git a/test/src/test_AurynStateVector.cpp b/test/src/test_AurynStateVector.cpp index 356d85ea..e5baba54 100644 --- a/test/src/test_AurynStateVector.cpp +++ b/test/src/test_AurynStateVector.cpp @@ -1,7 +1,7 @@ #define BOOST_TEST_MODULE AurynStateVector test #include -#include "../../src/AurynVector.h" -#include "../../src/auryn_definitions.h" +#include "auryn/AurynVector.h" +#include "auryn/auryn_definitions.h" int expected_size( int n ) { diff --git a/test/src/test_AurynVector.cpp b/test/src/test_AurynVector.cpp index f3ef6e9e..74127ad7 100644 --- a/test/src/test_AurynVector.cpp +++ b/test/src/test_AurynVector.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE AurynVector test #include -#include "../../src/AurynVector.h" +#include "auryn/AurynVector.h" BOOST_AUTO_TEST_CASE( resizing ) { diff --git a/test/src/test_ComplexMatrix.cpp b/test/src/test_ComplexMatrix.cpp index 22c96c7b..1127f6c3 100644 --- a/test/src/test_ComplexMatrix.cpp +++ b/test/src/test_ComplexMatrix.cpp @@ -1,7 +1,7 @@ #define BOOST_TEST_MODULE ComplexMatrix test #include #include -#include "ComplexMatrix.cpp" +#include "auryn/ComplexMatrix.cpp" // using namespace auryn; diff --git a/tools/aube.cpp b/tools/aube.cpp index 48a9e5ca..54e1341b 100644 --- a/tools/aube.cpp +++ b/tools/aube.cpp @@ -23,7 +23,7 @@ #include #include #include -#include "AurynVersion.h" +#include "auryn/AurynVersion.h" using namespace auryn; diff --git a/tools/aubs.cpp b/tools/aubs.cpp index b067043b..5da8bea5 100644 --- a/tools/aubs.cpp +++ b/tools/aubs.cpp @@ -23,7 +23,7 @@ #include #include #include -#include "AurynVersion.h" +#include "auryn/AurynVersion.h" using namespace auryn; From dd1b897b204b49a05bea2ebc901e275e66302f92 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Mon, 15 Aug 2016 10:55:37 -0700 Subject: [PATCH 27/77] Adds quick install instructions --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 052adc53..59ac2629 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,15 @@ git clone https://github.com/fzenke/auryn.git && cd auryn/build/release ./bootstrap.sh && make ``` +Then to install the library: +``` +sudo make install +``` +which will put it under `/usr/local/` or for a local install +``` +make DESTDIR=./your/dir/ install +``` + Documentation & Installation/Use -------------------------------- From f0a25247ce1db917814e238c33cd326e835adb31 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Tue, 16 Aug 2016 12:28:48 -0700 Subject: [PATCH 28/77] Adds zero_effective_zeros function to AurynVector --- src/auryn/AurynVector.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/auryn/AurynVector.h b/src/auryn/AurynVector.h index 8b3f0e44..9ffe4590 100644 --- a/src/auryn/AurynVector.h +++ b/src/auryn/AurynVector.h @@ -561,6 +561,16 @@ namespace auryn { return sum; } + /*! \brief Sets all values whose absolute value is smaller than epsilon to zero. + * + */ + void zero_effective_zeros( const T epsilon = 1e-3) + { + for ( IndexType i = 0 ; i < size ; ++i ) { + if ( std::abs(get(i)) < epsilon ) set(i, 0.0); + } + } + void set_random_normal(AurynState mean=0.0, AurynState sigma=1.0, unsigned int seed=8721) { if ( seed == 0 ) From 7d0a6fcc4e590e9d927de4b941bec19957f5fa1f Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Tue, 16 Aug 2016 12:29:25 -0700 Subject: [PATCH 29/77] Adds get_delay function to SpikeDelay --- src/auryn/SpikeDelay.cpp | 5 +++++ src/auryn/SpikeDelay.h | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/auryn/SpikeDelay.cpp b/src/auryn/SpikeDelay.cpp index c47e3884..06b4f794 100644 --- a/src/auryn/SpikeDelay.cpp +++ b/src/auryn/SpikeDelay.cpp @@ -54,6 +54,11 @@ void SpikeDelay::set_delay( int delay ) } } +int SpikeDelay::get_delay( ) +{ + return ndelay; +} + void SpikeDelay::free() { for (int i = 0 ; i < ndelay ; ++i) { diff --git a/src/auryn/SpikeDelay.h b/src/auryn/SpikeDelay.h index 51efe941..389e1707 100644 --- a/src/auryn/SpikeDelay.h +++ b/src/auryn/SpikeDelay.h @@ -85,7 +85,12 @@ class SpikeDelay * * This allows to set the size of the delay in timesteps. The delay has to be at least of * size MINDELAY+1. */ - void set_delay( int delay); + void set_delay( int delay ); + + /*! \brief Get delay time in AurynTime + * + */ + int get_delay( ); /*! \brief Internal function to set clock pointer * From 039e490a30e26b44f99ef924913093513bb42fdc Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Tue, 16 Aug 2016 16:21:27 -0700 Subject: [PATCH 30/77] Adds AurynDelayVector --- src/auryn.h | 1 + src/auryn/AurynDelayVector.cpp | 74 +++++++++++++++++++++++++++ src/auryn/AurynDelayVector.h | 82 ++++++++++++++++++++++++++++++ test/run_unit_tests.sh | 1 + test/src/test_AurynDelayVector.cpp | 37 ++++++++++++++ 5 files changed, 195 insertions(+) create mode 100644 src/auryn/AurynDelayVector.cpp create mode 100644 src/auryn/AurynDelayVector.h create mode 100644 test/src/test_AurynDelayVector.cpp diff --git a/src/auryn.h b/src/auryn.h index 0070980a..e0840b60 100644 --- a/src/auryn.h +++ b/src/auryn.h @@ -40,6 +40,7 @@ #include "auryn/auryn_global.h" #include "auryn/auryn_definitions.h" #include "auryn/AurynVector.h" +#include "auryn/AurynDelayVector.h" #include "auryn/System.h" #include "auryn/SyncBuffer.h" #include "auryn/Logger.h" diff --git a/src/auryn/AurynDelayVector.cpp b/src/auryn/AurynDelayVector.cpp new file mode 100644 index 00000000..51e51e62 --- /dev/null +++ b/src/auryn/AurynDelayVector.cpp @@ -0,0 +1,74 @@ +/* +* Copyright 2014-2016 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. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Auryn. If not, see . +* +* If you are using Auryn or parts of it for your work please cite: +* Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations +* of spiking neural networks using general-purpose computers. +* Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 +*/ + +#include "AurynDelayVector.h" + +using namespace auryn; + + +AurynDelayVector::AurynDelayVector( NeuronID n, unsigned int delay_buffer_size ) : AurynVectorFloat(n) +{ + memory_pos_ = 0; + delay_buffer_size_ = delay_buffer_size; + for ( unsigned int i = 0 ; i < delay_buffer_size_ ; ++i ) { + AurynVectorFloat * vec = new AurynVectorFloat(size); + memory.push_back(vec); + } +} + +AurynDelayVector::~AurynDelayVector( ) +{ + for ( unsigned int i = 0 ; i < delay_buffer_size_ ; ++i ) { + delete memory[i]; + } +} + +void AurynDelayVector::resize( NeuronID new_size ) +{ + super::resize(new_size); + for ( unsigned int i = 0 ; i < delay_buffer_size_ ; ++i ) { + memory[i]->resize(new_size); + } +} + +void AurynDelayVector::advance( ) +{ + memory[memory_pos_]->copy(this); + memory_pos_ = (memory_pos_+1)%delay_buffer_size_; +} + +AurynFloat AurynDelayVector::get( NeuronID i, int delay ) +{ + int pos = (delay_buffer_size_+memory_pos_-delay)%delay_buffer_size_; + if ( delay < 0 ) pos = memory_pos_; + return memory[pos]->get(i); +} + +AurynVectorFloat * AurynDelayVector::mem_ptr( int delay ) +{ + int pos = (delay_buffer_size_+memory_pos_-delay)%delay_buffer_size_; + if ( delay < 0 ) pos = memory_pos_; + return memory[pos]; +} diff --git a/src/auryn/AurynDelayVector.h b/src/auryn/AurynDelayVector.h new file mode 100644 index 00000000..5607bb3a --- /dev/null +++ b/src/auryn/AurynDelayVector.h @@ -0,0 +1,82 @@ +/* +* Copyright 2014-2016 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. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Auryn. If not, see . +* +* If you are using Auryn or parts of it for your work please cite: +* Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations +* of spiking neural networks using general-purpose computers. +* Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 +*/ + +#ifndef AURYNDELAYVECTOR_H_ +#define AURYNDELAYVECTOR_H_ + +#include +#include +#include + +#include "auryn_definitions.h" +#include "AurynVector.h" + + +namespace auryn { + + + /*! \brief AurynDelayVector is a AurynVectorFloat which keeps its own history in a ring buffer + * + */ + class AurynDelayVector : public AurynVectorFloat + { + private: + typedef AurynVectorFloat super; + + int delay_buffer_size_; + int memory_pos_; + std::vector< AurynVectorFloat* > memory; + + public: + /*! \brief Default constructor */ + AurynDelayVector(NeuronID n, unsigned int delay_buffer_size); + + /*! \brief Default destructor */ + virtual ~AurynDelayVector(); + + /*! \brief Advances memory buffer by one step */ + void advance(); + + /*! \brief Returns delayed element + * + * \param delay The delay in timesteps to retrieve. Value needs to be > 0, values smaller than zero will be interpreted as the max delay. + **/ + AurynFloat get(NeuronID i, int delay=-1); + + /*! \brief Returns pointer to delayed array element + * + * \param delay The delay in timesteps to retrieve. Value needs to be > 0, values smaller than zero will be interpreted as the max delay. + */ + AurynVectorFloat * mem_ptr(int delay=-1); + + /*! \brief Resizes the vector and the buffer vectors */ + void resize(NeuronID new_size); + + }; + +} + + +#endif /*AURYNDELAYVECTOR_H_*/ diff --git a/test/run_unit_tests.sh b/test/run_unit_tests.sh index 2c8a8355..1d40478e 100755 --- a/test/run_unit_tests.sh +++ b/test/run_unit_tests.sh @@ -3,6 +3,7 @@ BUILDDIR="../build/release" $BUILDDIR/test/src/test_AurynVector && \ $BUILDDIR/test/src/test_AurynStateVector && \ +$BUILDDIR/test/src/test_AurynDelayVector && \ $BUILDDIR/test/src/test_EulerTrace && \ $BUILDDIR/test/src/test_LinearTrace && \ $BUILDDIR/test/src/test_ComplexMatrix && exit 0 diff --git a/test/src/test_AurynDelayVector.cpp b/test/src/test_AurynDelayVector.cpp new file mode 100644 index 00000000..f6d99bae --- /dev/null +++ b/test/src/test_AurynDelayVector.cpp @@ -0,0 +1,37 @@ +#define BOOST_TEST_MODULE AurynDelayVector +#include +#include "auryn/auryn_definitions.h" +#include "auryn/AurynDelayVector.h" + + +float linfun(float x) +{ + return 0.1*x-0.3; +} + +BOOST_AUTO_TEST_CASE( memory ) { + + int n = 4; + int d = 5; + + auryn::AurynDelayVector v( n, d ); + + for ( int t = 0 ; t < d ; ++t ) { + std::cout << "t " << t << std::endl; + for ( int i = 0 ; i < n ; ++i ) v.set(i,linfun(i*t)); + v.print(); + v.advance(); + } + + // check delayed by 2 + int dly = 3; + std::cout << "checking delayed by " << dly << std::endl; + v.mem_ptr(dly)->print(); + for ( int i = 0 ; i < n ; ++i ) { + BOOST_CHECK_EQUAL( v.mem_ptr(dly)->get(i), linfun(i*(d-dly)) ); + } +} + + + +// EOF From 67690fc71367fd7077e5efa216dcc29618d55146 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Tue, 16 Aug 2016 16:40:52 -0700 Subject: [PATCH 31/77] Adds doxystring and renames method --- src/auryn/AurynDelayVector.cpp | 2 +- src/auryn/AurynDelayVector.h | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/auryn/AurynDelayVector.cpp b/src/auryn/AurynDelayVector.cpp index 51e51e62..3f90a95a 100644 --- a/src/auryn/AurynDelayVector.cpp +++ b/src/auryn/AurynDelayVector.cpp @@ -59,7 +59,7 @@ void AurynDelayVector::advance( ) memory_pos_ = (memory_pos_+1)%delay_buffer_size_; } -AurynFloat AurynDelayVector::get( NeuronID i, int delay ) +AurynFloat AurynDelayVector::mem_get( NeuronID i, int delay ) { int pos = (delay_buffer_size_+memory_pos_-delay)%delay_buffer_size_; if ( delay < 0 ) pos = memory_pos_; diff --git a/src/auryn/AurynDelayVector.h b/src/auryn/AurynDelayVector.h index 5607bb3a..1a8a60fc 100644 --- a/src/auryn/AurynDelayVector.h +++ b/src/auryn/AurynDelayVector.h @@ -38,6 +38,15 @@ namespace auryn { /*! \brief AurynDelayVector is a AurynVectorFloat which keeps its own history in a ring buffer + * + * Note that AurynDelayVector does not tap into the Auryn clock and the method advance() has to be run to store a + * copy in the vector queue. + * + * Public member methods: + * + * advance(): Stores corrent vector state into a queue + * mem_get(i,d) : Retrieves element i from the d delayed version + * mem_ptr(d) : Returns pointer to the d delayed version of the vector. * */ class AurynDelayVector : public AurynVectorFloat @@ -63,7 +72,7 @@ namespace auryn { * * \param delay The delay in timesteps to retrieve. Value needs to be > 0, values smaller than zero will be interpreted as the max delay. **/ - AurynFloat get(NeuronID i, int delay=-1); + AurynFloat mem_get(NeuronID i, int delay=-1); /*! \brief Returns pointer to delayed array element * From 20443e93a1806b9b1c37ac461919a56afe9616be Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Tue, 16 Aug 2016 16:41:08 -0700 Subject: [PATCH 32/77] Updates test and removes couts --- test/src/test_AurynDelayVector.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/src/test_AurynDelayVector.cpp b/test/src/test_AurynDelayVector.cpp index f6d99bae..b858a589 100644 --- a/test/src/test_AurynDelayVector.cpp +++ b/test/src/test_AurynDelayVector.cpp @@ -17,19 +17,27 @@ BOOST_AUTO_TEST_CASE( memory ) { auryn::AurynDelayVector v( n, d ); for ( int t = 0 ; t < d ; ++t ) { - std::cout << "t " << t << std::endl; + // std::cout << "t " << t << std::endl; for ( int i = 0 ; i < n ; ++i ) v.set(i,linfun(i*t)); - v.print(); + //v.print(); v.advance(); } // check delayed by 2 int dly = 3; - std::cout << "checking delayed by " << dly << std::endl; - v.mem_ptr(dly)->print(); + // std::cout << "checking delayed by " << dly << std::endl; + // v.mem_ptr(dly)->print(); for ( int i = 0 ; i < n ; ++i ) { BOOST_CHECK_EQUAL( v.mem_ptr(dly)->get(i), linfun(i*(d-dly)) ); } + + // check delayed by max delay (should be first element) + dly = -1; // the same as dly = d + // std::cout << "checking delayed by max " << std::endl; + // v.mem_ptr(dly)->print(); + for ( int i = 0 ; i < n ; ++i ) { + BOOST_CHECK_EQUAL( v.mem_ptr(dly)->get(i), linfun(i*0) ); + } } From a1cb6dfbb42f7960e19686cd4f7281d4af06b1c2 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Tue, 16 Aug 2016 23:48:19 -0700 Subject: [PATCH 33/77] Little fix --- src/auryn/AurynDelayVector.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/auryn/AurynDelayVector.cpp b/src/auryn/AurynDelayVector.cpp index 3f90a95a..2376aafe 100644 --- a/src/auryn/AurynDelayVector.cpp +++ b/src/auryn/AurynDelayVector.cpp @@ -61,6 +61,7 @@ void AurynDelayVector::advance( ) AurynFloat AurynDelayVector::mem_get( NeuronID i, int delay ) { + if ( delay == 0 ) return get(i); int pos = (delay_buffer_size_+memory_pos_-delay)%delay_buffer_size_; if ( delay < 0 ) pos = memory_pos_; return memory[pos]->get(i); @@ -68,6 +69,7 @@ AurynFloat AurynDelayVector::mem_get( NeuronID i, int delay ) AurynVectorFloat * AurynDelayVector::mem_ptr( int delay ) { + if ( delay == 0 ) return this; int pos = (delay_buffer_size_+memory_pos_-delay)%delay_buffer_size_; if ( delay < 0 ) pos = memory_pos_; return memory[pos]; From b8ccfcfeb47783e0f62851d5bb222cb3b7eec46a Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Tue, 16 Aug 2016 23:48:38 -0700 Subject: [PATCH 34/77] Adds new inc function to EulerTrace --- src/auryn/EulerTrace.cpp | 8 +++++--- src/auryn/EulerTrace.h | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/auryn/EulerTrace.cpp b/src/auryn/EulerTrace.cpp index 55c4947f..b1f3dfa8 100644 --- a/src/auryn/EulerTrace.cpp +++ b/src/auryn/EulerTrace.cpp @@ -95,9 +95,7 @@ void EulerTrace::set_target( EulerTrace * target ) void EulerTrace::evolve() { - // auryn_vector_float_scale(scale_const,state); // seems to be faster state->scale(scale_const); - // auryn_vector_float_mul_constant(state,scale_const); } void EulerTrace::follow() @@ -119,10 +117,14 @@ AurynFloat EulerTrace::get_tau() void EulerTrace::inc(NeuronID i) { - // auryn_vector_float_set (state, i, auryn_vector_float_get (state, i)+1); state->data[i]++; } +void EulerTrace::inc(SpikeContainer * sc) +{ + for ( NeuronID i = 0 ; i < sc->size() ; ++i ) + inc((*sc)[i]); +} AurynFloat EulerTrace::normalized_get(NeuronID i) { diff --git a/src/auryn/EulerTrace.h b/src/auryn/EulerTrace.h index 9c90abcb..dc8603cb 100644 --- a/src/auryn/EulerTrace.h +++ b/src/auryn/EulerTrace.h @@ -101,10 +101,17 @@ class EulerTrace * \param value value to add to the trace */ void add(NeuronID i , AurynFloat value); + /*! Increment given trace by 1. * \param i index of trace to increment. */ void inc(NeuronID i); + + /*! Increment given traces by 1. + * \param sc SpikeContainer with all neurons to increment. + */ + void inc(SpikeContainer * sc); + /*! Perform Euler step. */ void evolve(); From 9f70f920dd451c515275e56d89ea321cc8ca5aad Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Wed, 17 Aug 2016 10:12:17 -0700 Subject: [PATCH 35/77] Adds doxystrings to some example files --- examples/sim_background.cpp | 12 ++++++++++++ examples/sim_brunel2k.cpp | 18 ++++++++++++++++++ examples/sim_brunel2k_pl.cpp | 18 ++++++++++++++++++ examples/sim_poisson.cpp | 6 ++++++ 4 files changed, 54 insertions(+) diff --git a/examples/sim_background.cpp b/examples/sim_background.cpp index adf2e3bd..8b46966e 100644 --- a/examples/sim_background.cpp +++ b/examples/sim_background.cpp @@ -18,6 +18,18 @@ * along with Auryn. If not, see . */ +/*!\file + * + * \brief Simulation code based on the code used in + * Zenke et al. (2013). + * + * Simulation code based on the code used in Zenke, F., Hennequin, G., and + * Gerstner, W. (2013). Synaptic Plasticity in Neural Networks Needs + * Homeostasis with a Fast Rate Detector. PLoS Comput Biol 9, e1003330. It + * simulates a network with 25k integrate and fire neurons and a minimal + * homeostatic triplet model with a sliding threshold. + * + * */ #include "auryn.h" diff --git a/examples/sim_brunel2k.cpp b/examples/sim_brunel2k.cpp index 4aa6b952..e864f5e3 100644 --- a/examples/sim_brunel2k.cpp +++ b/examples/sim_brunel2k.cpp @@ -18,6 +18,24 @@ * along with Auryn. If not, see . */ +/*!\file + * + * \brief Implementation of the Brunel (2000) network as implemented in NEST + * + * This simulates the network from Brunel, N. (2000). Dynamics of sparsely + * connected networks of excitatory and inhibitory spiking neurons. J Comput + * Neurosci 8, 183–208. + * as implemented in the NEST examples + * (https://github.com/nest/nest-simulator/tree/master/examples/nest). + * + * This file contains the network without plasticity. However, the same network + * was implemented with and without weight-dependent STDP for performance + * comparison with NEST. The results are published in Zenke, F., and Gerstner, + * W. (2014). Limits to high-speed simulations of spiking neural networks using + * general-purpose computers. Front Neuroinform 8, 76. + * + */ + #include "auryn.h" using namespace auryn; diff --git a/examples/sim_brunel2k_pl.cpp b/examples/sim_brunel2k_pl.cpp index 8d733ba6..2feae03e 100644 --- a/examples/sim_brunel2k_pl.cpp +++ b/examples/sim_brunel2k_pl.cpp @@ -18,6 +18,24 @@ * along with Auryn. If not, see . */ +/*!\file + * + * \brief Implementation of the Brunel (2000) network with added STDP as implemented in NEST + * + * This simulates the network from Brunel, N. (2000). Dynamics of sparsely + * connected networks of excitatory and inhibitory spiking neurons. J Comput + * Neurosci 8, 183–208. + * as implemented in the NEST examples + * (https://github.com/nest/nest-simulator/tree/master/examples/nest). + * + * This file contains the network without plasticity. However, the same network + * was implemented with and without weight-dependent STDP for performance + * comparison with NEST. The results are published in Zenke, F., and Gerstner, + * W. (2014). Limits to high-speed simulations of spiking neural networks using + * general-purpose computers. Front Neuroinform 8, 76. + * + */ + #include "auryn.h" using namespace auryn; diff --git a/examples/sim_poisson.cpp b/examples/sim_poisson.cpp index 2fc6e6b6..e842042c 100644 --- a/examples/sim_poisson.cpp +++ b/examples/sim_poisson.cpp @@ -18,6 +18,12 @@ * along with Auryn. If not, see . */ + +/*!\file + * + * \brief Example simulation which simulates a group of Poisson neurons + */ + #include "auryn.h" using namespace auryn; From 06fad92b3ca7b4758c81d907234590eb7a7af374 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Wed, 17 Aug 2016 10:18:06 -0700 Subject: [PATCH 36/77] Adds doxystring to sim_coba_benchmark --- examples/sim_coba_benchmark.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/examples/sim_coba_benchmark.cpp b/examples/sim_coba_benchmark.cpp index 3801e94c..857474d1 100644 --- a/examples/sim_coba_benchmark.cpp +++ b/examples/sim_coba_benchmark.cpp @@ -18,6 +18,27 @@ * along with Auryn. If not, see . */ +/*!\file + * + * \brief Simulation code for the Vogels Abbott benchmark following Brette et al. (2007) + * + * This simulation implements the Vogels Abbott benchmark as suggested by + * Brette et al. (2007) Journal of Computational Neuroscience 23: 349-398. + * + * The network is based on a network by Vogels and Abbott as described in + * Vogels, T.P., and Abbott, L.F. (2005). Signal propagation and logic gating + * in networks of integrate-and-fire neurons. J Neurosci 25, 10786. + * + * We used this network for benchmarking Auryn against other simulators in + * Zenke, F., and Gerstner, W. (2014). Limits to high-speed simulations of + * spiking neural networks using general-purpose computers. Front Neuroinform + * 8, 76. + * + * See build/release/run_benchmark.sh for automatically run benchmarks to + * compare the performance of different Auryn builds. + * + * */ + #include "auryn.h" using namespace auryn; From 78ebd81fd701ab12e7ef8316590dbafd1768564e Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Wed, 17 Aug 2016 16:25:19 -0700 Subject: [PATCH 37/77] Adds PoissonSpikeInjector --- src/auryn.h | 1 + src/auryn/PoissonSpikeInjector.cpp | 47 +++++++++++++++++++++ src/auryn/PoissonSpikeInjector.h | 67 ++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 src/auryn/PoissonSpikeInjector.cpp create mode 100644 src/auryn/PoissonSpikeInjector.h diff --git a/src/auryn.h b/src/auryn.h index e0840b60..2dc4d158 100644 --- a/src/auryn.h +++ b/src/auryn.h @@ -71,6 +71,7 @@ #include "auryn/SpikingGroup.h" #include "auryn/NeuronGroup.h" #include "auryn/PoissonGroup.h" +#include "auryn/PoissonSpikeInjector.h" #include "auryn/FileInputGroup.h" #include "auryn/FileModulatedPoissonGroup.h" #include "auryn/StimulusGroup.h" diff --git a/src/auryn/PoissonSpikeInjector.cpp b/src/auryn/PoissonSpikeInjector.cpp new file mode 100644 index 00000000..5aa228a7 --- /dev/null +++ b/src/auryn/PoissonSpikeInjector.cpp @@ -0,0 +1,47 @@ +/* +* Copyright 2014-2016 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. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Auryn. If not, see . +* +* If you are using Auryn or parts of it for your work please cite: +* Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations +* of spiking neural networks using general-purpose computers. +* Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 +*/ + +#include "PoissonSpikeInjector.h" + +using namespace auryn; + +PoissonSpikeInjector::PoissonSpikeInjector(SpikingGroup * target_group, AurynDouble rate ) : PoissonGroup( target_group->get_size(), rate ) +{ + target = target_group; +} + +PoissonSpikeInjector::~PoissonSpikeInjector() +{ +} + +void PoissonSpikeInjector::evolve() +{ + super::evolve(); + + // now add Poisson spikes to target group + SpikeContainer * a = target->get_spikes(); + SpikeContainer * b = get_spikes(); + a->insert(a->end(), b->begin(), b->end()); +} diff --git a/src/auryn/PoissonSpikeInjector.h b/src/auryn/PoissonSpikeInjector.h new file mode 100644 index 00000000..21b2c875 --- /dev/null +++ b/src/auryn/PoissonSpikeInjector.h @@ -0,0 +1,67 @@ +/* +* Copyright 2014-2016 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. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Auryn. If not, see . +* +* If you are using Auryn or parts of it for your work please cite: +* Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations +* of spiking neural networks using general-purpose computers. +* Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 +*/ + +#ifndef POISSONSPIKEINJECTOR_H_ +#define POISSONSPIKEINJECTOR_H_ + +#include "auryn_definitions.h" +#include "AurynVector.h" +#include "System.h" +#include "PoissonGroup.h" + +namespace auryn { + +/*! \brief A PoissonGroup which can directly add its output spike to another SpikingGroup by piggy backing onto it + * + * + * \todo Have to make sure this group has the same rank_lock structure as the piggy back group + */ +class PoissonSpikeInjector : public PoissonGroup +{ +private: + typedef PoissonGroup super; + + SpikingGroup * target; + + +protected: + +public: + /*! \brief Standard constructor. + * \param target_group is the group to whose output we add the random poisson spikes + * \param rate is the mean firing rate of the poisson neurons in the spike injector + */ + PoissonSpikeInjector(SpikingGroup * target_group, AurynDouble rate=5. ); + + /*! \brief Default destructor */ + virtual ~PoissonSpikeInjector(); + + /*! \brief Standard evolve function */ + virtual void evolve(); +}; + +} + +#endif /*POISSONSPIKEINJECTOR_H_*/ From 1a9f00c42cff88c2832477fcc4032ea2cd032e27 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Wed, 17 Aug 2016 17:12:20 -0700 Subject: [PATCH 38/77] Adds warning to PoissonSpikeInjector --- src/auryn/PoissonSpikeInjector.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/auryn/PoissonSpikeInjector.cpp b/src/auryn/PoissonSpikeInjector.cpp index 5aa228a7..3538795d 100644 --- a/src/auryn/PoissonSpikeInjector.cpp +++ b/src/auryn/PoissonSpikeInjector.cpp @@ -30,6 +30,10 @@ using namespace auryn; PoissonSpikeInjector::PoissonSpikeInjector(SpikingGroup * target_group, AurynDouble rate ) : PoissonGroup( target_group->get_size(), rate ) { target = target_group; + if ( sys->mpi_size() > 1 ) { + logger->warning("PoissonSpikeInjector might not work correctly when run with MPI."); + // TODO still need to make sure that rank lock etc does not screw up things if the target is distributed differently + } } PoissonSpikeInjector::~PoissonSpikeInjector() @@ -41,7 +45,7 @@ void PoissonSpikeInjector::evolve() super::evolve(); // now add Poisson spikes to target group - SpikeContainer * a = target->get_spikes(); - SpikeContainer * b = get_spikes(); + SpikeContainer * a = target->get_spikes_immediate(); + SpikeContainer * b = get_spikes_immediate(); a->insert(a->end(), b->begin(), b->end()); } From 9ffdbe713b7930c5954bbc6fd95dbd7f942302fc Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 11:34:33 -0700 Subject: [PATCH 39/77] Removes old randomization functions from NeuronGroup --- examples/sim_dense.cpp | 2 +- src/auryn/NeuronGroup.cpp | 30 ------------------------------ src/auryn/NeuronGroup.h | 8 -------- 3 files changed, 1 insertion(+), 39 deletions(-) diff --git a/examples/sim_dense.cpp b/examples/sim_dense.cpp index 23343e79..9aa8d729 100644 --- a/examples/sim_dense.cpp +++ b/examples/sim_dense.cpp @@ -109,7 +109,7 @@ int main(int ac,char *av[]) { logger->msg("Setting up neuron groups ...",PROGRESS,true); IFGroup * neurons_e = new IFGroup( NE); neurons_e->set_ampa_nmda_ratio(1.0); - neurons_e->random_nmda(0.1,1); + neurons_e->randomize_state_vector_gauss("g_nmda",0.1,1); IFGroup * neurons_i = new IFGroup( NI); neurons_i->set_ampa_nmda_ratio(1.0); neurons_i->set_tau_mem(10e-3); diff --git a/src/auryn/NeuronGroup.cpp b/src/auryn/NeuronGroup.cpp index dea7f283..0a19ea2d 100644 --- a/src/auryn/NeuronGroup.cpp +++ b/src/auryn/NeuronGroup.cpp @@ -75,36 +75,6 @@ void NeuronGroup::random_mem(AurynState mean, AurynState sigma) init_state(); } -void NeuronGroup::random_uniform_mem(AurynState lo, AurynState hi) -{ - boost::mt19937 ng_gen(42+auryn::mpicommunicator->rank()); // produces same series every time - boost::uniform_01 die = boost::uniform_01 (ng_gen); - AurynState rv; - - for ( AurynLong i = 0 ; iset(i,rv); - } - - init_state(); -} - -void NeuronGroup::random_nmda(AurynState mean, AurynState sigma) -{ - boost::mt19937 ng_gen(53+auryn::mpicommunicator->rank()); // produces same series every time - boost::normal_distribution<> dist((double)mean, (double)sigma); - boost::variate_generator > die(ng_gen, dist); - AurynState rv; - - for ( AurynLong i = 0 ; iset(i,rv); - } - - init_state(); -} - - void NeuronGroup::safe_tadd(NeuronID id, AurynWeight amount, TransmitterType t) { if (localrank(id)) diff --git a/src/auryn/NeuronGroup.h b/src/auryn/NeuronGroup.h index 1b1e6653..0bb70bad 100644 --- a/src/auryn/NeuronGroup.h +++ b/src/auryn/NeuronGroup.h @@ -35,11 +35,6 @@ #include #include - -#include -#include -#include - namespace auryn { /*! \brief Abstract base class for all neuron groups. @@ -91,9 +86,6 @@ class NeuronGroup : public SpikingGroup void random_mem(AurynState mean=-60e-3, AurynState sigma=5e-3); - void random_uniform_mem(AurynState lo, AurynState hi); - - void random_nmda(AurynState mean, AurynState sigma); virtual void init_state(); From 21e449aba80f5a92a697d414c267778c58da4858 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 11:52:18 -0700 Subject: [PATCH 40/77] Fixes unsigned comparison in aube --- tools/aube.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/aube.cpp b/tools/aube.cpp index 54e1341b..50c72e86 100644 --- a/tools/aube.cpp +++ b/tools/aube.cpp @@ -186,7 +186,7 @@ int main(int ac, char* av[]) exit(EXIT_FAILURE); } - for ( int i = 0 ; i < input_filenames.size() ; ++i ) { + for ( unsigned int i = 0 ; i < input_filenames.size() ; ++i ) { std::ifstream * tmp = new std::ifstream( input_filenames[i].c_str(), std::ios::binary ); inputs.push_back(tmp); if (!(*tmp)) { @@ -250,7 +250,7 @@ int main(int ac, char* av[]) // set all streams to respetive start frame - for ( int i = 0 ; i < inputs.size() ; ++i ) { + for ( unsigned int i = 0 ; i < inputs.size() ; ++i ) { // compute start and end frames AurynLong start_frame = find_frame(inputs[i], from_time/dt); @@ -267,7 +267,7 @@ int main(int ac, char* av[]) // read first frames from all files std::vector frames(inputs.size()); - for ( int i = 0 ; i < frames.size() ; ++i ) { + for ( unsigned int i = 0 ; i < frames.size() ; ++i ) { inputs[i]->read((char*)&frames[i], sizeof(SpikeEvent_type)); } @@ -289,7 +289,7 @@ int main(int ac, char* av[]) int current_stream = 0; AurynLong mintime = std::numeric_limits::max(); bool eofs = true; - for ( int i = 0 ; i < frames.size() ; ++i ) { + for ( unsigned int i = 0 ; i < frames.size() ; ++i ) { eofs = eofs && inputs[i]->eof(); if ( inputs[i]->eof() ) continue; if ( frames[i].time < mintime ) { @@ -323,7 +323,7 @@ int main(int ac, char* av[]) of.close(); // close input streams - for ( int i = 0 ; i < frames.size() ; ++i ) { + for ( unsigned int i = 0 ; i < frames.size() ; ++i ) { inputs[i]->close(); } From 073f2c67dcdd8f2982b6c16789dae9a6ed41c965 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 11:55:26 -0700 Subject: [PATCH 41/77] Removes direct call to mpienv from examples --- examples/sim_background.cpp | 3 +-- examples/sim_bg_lowpass.cpp | 3 +-- examples/sim_bg_scaling.cpp | 3 +-- examples/sim_bg_static.cpp | 3 +-- examples/sim_brunel2k.cpp | 3 +-- examples/sim_brunel2k_pl.cpp | 3 +-- examples/sim_coba_benchmark.cpp | 3 +-- examples/sim_coba_binmon.cpp | 3 +-- examples/sim_current_steps.cpp | 3 +-- examples/sim_current_stim.cpp | 3 +-- examples/sim_dense.cpp | 3 +-- examples/sim_epsp.cpp | 3 +-- examples/sim_epsp_binmon.cpp | 3 +-- examples/sim_epsp_stp.cpp | 3 +-- examples/sim_isp_big.cpp | 2 +- examples/sim_poisson.cpp | 3 +-- examples/sim_step_current.cpp | 3 +-- 17 files changed, 17 insertions(+), 33 deletions(-) diff --git a/examples/sim_background.cpp b/examples/sim_background.cpp index 8b46966e..dbafe672 100644 --- a/examples/sim_background.cpp +++ b/examples/sim_background.cpp @@ -37,7 +37,6 @@ namespace po = boost::program_options; -namespace mpi = boost::mpi; using namespace auryn; @@ -870,7 +869,7 @@ if ( patfile != "" ) { if (errcode) { - mpienv->abort(errcode); + auryn_abort(errcode); } logger->msg("Freeing ...",PROGRESS,true); diff --git a/examples/sim_bg_lowpass.cpp b/examples/sim_bg_lowpass.cpp index f4e85d51..3432a7bb 100644 --- a/examples/sim_bg_lowpass.cpp +++ b/examples/sim_bg_lowpass.cpp @@ -26,7 +26,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; /*! \brief Example program using LPTripletConnection * @@ -826,7 +825,7 @@ if ( patfile != "" ) { delete sys; if (errcode) { - mpienv->abort(errcode); + auryn_abort(errcode); } return errcode; diff --git a/examples/sim_bg_scaling.cpp b/examples/sim_bg_scaling.cpp index d43b1f19..0e9e5789 100644 --- a/examples/sim_bg_scaling.cpp +++ b/examples/sim_bg_scaling.cpp @@ -36,7 +36,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -434,7 +433,7 @@ int main(int ac, char* av[]) killfile.close(); if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ...",PROGRESS,true); auryn_free(); diff --git a/examples/sim_bg_static.cpp b/examples/sim_bg_static.cpp index 59fd99f8..0465e0a2 100644 --- a/examples/sim_bg_static.cpp +++ b/examples/sim_bg_static.cpp @@ -23,7 +23,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -313,7 +312,7 @@ int main(int ac, char* av[]) if (errcode) { - mpienv->abort(errcode); + auryn_abort(errcode); } logger->msg("Freeing ...",PROGRESS,true); diff --git a/examples/sim_brunel2k.cpp b/examples/sim_brunel2k.cpp index e864f5e3..d5c8166c 100644 --- a/examples/sim_brunel2k.cpp +++ b/examples/sim_brunel2k.cpp @@ -41,7 +41,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac,char *av[]) { std::string dir = "."; @@ -264,7 +263,7 @@ int main(int ac,char *av[]) { delete sys; if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); return errcode; } diff --git a/examples/sim_brunel2k_pl.cpp b/examples/sim_brunel2k_pl.cpp index 2feae03e..451ee8f5 100644 --- a/examples/sim_brunel2k_pl.cpp +++ b/examples/sim_brunel2k_pl.cpp @@ -41,7 +41,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac,char *av[]) { string dir = "."; @@ -287,7 +286,7 @@ int main(int ac,char *av[]) { delete sys; if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); return errcode; } diff --git a/examples/sim_coba_benchmark.cpp b/examples/sim_coba_benchmark.cpp index 857474d1..9cebc371 100644 --- a/examples/sim_coba_benchmark.cpp +++ b/examples/sim_coba_benchmark.cpp @@ -44,7 +44,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac,char *av[]) { string dir = "/tmp"; @@ -211,7 +210,7 @@ int main(int ac,char *av[]) { } if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ..." ,PROGRESS,true); auryn_free(); diff --git a/examples/sim_coba_binmon.cpp b/examples/sim_coba_binmon.cpp index 0ca8b01f..4fbc1516 100644 --- a/examples/sim_coba_binmon.cpp +++ b/examples/sim_coba_binmon.cpp @@ -26,7 +26,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac,char *av[]) { string dir = "/tmp"; @@ -184,7 +183,7 @@ int main(int ac,char *av[]) { if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ..." ,PROGRESS,true); auryn_free(); diff --git a/examples/sim_current_steps.cpp b/examples/sim_current_steps.cpp index 5a420d83..391b1a92 100644 --- a/examples/sim_current_steps.cpp +++ b/examples/sim_current_steps.cpp @@ -30,7 +30,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -83,7 +82,7 @@ int main(int ac, char* av[]) } if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ...",PROGRESS,true); auryn_free(); diff --git a/examples/sim_current_stim.cpp b/examples/sim_current_stim.cpp index 6fbd97a5..28b162c9 100644 --- a/examples/sim_current_stim.cpp +++ b/examples/sim_current_stim.cpp @@ -31,7 +31,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -64,7 +63,7 @@ int main(int ac, char* av[]) sys->run(1); if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ...",PROGRESS,true); auryn_free(); return errcode; diff --git a/examples/sim_dense.cpp b/examples/sim_dense.cpp index 9aa8d729..5d5d343f 100644 --- a/examples/sim_dense.cpp +++ b/examples/sim_dense.cpp @@ -26,7 +26,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac,char *av[]) { string dir = "."; @@ -192,7 +191,7 @@ int main(int ac,char *av[]) { if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ..." ,PROGRESS,true); auryn_free(); diff --git a/examples/sim_epsp.cpp b/examples/sim_epsp.cpp index b7c2cbb5..cf083217 100644 --- a/examples/sim_epsp.cpp +++ b/examples/sim_epsp.cpp @@ -30,7 +30,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -69,6 +68,6 @@ int main(int ac, char* av[]) delete sys; if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); return errcode; } diff --git a/examples/sim_epsp_binmon.cpp b/examples/sim_epsp_binmon.cpp index d0a4d23f..0767e4b6 100644 --- a/examples/sim_epsp_binmon.cpp +++ b/examples/sim_epsp_binmon.cpp @@ -30,7 +30,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -68,6 +67,6 @@ int main(int ac, char* av[]) delete sys; if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); return errcode; } diff --git a/examples/sim_epsp_stp.cpp b/examples/sim_epsp_stp.cpp index 1d212763..8e511470 100644 --- a/examples/sim_epsp_stp.cpp +++ b/examples/sim_epsp_stp.cpp @@ -34,7 +34,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -115,6 +114,6 @@ int main(int ac, char* av[]) delete sys; if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); return errcode; } diff --git a/examples/sim_isp_big.cpp b/examples/sim_isp_big.cpp index ae857e4e..251339a9 100644 --- a/examples/sim_isp_big.cpp +++ b/examples/sim_isp_big.cpp @@ -344,7 +344,7 @@ int main(int ac, char* av[]) } if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ..." ,PROGRESS,true); auryn_free(); diff --git a/examples/sim_poisson.cpp b/examples/sim_poisson.cpp index e842042c..e06979df 100644 --- a/examples/sim_poisson.cpp +++ b/examples/sim_poisson.cpp @@ -29,7 +29,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -123,7 +122,7 @@ int main(int ac, char* av[]) if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); logger->msg("Freeing ...",PROGRESS,true); auryn_free(); return errcode; diff --git a/examples/sim_step_current.cpp b/examples/sim_step_current.cpp index e0b1ba13..7b97bee8 100644 --- a/examples/sim_step_current.cpp +++ b/examples/sim_step_current.cpp @@ -30,7 +30,6 @@ using namespace auryn; namespace po = boost::program_options; -namespace mpi = boost::mpi; int main(int ac, char* av[]) { @@ -66,7 +65,7 @@ int main(int ac, char* av[]) sys->run(0.1); if (errcode) - mpienv->abort(errcode); + auryn_abort(errcode); // clean up logger->msg("Freeing ...",PROGRESS,true); From 7b2b3f9262aae9e1ebf477d545866b0c8a8b34c9 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 12:28:43 -0700 Subject: [PATCH 42/77] Adds preprocessor option to compile Auryn withgout MPI support --- src/auryn.h | 5 ++- src/auryn/RealTimeMonitor.cpp | 5 ++- src/auryn/SpikingGroup.cpp | 44 ++++++++++--------- src/auryn/SpikingGroup.h | 7 ++- src/auryn/SyncBuffer.cpp | 5 ++- src/auryn/SyncBuffer.h | 8 +++- src/auryn/System.cpp | 70 +++++++++++++++++++++++------- src/auryn/System.h | 21 ++++++--- src/auryn/auryn_definitions.h | 82 ++++++++++++++++++++--------------- src/auryn/auryn_global.cpp | 25 +++++++++-- src/auryn/auryn_global.h | 4 +- 11 files changed, 187 insertions(+), 89 deletions(-) diff --git a/src/auryn.h b/src/auryn.h index 2dc4d158..e8bd977b 100644 --- a/src/auryn.h +++ b/src/auryn.h @@ -42,9 +42,12 @@ #include "auryn/AurynVector.h" #include "auryn/AurynDelayVector.h" #include "auryn/System.h" -#include "auryn/SyncBuffer.h" #include "auryn/Logger.h" #include "auryn/SpikeDelay.h" +#ifdef AURYN_CODE_USE_MPI +#include "auryn/SyncBuffer.h" +#endif // AURYN_CODE_USE_MPI + // Trace definitions #include "auryn/LinearTrace.h" diff --git a/src/auryn/RealTimeMonitor.cpp b/src/auryn/RealTimeMonitor.cpp index 1a350a14..bc37aa99 100644 --- a/src/auryn/RealTimeMonitor.cpp +++ b/src/auryn/RealTimeMonitor.cpp @@ -34,8 +34,10 @@ RealTimeMonitor::RealTimeMonitor(std::string filename, AurynDouble start, AurynD t_start = start/dt; t_stop = stop/dt; + ptime_offset = boost::posix_time::microsec_clock::local_time(); + +#ifdef AURYN_CODE_USE_MPI if (auryn::sys->get_com()->rank() == 0) { - ptime_offset = boost::posix_time::microsec_clock::local_time(); std::string sendstring = boost::posix_time::to_iso_string(ptime_offset); broadcast(*auryn::sys->get_com(), sendstring, 0); } else { @@ -43,6 +45,7 @@ RealTimeMonitor::RealTimeMonitor(std::string filename, AurynDouble start, AurynD broadcast(*auryn::sys->get_com(), timestring , 0); ptime_offset = boost::posix_time::from_iso_string(timestring); } +#endif // AURYN_CODE_USE_MPI } RealTimeMonitor::~RealTimeMonitor() diff --git a/src/auryn/SpikingGroup.cpp b/src/auryn/SpikingGroup.cpp index 47bb1ecd..0e2e20ea 100644 --- a/src/auryn/SpikingGroup.cpp +++ b/src/auryn/SpikingGroup.cpp @@ -34,8 +34,6 @@ NeuronID SpikingGroup::unique_id_count = 0; AurynTime * SpikingGroup::clock_ptr = NULL; -std::vector SpikingGroup::reqs; - NeuronID SpikingGroup::anticipated_total = 0; @@ -68,7 +66,13 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) // setting up default values evolve_locally_bool = true; locked_rank = 0; - locked_range = auryn::mpicommunicator->size(); +#ifdef AURYN_CODE_USE_MPI + locked_range = mpi_size; +#else + mpi_size = 1; + mpi_rank = 0; + locked_range = mpi_size; +#endif // AURYN_CODE_USE_MPI rank_size = calculate_rank_size(); // set the rank size double fraction = (double)calculate_rank_size(0)*effective_load_multiplier/DEFAULT_MINDISTRIBUTEDSIZE; @@ -80,7 +84,7 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) lock_range( fraction ); } else { // ROUNDROBIN which is default locked_rank = 0; - locked_range = auryn::mpicommunicator->size(); + locked_range = mpi_size; std::stringstream oss; oss << get_log_name() << ":: Size " << get_rank_size() << " (ROUNDROBIN)"; @@ -115,7 +119,7 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) void SpikingGroup::lock_range( double rank_fraction ) { - locked_rank = last_locked_rank%auryn::mpicommunicator->size(); // TODO might cause a bug with the block lock stuff + locked_rank = last_locked_rank%mpi_size; // TODO might cause a bug with the block lock stuff // TODO get the loads for the different ranks and try to minimize this @@ -125,9 +129,9 @@ void SpikingGroup::lock_range( double rank_fraction ) auryn::logger->msg(oss.str(),NOTIFICATION); locked_range = 1; } else { // this is for multiple rank ranges - unsigned int free_ranks = auryn::mpicommunicator->size()-last_locked_rank; + unsigned int free_ranks = mpi_size-last_locked_rank; - locked_range = rank_fraction*auryn::mpicommunicator->size()+0.5; + locked_range = rank_fraction*mpi_size+0.5; if ( locked_range == 0 ) { // needs at least one rank locked_range = 1; } @@ -138,15 +142,15 @@ void SpikingGroup::lock_range( double rank_fraction ) oss << get_log_name() << ":: Not enough free ranks for RANGELOCK. Starting to fill at zero again."; auryn::logger->msg(oss.str(),NOTIFICATION); locked_rank = 0; - free_ranks = auryn::mpicommunicator->size(); + free_ranks = mpi_size; // return; } } - unsigned int rank = (unsigned int) auryn::mpicommunicator->rank(); + unsigned int rank = (unsigned int) mpi_rank; evolve_locally_bool = ( rank >= locked_rank && rank < (locked_rank+locked_range) ); - last_locked_rank = (locked_rank+locked_range)%auryn::mpicommunicator->size(); + last_locked_rank = (locked_rank+locked_range)%mpi_size; rank_size = calculate_rank_size(); // recalculate the rank size // logging @@ -270,7 +274,7 @@ NeuronID SpikingGroup::calculate_rank_size(int rank) if ( rank >= 0 ) comrank = rank; else - comrank = (unsigned int) auryn::mpicommunicator->rank(); + comrank = (unsigned int) mpi_rank; if ( comrank >= locked_rank && comrank < (locked_rank+locked_range) ) { if (comrank-locked_rank >= size%locked_range) @@ -309,7 +313,7 @@ AurynDouble SpikingGroup::get_effective_load() NeuronID SpikingGroup::rank2global(NeuronID i) { - return i*locked_range+(auryn::mpicommunicator->rank()-locked_rank); + return i*locked_range+(mpi_rank-locked_rank); } bool SpikingGroup::evolve_locally() @@ -499,16 +503,16 @@ std::string SpikingGroup::get_log_name() bool SpikingGroup::localrank(NeuronID i) { #ifdef DEBUG - std::cout << ( (i%locked_range+locked_rank)==auryn::mpicommunicator->rank() ) << " " - << ( (int) auryn::mpicommunicator->rank() >= locked_rank) << " " - << ( (int) auryn::mpicommunicator->rank() >= locked_rank) << " " - << ( (int) auryn::mpicommunicator->rank() < (locked_rank+locked_range) ) << " " + std::cout << ( (i%locked_range+locked_rank)==mpi_rank ) << " " + << ( (int) mpi_rank >= locked_rank) << " " + << ( (int) mpi_rank >= locked_rank) << " " + << ( (int) mpi_rank < (locked_rank+locked_range) ) << " " << ( i/locked_range < get_rank_size() ) << std::endl; #endif //DEBUG - bool t = ( (i%locked_range+locked_rank)==auryn::mpicommunicator->rank() ) - && (int) auryn::mpicommunicator->rank() >= locked_rank - && (int) auryn::mpicommunicator->rank() < (locked_rank+locked_range) + bool t = ( (i%locked_range+locked_rank)==mpi_rank ) + && (int) mpi_rank >= locked_rank + && (int) mpi_rank < (locked_rank+locked_range) && i/locked_range < get_rank_size(); return t; } @@ -729,7 +733,7 @@ AurynStateVector * SpikingGroup::find_state_vector(std::string key) void SpikingGroup::randomize_state_vector_gauss(std::string state_vector_name, AurynState mean, AurynState sigma, int seed) { - boost::mt19937 ng_gen(seed+auryn::mpicommunicator->rank()); // produces same series every time + boost::mt19937 ng_gen(seed+mpi_rank); // produces same series every time boost::normal_distribution<> dist((double)mean, (double)sigma); boost::variate_generator > die(ng_gen, dist); AurynState rv; diff --git a/src/auryn/SpikingGroup.h b/src/auryn/SpikingGroup.h index 30eba83d..4b1d6e6d 100644 --- a/src/auryn/SpikingGroup.h +++ b/src/auryn/SpikingGroup.h @@ -61,11 +61,12 @@ class SpikingGroup /*! Stores the groupID gid of this group */ NeuronID unique_id; + unsigned int mpi_rank; + unsigned int mpi_size; + /*! Stores the current value of the gid count */ static NeuronID unique_id_count; - static std::vector reqs; - /*! Standard initialization of the object. */ void init(NeuronID size, double loadmultiplier, NeuronID total ); @@ -356,7 +357,9 @@ BOOST_SERIALIZATION_ASSUME_ABSTRACT(SpikingGroup) extern System * sys; extern Logger * logger; +#ifdef AURYN_CODE_USE_MPI extern mpi::communicator * mpicommunicator; +#endif // AURYN_CODE_USE_MPI inline NeuronID SpikingGroup::global2rank(NeuronID i) { diff --git a/src/auryn/SyncBuffer.cpp b/src/auryn/SyncBuffer.cpp index 3ca59906..676a683e 100644 --- a/src/auryn/SyncBuffer.cpp +++ b/src/auryn/SyncBuffer.cpp @@ -23,11 +23,12 @@ * Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 */ + #include "SyncBuffer.h" +#ifdef AURYN_CODE_USE_MPI using namespace auryn; - SyncBuffer::SyncBuffer( mpi::communicator * com ) { mpicom = com; @@ -387,3 +388,5 @@ void SyncBuffer::reset_sync_time() } #endif + +#endif // AURYN_CODE_USE_MPI diff --git a/src/auryn/SyncBuffer.h b/src/auryn/SyncBuffer.h index 9a3b13e4..22bfd5e1 100644 --- a/src/auryn/SyncBuffer.h +++ b/src/auryn/SyncBuffer.h @@ -23,9 +23,11 @@ * Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 */ + #ifndef SYNCBUFFER_H_ #define SYNCBUFFER_H_ + #define SYNCBUFFER_SIZE_MARGIN_MULTIPLIER 3 //!< Safety margin for receive buffer size -- a value of 3 should make overflows rare in AI state #define SYNCBUFFER_SIZE_HIST_LEN 512 //!< Accumulate history over this number of timesteps before updating the sendbuffer size in the absence of overflows @@ -43,6 +45,8 @@ #include +#ifdef AURYN_CODE_USE_MPI + namespace auryn { /*! \brief Buffer object to capsulate native MPI_Allgather for SpikingGroups @@ -56,7 +60,6 @@ namespace auryn { std::vector send_buf; std::vector recv_buf; - NeuronID overflow_value; SYNCBUFFER_DELTA_DATATYPE max_delta_size; @@ -126,4 +129,7 @@ namespace auryn { }; } +#endif // AURYN_CODE_USE_MPI + #endif /*SYNCBUFFER_H_*/ + diff --git a/src/auryn/System.cpp b/src/auryn/System.cpp index 9b1ba6c4..0387934c 100644 --- a/src/auryn/System.cpp +++ b/src/auryn/System.cpp @@ -29,6 +29,22 @@ using namespace auryn; void System::init() { + + + std::stringstream oss; + auryn::logger->msg("Starting Auryn Kernel",NOTIFICATION); + + oss << "Auryn version " + << build.get_version_string() + << " ( compiled " << __DATE__ << " " << __TIME__ << " )"; + auryn::logger->msg(oss.str(),NOTIFICATION); + + oss.str(""); + oss << "Git repository revision " + << build.git_describe; + auryn::logger->msg(oss.str(),NOTIFICATION); + + clock = 0; quiet = false; set_simulation_name("default"); @@ -47,23 +63,15 @@ void System::init() { mpi_size_ = 1; mpi_rank_ = 0; +#ifdef AURYN_CODE_USE_MPI syncbuffer = NULL; if ( mpicom ) { syncbuffer = new SyncBuffer(mpicom); mpi_size_ = mpicom->size(); mpi_rank_ = mpicom->rank(); } +#endif // AURYN_CODE_USE_MPI - std::stringstream oss; - oss << "Auryn version " - << build.get_version_string() - << " ( compiled " << __DATE__ << " " << __TIME__ << " )"; - auryn::logger->msg(oss.str(),NOTIFICATION); - - oss.str(""); - oss << "Git repository revision " - << build.git_describe; - auryn::logger->msg(oss.str(),NOTIFICATION); oss.str(""); oss << "NeuronID type has size of " @@ -105,23 +113,31 @@ void System::init() { auryn::logger->warning(oss.str()); #endif +#ifdef AURYN_CODE_USE_MPI + auryn::logger->msg("Auryn was compiled with MPI support.",NOTIFICATION); +#else + auryn::logger->msg("Auryn was compiled without MPI support.",NOTIFICATION); +#endif // AURYN_CODE_USE_MPI + auryn::logger->msg("Auryn Kernel started.",NOTIFICATION); } System::System() { - mpicom = NULL; init(); } +#ifdef AURYN_CODE_USE_MPI System::System(mpi::communicator * communicator) { + mpicom = communicator; init(); - std::stringstream oss; + auryn::logger->msg("Logging MPI status of this process...",NOTIFICATION); + std::stringstream oss; if ( mpi_size() > 1 ) { oss << "MPI run rank " << mpi_rank() << " out of " @@ -137,6 +153,7 @@ System::System(mpi::communicator * communicator) auryn::logger->msg(oss.str(),WARNING,true); } } +#endif // AURYN_CODE_USE_MPI System::~System() { @@ -159,8 +176,11 @@ void System::free() devices.clear(); checkers.clear(); - if ( mpicom ) + +#ifdef AURYN_CODE_USE_MPI + if ( syncbuffer != NULL ) delete syncbuffer; +#endif // AURYN_CODE_USE_MPI } void System::step() @@ -237,6 +257,8 @@ void System::register_checker(Checker * checker) void System::sync() { +#ifdef AURYN_CODE_USE_MPI + #ifdef CODE_COLLECT_SYNC_TIMING_STATS double T1, T2; T1 = MPI_Wtime(); /* start time */ @@ -261,6 +283,8 @@ void System::sync() T2 = MPI_Wtime(); /* end time */ deltaT += (T2-T1); #endif + +#endif // AURYN_CODE_USE_MPI } void System::evolve() @@ -385,13 +409,14 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, << "runtime=" << runtime << "s ) ..."; auryn::logger->msg(oss.str(),NOTIFICATION); - if ( clock == 0 && mpicom ) { // only show this once for clock==0 + if ( clock == 0 ) { // only show this once for clock==0 oss.str(""); oss << "On this rank: neurons_total="<< get_total_neurons() << ", effective_load=" << get_total_effective_load() << ", synapses_total=" << get_total_synapses(); auryn::logger->msg(oss.str(),SETTINGS); +#ifdef AURYN_CODE_USE_MPI if ( mpi_rank() == 0 ) { AurynLong all_ranks_total_neurons; reduce(*mpicom, get_total_neurons(), all_ranks_total_neurons, std::plus(), 0); @@ -407,11 +432,14 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, reduce(*mpicom, get_total_neurons(), std::plus(), 0); reduce(*mpicom, get_total_synapses(), std::plus(), 0); } +#endif // AURYN_CODE_USE_MPI } +#ifdef AURYN_CODE_USE_MPI #ifdef CODE_COLLECT_SYNC_TIMING_STATS syncbuffer->reset_sync_time(); #endif +#endif // AURYN_CODE_USE_MPI time_t t_sim_start; time(&t_sim_start); @@ -470,15 +498,19 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, step(); +#ifdef AURYN_CODE_USE_MPI if ( mpi_size()>1 && (get_clock())%(MINDELAY) == 0 ) { sync(); } +#endif // AURYN_CODE_USE_MPI + } #ifdef CODE_COLLECT_SYNC_TIMING_STATS +#ifdef AURYN_CODE_USE_MPI double elapsed = syncbuffer->get_elapsed_wall_time(); oss.str(""); @@ -489,6 +521,7 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, << " )"; auryn::logger->msg(oss.str(),NOTIFICATION); +#endif // AURYN_CODE_USE_MPI #else time_t t_now ; time(&t_now); @@ -509,6 +542,7 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, auryn::logger->msg(oss.str(),NOTIFICATION); +#ifdef AURYN_CODE_USE_MPI #ifdef CODE_COLLECT_SYNC_TIMING_STATS if (mpi_rank() == 0) { double minimum; @@ -533,7 +567,8 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, reduce(*mpicom, syncbuffer->get_sync_time(), mpi::minimum(), 0); reduce(*mpicom, syncbuffer->get_sync_time(), mpi::maximum(), 0); } -#endif +#endif // CODE_COLLECT_SYNC_TIMING_STATS +#endif // AURYN_CODE_USE_MPI return true; @@ -566,11 +601,12 @@ bool System::run_chunk(AurynFloat chunk_time, AurynFloat interval_start, AurynFl return run(interval_start/dt, stopclock, (interval_end-interval_start), checking); } - +#ifdef AURYN_CODE_USE_MPI mpi::communicator * System::get_com() { return mpicom; } +#endif // AURYN_CODE_USE_MPI void System::set_simulation_name(std::string name) { @@ -944,7 +980,9 @@ unsigned int System::get_synced_seed() { unsigned int value; if ( mpi_rank() == 0 ) value = get_seed(); +#ifdef AURYN_CODE_USE_MPI broadcast(*mpicom, value, 0); +#endif // AURYN_CODE_USE_MPI // std::cout << mpi_rank() << " " << value << std::endl; return value; } diff --git a/src/auryn/System.h b/src/auryn/System.h index 8bde08f2..654d7d9a 100644 --- a/src/auryn/System.h +++ b/src/auryn/System.h @@ -32,16 +32,18 @@ #include "Connection.h" #include "Device.h" #include "Checker.h" -#include "SyncBuffer.h" #include "AurynVersion.h" -#include +#ifdef AURYN_CODE_USE_MPI +#include +#include "SyncBuffer.h" +#endif //AURYN_CODE_USE_MPI +#include #include -#include -#include +#include #include #include #include @@ -67,15 +69,16 @@ namespace auryn { private: AurynTime clock; +#ifdef AURYN_CODE_USE_MPI mpi::communicator * mpicom; + SyncBuffer * syncbuffer; +#endif // AURYN_CODE_USE_MPI + unsigned int mpi_size_; unsigned int mpi_rank_; std::string simulation_name; - SyncBuffer * syncbuffer; - - std::vector spiking_groups; std::vector connections; std::vector devices; @@ -158,7 +161,9 @@ namespace auryn { /*! \brief Switch to turn output to quiet mode (no progress bar). */ System(); +#ifdef AURYN_CODE_USE_MPI System(mpi::communicator * communicator); +#endif // AURYN_CODE_USE_MPI /*! \brief Sets the simulation name. */ void set_simulation_name(std::string name); @@ -314,7 +319,9 @@ namespace auryn { /*! \brief Returns global mpi communicator */ +#ifdef AURYN_CODE_USE_MPI mpi::communicator * get_com(); +#endif // AURYN_CODE_USE_MPI /*! \brief Returns number of ranks * diff --git a/src/auryn/auryn_definitions.h b/src/auryn/auryn_definitions.h index cab09539..2d1e3b2e 100644 --- a/src/auryn/auryn_definitions.h +++ b/src/auryn/auryn_definitions.h @@ -26,42 +26,11 @@ #ifndef AURYN_DEFINITIONS_H_ #define AURYN_DEFINITIONS_H_ -#include -#include -#include -#include -#include -#include -#include -#include - - - -#ifndef CODE_ACTIVATE_CILK_INSTRUCTIONS -#include // SIMD intrinsics (pulls everything you need) -#else // XMM registers are not supported on the phi platform -#include // AVX only -#endif /* CODE_ACTIVATE_CILK_INSTRUCTIONS */ - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include "Logger.h" - - -namespace mpi = boost::mpi; +/*! Toggle between memory alignment for + * SIMD code. + */ +#define AURYN_CODE_USE_MPI /*! Toggle between memory alignment for @@ -117,6 +86,49 @@ namespace mpi = boost::mpi; // #define PRE_TRACE_MODEL LinearTrace + +//* -- Do not modify below -- *// + + +#include +#include +#include +#include +#include +#include +#include +#include + + + +#ifndef CODE_ACTIVATE_CILK_INSTRUCTIONS +#include // SIMD intrinsics (pulls everything you need) +#else // XMM registers are not supported on the phi platform +#include // AVX only +#endif /* CODE_ACTIVATE_CILK_INSTRUCTIONS */ + +#ifdef AURYN_CODE_USE_MPI +#include +namespace mpi = boost::mpi; +#endif + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "Logger.h" + + + + namespace auryn { /*! \brief Simulator wide integration time step */ diff --git a/src/auryn/auryn_global.cpp b/src/auryn/auryn_global.cpp index ac0c49b0..85cfa9a3 100644 --- a/src/auryn/auryn_global.cpp +++ b/src/auryn/auryn_global.cpp @@ -27,16 +27,25 @@ namespace auryn { + +#ifdef AURYN_CODE_USE_MPI mpi::communicator * mpicommunicator; mpi::environment * mpienv; +#endif // AURYN_CODE_USE_MPI + Logger * logger; System * sys; void auryn_init(int ac, char* av[], string dir, string simulation_name, string logfile_prefix ) { +#ifdef AURYN_CODE_USE_MPI // init MPI environment mpienv = new mpi::environment(ac, av); mpicommunicator = new mpi::communicator(); + const unsigned int local_rank = mpicommunicator->rank(); +#else + const unsigned int local_rank = 0; +#endif // AURYN_CODE_USE_MPI // Init logger environment try @@ -48,18 +57,22 @@ namespace auryn { if ( !logfile_prefix.empty() ) log_prefix_ = logfile_prefix; char strbuf_tmp [255]; - sprintf(strbuf_tmp, "%s/%s.%d.log", dir.c_str(), log_prefix_.c_str(), mpicommunicator->rank()); + sprintf(strbuf_tmp, "%s/%s.%d.log", dir.c_str(), log_prefix_.c_str(), local_rank); string auryn_simulation_logfile = strbuf_tmp; - logger = new Logger(auryn_simulation_logfile,mpicommunicator->rank(),PROGRESS,EVERYTHING); + logger = new Logger(auryn_simulation_logfile,local_rank,PROGRESS,EVERYTHING); } catch ( AurynOpenFileException excpt ) { std::cerr << "Cannot proceed without log file. Exiting all ranks ..." << std::endl; - mpienv->abort(1); + auryn_abort(10); } // Init Auryn Kernel +#ifdef AURYN_CODE_USE_MPI auryn::sys = new System(mpicommunicator); +#else + auryn::sys = new System(); +#endif // AURYN_CODE_USE_MPI sys->set_output_dir(dir); sys->set_simulation_name(simulation_name); } @@ -68,15 +81,19 @@ namespace auryn { { delete sys; delete logger; +#ifdef AURYN_CODE_USE_MPI delete mpicommunicator; delete mpienv; +#endif // AURYN_CODE_USE_MPI } void auryn_abort(int errcode) { delete sys; delete logger; +#ifdef AURYN_CODE_USE_MPI mpienv->abort(errcode); - // The above line should have killed this process by now, but just in case .. +#endif // AURYN_CODE_USE_MPI + // In the MPI case the above line should have killed this process already ... std::exit(errcode); } } diff --git a/src/auryn/auryn_global.h b/src/auryn/auryn_global.h index c2ea9cd9..464c9e71 100644 --- a/src/auryn/auryn_global.h +++ b/src/auryn/auryn_global.h @@ -27,7 +27,7 @@ #define AURYN_GLOBAL_H_ #include - +#include "auryn_definitions.h" #include "Logger.h" #include "System.h" @@ -41,11 +41,13 @@ namespace auryn { /*! \brief Global pointer to instance of Logger which needs to be initialized in every simulation main program. */ extern Logger * logger; +#ifdef AURYN_CODE_USE_MPI /*! \brief Global pointer to instance of mpi::environment which needs to be initialized in every simulation main program. */ extern mpi::environment * mpienv; /*! \brief Global pointer to instance of mpi::mpicommunicator which needs to be initialized in every simulation main program. */ extern mpi::communicator * mpicommunicator; +#endif // AURYN_CODE_USE_MPI /*! \brief Initalizes MPI and the Auryn simulation environment. From 1d814c97beeaa40414a62a88c234160e74d95a68 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 12:46:21 -0700 Subject: [PATCH 43/77] Fixes bug introduced by last commit --- src/auryn/SpikingGroup.cpp | 11 ++++++++--- src/auryn/System.cpp | 13 +++++++------ src/auryn/System.h | 6 ++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/auryn/SpikingGroup.cpp b/src/auryn/SpikingGroup.cpp index 0e2e20ea..64733ad4 100644 --- a/src/auryn/SpikingGroup.cpp +++ b/src/auryn/SpikingGroup.cpp @@ -65,14 +65,19 @@ void SpikingGroup::init(NeuronID n, double loadmultiplier, NeuronID total ) // setting up default values evolve_locally_bool = true; - locked_rank = 0; + + // can't import System in this abstract base class, + // so have to define these quantities localy #ifdef AURYN_CODE_USE_MPI - locked_range = mpi_size; + mpi_size = auryn::mpicommunicator->size(); + mpi_rank = auryn::mpicommunicator->rank(); #else mpi_size = 1; mpi_rank = 0; - locked_range = mpi_size; #endif // AURYN_CODE_USE_MPI + + locked_rank = 0; + locked_range = mpi_size; rank_size = calculate_rank_size(); // set the rank size double fraction = (double)calculate_rank_size(0)*effective_load_multiplier/DEFAULT_MINDISTRIBUTEDSIZE; diff --git a/src/auryn/System.cpp b/src/auryn/System.cpp index 0387934c..c73e02e9 100644 --- a/src/auryn/System.cpp +++ b/src/auryn/System.cpp @@ -119,14 +119,9 @@ void System::init() { auryn::logger->msg("Auryn was compiled without MPI support.",NOTIFICATION); #endif // AURYN_CODE_USE_MPI - auryn::logger->msg("Auryn Kernel started.",NOTIFICATION); } -System::System() -{ - init(); -} #ifdef AURYN_CODE_USE_MPI System::System(mpi::communicator * communicator) @@ -135,7 +130,6 @@ System::System(mpi::communicator * communicator) mpicom = communicator; init(); - auryn::logger->msg("Logging MPI status of this process...",NOTIFICATION); std::stringstream oss; if ( mpi_size() > 1 ) { @@ -143,6 +137,8 @@ System::System(mpi::communicator * communicator) << mpi_rank() << " out of " << mpi_size() << " ranks total."; auryn::logger->msg(oss.str(),NOTIFICATION); + } else { + auryn::logger->msg("Not running a parallel simulation.",NOTIFICATION); } if ( mpi_size() > 0 && (mpi_size() & (mpi_size()-1)) ) { @@ -153,6 +149,11 @@ System::System(mpi::communicator * communicator) auryn::logger->msg(oss.str(),WARNING,true); } } +#else +System::System() +{ + init(); +} #endif // AURYN_CODE_USE_MPI System::~System() diff --git a/src/auryn/System.h b/src/auryn/System.h index 654d7d9a..d2bce7c6 100644 --- a/src/auryn/System.h +++ b/src/auryn/System.h @@ -159,10 +159,12 @@ namespace auryn { /*! \brief The progressbar update interval in timesteps of dt. */ unsigned int progressbar_update_interval; - /*! \brief Switch to turn output to quiet mode (no progress bar). */ - System(); #ifdef AURYN_CODE_USE_MPI + /*! \brief Default constructor for MPI enabled. */ System(mpi::communicator * communicator); +#else + /*! \brief Default constructor for MPI disabled. */ + System(); #endif // AURYN_CODE_USE_MPI /*! \brief Sets the simulation name. */ From a74b81cf08187e24eb2bff5edee5784897ec31e4 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 12:58:08 -0700 Subject: [PATCH 44/77] Comments out code for the dynamic library --- src/CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5fcbc60d..367cda8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,16 +6,17 @@ ADD_LIBRARY( auryn STATIC ${auryn_SRC} ) TARGET_LINK_LIBRARIES( auryn ${MPI_CXX_LIBRARIES} ${Boost_LIBRARIES}) TARGET_INCLUDE_DIRECTORIES( auryn PUBLIC ${Boost_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH}) -# Add dynamic library -ADD_LIBRARY( auryn_shared SHARED ${auryn_SRC} ) -SET_TARGET_PROPERTIES(auryn_shared PROPERTIES OUTPUT_NAME auryn) -TARGET_LINK_LIBRARIES( auryn_shared ${MPI_CXX_LIBRARIES} ${Boost_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES( auryn_shared PUBLIC ${Boost_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH}) - - INSTALL(TARGETS auryn LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -INSTALL(TARGETS auryn_shared DESTINATION lib) INSTALL(FILES auryn.h DESTINATION include) INSTALL(DIRECTORY auryn DESTINATION include FILES_MATCHING PATTERN "*.h") + +# Uncomment the following lines to also compile a dynamic library +# ADD_LIBRARY( auryn_shared SHARED ${auryn_SRC} ) +# SET_TARGET_PROPERTIES(auryn_shared PROPERTIES OUTPUT_NAME auryn) +# TARGET_LINK_LIBRARIES( auryn_shared ${MPI_CXX_LIBRARIES} ${Boost_LIBRARIES}) +# TARGET_INCLUDE_DIRECTORIES( auryn_shared PUBLIC ${Boost_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH}) +# INSTALL(TARGETS auryn_shared DESTINATION lib) + + From 62f24e46438d1c8663f434f02e3745186dfc124b Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:24:15 -0700 Subject: [PATCH 45/77] Changes file output in benchmark script --- build/release/run_benchmark.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/release/run_benchmark.sh b/build/release/run_benchmark.sh index a65a59ca..3aee7af5 100755 --- a/build/release/run_benchmark.sh +++ b/build/release/run_benchmark.sh @@ -10,7 +10,8 @@ SIMTIME=100 STATRUNS="1 2 3 4 5" HOSTNAME=`hostname` DATE=`date +"%Y-%m-%d"` -REVISION=`git log --pretty=oneline -1 | cut -d " " -f 1` +# REVISION=`git log --pretty=oneline -1 | cut -d " " -f 1` +REVISION=`git describe` TMPDIR=`mktemp -d` # Function declaration From e050e3df01ee7de6e24547a9451ae02292475683 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:37:11 -0700 Subject: [PATCH 46/77] Updates ChangeLog to shortlog --- ChangeLog | 1097 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 1054 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index a616e531..13a39f21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,47 +1,1058 @@ -2015-07-01 Friedemann Zenke - * Added PairInteractionConnection to implement arbitrary (pairwise) - STDP windows - * Added backend to implement current based synapses with temporal dynamics - * Added code to stimulate with currents generated from a Wiener process - (NormalStimulator) - * Added the AdEx neuron model - * Added the SIFGroup neuron model - * Implemented load/save to netstate files of Checkers - * Changed backend of WeightMonitor to avoid segfaults after loading the - network state - * Implementation of moving average for progress bar moved - to System class to disambiguate from Checkers - * Fixed some problems in ComplexMatrix - * Bug fixes +Ankur Sinha (Ankur Sinha Gmail) (13): + A functional makefile with a Fedora specific flags. Can probably be improved, but it works for the time being. + Added WeightStatsMonitor as a copy of WeightSumMonitor + Add a BinarySpikeMonitor + Change AurynTime to AurynDouble. + Updated gitignore to include autotoolised files and so on. + Separate R and C in TIF + Added aEIF (adaptive exponential) to auryn. + Updated AdEx to use natural units. + Forgot to add e_thr method body. + Bugfix in AdEx + Update gitignore to ignore temporary cmake build files. + Added a travis file. + Added refractory period functionality to AdEx. -2015-02-06 Friedemann Zenke - * SpikingGroups and Connections are now serializeable and as a consequence - the network state can be saved to a single file per rank. - * SimpleMatrix has been replaced by ComplexMatrix which creates the - basis for the implementation of connection models with multiple - internal synaptic states. - * Basis for Monitors writing to binary files for increased performance was - created (e.g. BinarySpikeMonitor). - * Auryn compiles to a statically linkable library per default now, which - facilitates to decouple simulation code from simulator code. * A simplified - STDPConnection was added along with a tutorial of how to implement own new - plasticity and synapse models. - * Adds integrate-and-fire model for exclusive use with current based synapses - (CubaIFGroup). - * Adds an example simulation for short-term-plasticity (STPConnection). - * Improves doxygen strings and comments in various places. - * Diverse bugfixes. +Emre Neftci (3): + Added PaitInteraction from develop and corrected update transmit bug + Adds NormalStimulator (Wiener process) + Adds SIFGroup -2014-02-21 Friedemann Zenke - * Adds new example code for Brunel 2000 balanced network - * Applies diverse bugfixes +Friedemann Zenke (1026): + Initial commit in prepartion for release + Updates README for release + Applies diverse bugfixes + Changes seed in sim_coba_benchmark + Renames sim to examples + Minor bugfixes + Removes hostfile + Adds subdir dev to gitignore + Adds the Brunel 2000 network as example + Adds main changes + Adapts Makefile system to new dev submodule + Adds empty directory for doxygen files + Increases STDP learning rate in example + Merge branch 'master' of github.com:fzenke/auryn + Fixes topos in README.md + Adds exception handler in SparseConnection + Small optimization change to SparseConnection + Small reformulation in SimpleMatrix + Updates a comment in SpikingGroup + Performance optimizations in StimulusGroup + Renames extension in RateModulatedConnection + Fixes bug in IF2Group + Updates test_sync + Adds functionality to StimulusGroup + Fixes bug in progressbar in System + Adds setter set_eta to RateModulatedConnection + Changes unit of interval in WeightSumMonitor + Exchanges const char * arguments by string + Changes algorithm in StimulusGroup + Proposes a fix SparseConnection + Changes SimpleMatrix and SparseConnection + Minor change to SparseConnection + Fixes a bug in SparseConnection + Fixes bug in SparseConnection + Fixes bug in DuplexConnection + Updates debug Makefile + Changes stimtime format in StimulusGroup + Applies a set of improvements to StimulusGroup + Reimplements workaround for 0-rate in PoissonGroup + Adds first revision of RateMonitor + Fixes include guards in RateMonitor + Updates doxygen strings in RateMonitor + Fixes quiet mode in System class + Adapts WeightMatrixMonitor to string conform filename + Updates version number + Adds functionality to SpikingGroup + Fixes a typo in comment + Fixes problem in SparseConnection + Fixes bug in new scale function + Adds logging output + Adds a new setter to StimulusGroup + Adds new mode to StimulusGroup + Minor improvement in SparseConnection + Removes debugging output in StimulusGroup.cpp + Adds seeding mechanism for StimulusGroup + Fixes a problem with the random number generation + Fixes a bug in StimulusGroup + Initial commit of new WeightPatternMonitor + Adds monitoring for asymmetric patterns to WeightPatternMonitor + Implements quick and dirty fix for StimulusGroup + Adds doxygen string to WeightPatternMonitor + Updates doxygen string in SpikingGroup + Adds new functionality to WeightPatternMonitor + Fixes problem in WeightPatternMonitor + Adapts filenames in constructor to be of type string + Adds first revision of RealTimeMonitor + Merge branch 'master' into devel + Improvements to RealTimeMonitor + Merge branch 'master' into devel + Adds setter for refractory period to TIFGroup + Tentative changes to interpolation procedure + Adds setter for state vectors in NeuronGroup + Bugfix in VoltageMonitor + Change to RateChecker + Fixes bug in set_state function in SpikingGroup + Changes scope of variable in SparseConnection + Fixes problem in StateMonitor + Fixes a bug in localrank function in SpikingGroup + Decreases MINDISTRIBUTEDSIZE to 16 + Fixes two occasions of mismatched use of use of delete + Minor changes to SparseConnection + Removes prune functions in sim_brunel2k_pl + Minor fix in DuplexConnection + Adds units description to sim_coba_benchmark + Adds new example sim_bg_static + Fixes a conversion problem in sim_bg_static + Bugfixes to examples + Replaces GSL libraries by internal ones + Fixes small cosemtic issue in SIMD code + Removes GSL linker directives from Makefile + Change time format in progress bar + Implements new indexing functions + Updates prefetching logic + Replaces types in STDPConnection + Replaces C datatypes by AurynDatatypes + Sets generic AurynTypes + Adds debug msgs to SparseConnection and DuplexConnection + Changes default sampling interval to dt + Advances version number in Doxyfile + Removes spurious mother objects + Updates doxygen string in StateMonitor + Adds first revision of CubaIFGroup + Removes -Wall in standard makefile + Adds setter for all bg_currents in CubaIFGroup + Adds doxygen strings to STPConnection + Merge branch 'master' into Cuba + Adds example for STPConnection + Adds comment strings to sim_epsp_stp + Changes stimulation protocol + Finalizes STP example + Removes GSL requirements + Fixes division by zero bug + Fixes problem with negative weights + Removes unecessary libraries from debug Makefile + Adds docstrings to TripletConnection + Updates ChangeLog + Changes logging output in StimulusGroup + Fixes docstrings in SpikingGroup + Merge branch 'master' of https://github.com/fzenke/auryn + Merge branch 'master' of https://github.com/fzenke/auryn + Removes ISPS from EPSP example sim + Adds basics for GROUP recording mode + Extends functionality of WeightMonitor + Fixes a bug in the GROUP implementation + Removes ISPS from EPSP example sim + Updates Makefile for build/home + Merge branch 'master' of https://github.com/fzenke/auryn + Fixes problem in WeightPatternMonitor + Removes unneeded include statements from examples + Adds stopping time to VoltageMonitor + Adds new recording mode to WeightMonitor + Adds new functionality to StimulusGroup + Merge branch 'master' of https://github.com/fzenke/auryn + Removes doc/README + Adds a dummy file to keep doc dir open + Merge pull request #3 from sanjayankur31/weightstatsmonitor + Fixes confusion in WeightSumMonitor + Implements missing function in IdentityConnection + Adds primitive build target lib to create a static linkable library of auryn + Merge pull request #2 from sanjayankur31/makefile_change + Fixes broken library name + Creates auryn.h to simplify includes in simulations + Implements first example which uses auryn.h + Updates the files in auryn.h + Updates all examples to use auryn.h + Adds citation to paper reference to file headers + Updates README.md + Functional modification to StimulusGroup + Merge branch 'master' of https://github.com/fzenke/auryn + Fixes bug in StimulusGroup + Adds exception handler to SparseConnection + Adds first revision of ProfilePoissonGroup + Changes to AuditoryBeepGroup + Changes to ProfilePoissonGroup + Adds docstrings to SyncBuffer.h + Updates Makefile.include for lib target + Fixes problem in AuditoryBeepGroup + Adds time estimate to MARK output in logger + Cleans up Makefile and fixes #4 + Implements refractoriness in StimulusGroup + Fixes bug in set_distribution(x) in StimulusGroup + Merge branch 'master' of https://github.com/fzenke/auryn + Adds small logo to README.md + Adds first stub of a prototype for ComplexMatrix + Fixes bug in Makefile logic + Moves SimpleMatrix to header file + Adds getter for data + Adapts to more humand readable coding style + Updates Makefile + Adds simple STDPConnection + Adds forgotten files to last commit + Fixes bug in TIFGroup + Changes API of ComplexMatrix + Introduces ComplexMatrix into SparseConnection + Fixes multiple bugs in ComplexMatrix + Redefines API of ComplexMatrix + Fixes a bug in ComplexMatrix + Adds example application for ComplexMatrix + Fixes problem in constructor: LPTripletConnection + Implements serialization in ComplexMatrix + Updates docstring LPTripletConnection + Fixes yet another bug in ComplexMatrix + Implements new save/load mechanism in System + Refines save/load in SpikeDelay + Implements save/load in SpikingGroup + Adds finalize to load connections in System + Fixes bug in save/load of SpikingGroup + Adds refractoriness to TIFGroup save/load + Conservative load/save for SpikeDelay + Pretty serialize in SpikeDelay + Switches to binary archives + Updates serialze in SpikeDelay + Updates sim_isp_orig with new load/save code + Turns off timing stats per default + Merge branch 'master' of https://github.com/fzenke/auryn + Fixes bug in ComplexMatrix + Merge branch 'sanjayankur31-binaryspikemonitor' + Adds BinarySpikeMonitor to auryn.h + Virtualizes open file mechanism in Monitor class + Updates date in copyright note + Changes Auryn version + Merge pull request #8 from sanjayankur31/spikeEvent-fix + Fixes doxygen string in CubaIFGroup + Fixes faulty comment in CubaIFGroup + Merge branch 'master' of https://github.com/fzenke/auryn + Updates version number + Adds functionality to AuditoryBeebGroup + Updates AUTHORS file + Updates README + Updates version number in Doxyfile + Updates doxystring in auryn_definitions + Merge branch 'master' of https://github.com/fzenke/auryn + Merge pull request #10 from sanjayankur31/gitignore-update + Merge pull request #11 from sanjayankur31/TIF-rc + Merge branch 'master' of https://github.com/fzenke/auryn + Adds PairInteractionConnection + Implements backend for current based synapses + Adds memo/comment to PatternStimulator code + Minor comment changes to SIFGroup + Updates new contributors in AUTHORS + Fixes typo bug which prevented compilation + Fixes bug in load/save of SIFGroup + Merge branch 'AdEx' of https://github.com/sanjayankur31/auryn into sanjayankur31-AdEx + Merges asinha's AdEx implementation + Merge branch 'develop' into sanjayankur31-AdEx + Removes previous version of the AdEx class + Merge branch 'sanjayankur31-AdEx' into develop + Retabs AdExGroup for conformity + Updates copyright notice in AdExGroup and SIFGroup + Fixes bug in AdEx spike threshold + Adds comment to AdEx on future directions + Merge pull request #15 from sanjayankur31/AdEx2 + Merge pull request #16 from sanjayankur31/AdEx-bugfix + Improves error handling in load_netstate in System + Merge branch 'master' into develop + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Merge branch 'master' of https://github.com/fzenke/auryn + Adds docstring to ProfilePoissonGroup + Merge branch 'master' into develop + Adds variable STDP time constants to STDPConnection + Adds docstring to TripletConnection.h + Merge branch 'dev_stdp' into develop + Implements load/save for Checkers + Adaptes TripletConnection to new load/save + Merge branch 'hotfix_checker_docs' into develop + Implements load/save for Checkers + Changes backend of WeightMonitor + Reduces number recorded weights in sim_background + Implements a moving average for progress bar + Merge branch dev_online_rate_monitor into develop + Fixes docstring + Merge branch 'hotfix_docu_triplet' into develop + First implementation for statetraces + Fixes docstring + Grammer fix in doxystring + Merge branch 'master' into develop + Removes IF2Group + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Updates doc strings in sources + Merge branch 'dev-update-triplet-doc' into develop + Merge branch 'develop' into dev-state-traces + Updates ChangeLog + Updates changelog + Merge branch 'release-v0.6' + Merge branch 'develop' into dev-state-traces + Merge branch 'master' into dev-state-traces + Adds safety checks to spars_connection function + Implements load/save for Monitors + Adds Generic Exception + Catches a potential problem in WeightMonitor + Merge branch 'hotfix-weightmon-bugfix' + Adds Generic Exception + Implements load/save for Monitors + Merge branch 'develop' into dev-state-traces + Adds load/save to PopulationRateMonitor + De-escalates some logger messages to DEBUG + Adds indent for parameters in Logger + Changes logger string in SpikingGroup + Updates logger string in SparseConnection + Merge branch 'dev-monitor-netstate' into develop + Merge branch 'develop' into dev-state-traces + Updates AurynGeneralException message + Merge branch 'develop' into dev-state-traces + Reformats logger output in System.cpp + Adds DEBUG output to SpikingGroup + Fixes bug in NeuronGroup + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Removes dependency of IF2Group + Fixes unsigned comparison warning + Adds CMakeLists and moves test files + Fixes problem in CMakeLists + Removes autotools files from .gitignore + Adds Docstrings to SpikeMonitor + Merge branch 'develop' into feature-cmake + Updates doxystring in SpikeMonitor + Doxystring update SpikeMonitor + Doxystring update SpikeMonitor + Updates doxystring in SpikeMonitor + Adds Docstrings to SpikeMonitor + Moves SimpleMatrix to header file + Update version number + Merge branch 'develop' into feature-cmake + Changes to make BinarySpikeMon more style conform + Merge branch 'develop' into feature-cmake + Updates CMakeLists minimum Boost version + Minimizes text output in CMakeLists.txt + Updates version number + Merge branch 'develop' into feature-cmake + Merge branch 'origin/feature-cmake' into develop + Undos changes to gitignore and adds email t travis + Merge branch 'sanjayankur31-travis' into develop + Makes refractory period explicit in example + Hotfix: Adds AdExGroup.h to auryn.h + Merge branch 'develop' into dev-state-traces + Replaces DEBUG logger messages type by VERBOSE + Undoes change to AdEx in sim_isp_orig + Fixes a bug in the state trace mechanism + Bumps version number + Bumps subversion number + Refines versioning system + Adds checks of num ranks and version when loading + Adds feature verify-version-on-load + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Disables RateChecker in coba_benchmark + Adds debugging C flags to cmake conf + Removes excessive recording from coba_benchmark + Removes initial MPI messaging from runtime measurement + Removes variable for ampa reversal potential + Adds a warning message to sim_coba_benchmark + Start time measurement after logger message + Undoes erroneous changes in System run + Removes offset and output in SpikeMonitor + Replaces output-format by sprintf in StateMonitor + Removes sanity check from sim_coba_benchmark + Caches current_time in BinarySpikeMonitor + Update README.md + Adds first revision of Auryn Binary extractor abe + Adds small fix + Changes SpikeEvent format and adds CMakeLists + Adds binary search (still buggy) + Merge branch 'feature-tool-abe' + Implements binary search ab + Merge branch 'feature-tool-abe' of ssh://eggplant.stanford.edu/home/zenke/auryn into feature-tool-abe + Fixes bugs + Adds maxid command line property + Fixes bug and renames end to "to" + Adds version checking to abe + Adds abe to main CMakeLists file + Adds version control to abe and BinarySpikeMonitor + Adds title to options + Adds version information + Implements file merging at abe-tool level. + Fixes timing bugs in abe-tool + Fixes eof issue in abe which caused hang-ups + Merge branch 'feature-tool-abe' into develop + Adds example for BinarySpikeMonitor + Changes program name to aube + Fixes bug in last_time in aube + Updates doxystrings in SpikingGroup + Fixes bug in aube-tool + Fixes a memory free problem in EulerTrace + Adds an alternative mode of operation + Adds additional debugging output + Updates some doxystrings + Ensures new statevectors are initialized all 0 + Changes logger string + Fixes severe bug in ComplexMatrix + Merge branch 'master' into develop + Hotfix. Fixes bug in VoltageMonitor + Merge branch 'master' into develop + Fixes another bug in aube + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Removes unecessary check in VoltageMonitor + Implements e_reset voltage parameter + Fixes problem in oll tadd function + Adds limited complex synapse support to WeightMonitor + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Improvements to aube command line parameters + Fixes bug in WeightMonitor + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Adds stop_time mechanisms to Voltage and StateMonitor + Adds set_bg_currents method to TIFGroup + Adds default values to random_mem + Adds CurrentStimulator + Updates doxystrings and changes constructor + Changes name to CurrentInjector + Resets initial default current + Fixes bug and makes current dt invariant + Updates doxystring + Adds scaling variable alpha + Adds z variable to compute_reverse_matrix + Renames function name in aube.cpp + Bugfix in StateMonitor + Merge pull request #22 from sanjayankur31/adex-refractory + Bugfix in StateMonitor + Fixes stop time mechanism in StateMonitor + Adds some more doxystrings to auryn_definitions + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Adds record_for x seconds function to two Monitors + Adds note to auryn_definitions + Moves state traces from NeuronGroup to SpikingGroup + Fixes type of error message + Merge branch 'feature-move-state-traces' into develop + Removes stochasticity from StructPoisson + Adds additional seeding mechanism + Removes active switch from monitor + Fixes problem introduced with last rebase + Fixes typos in log messages + Adds an add_state_vector function to SpikingGroup + Adds new functionality to SpikingGroup + Adds doxystrings to SpikeDelay + Improvement to FileInputGroup + Adds tadd for state vectors to NeuronGroup + Adds new set_transmitter function to Connection + Adds new auryn vector subtract operation + Changes source type for StateMonitor + Adds seeding mechanisms to example + Fixes bias in generation of sparse matrices + Adds missing seed mechanisms to sim_poisson + Fixes small bias in firing rate + Initializes stop time per default to 10s + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Removes accidentally added write_to_file command + Adds multiple doxystrings + More doxystrings in SparseConnection + Adds doxystrings to Connection.h + Bumps version number and adds logo to doc + Switches to STL support in Doxyfile + Introduces and auryn namespace + Changes to progressbar in System + Fixes to tool/aube + Merge branch 'master' of https://github.com/fzenke/auryn + Merge branch 'master' into develop + Merge branch 'master' into release-v0.7 + Fixes to tool/aube + Adds cflag to CMakeLists + Adds novel set_transmitter implementation + Adds a remove_state_vector function to SpikingGroup + Adds more liberal set_profile function to ProfilePoissonGroup + Adds last_stimulus_stime StimulusGroup + Small improvement to rand_data in SparseConnection + Adds WeichtChecker and closes #9 + Changes doxystrings in Matrix classes + Hotfix for stats function in SparseConnection + Hotfix for stats function in SparseConnection + Hotfix for stats function in SparseConnection + Merge branch 'feature_weightchecker' into develop + Merge branch remote 'release-v0.7' + Bumps version number to next subversion + Merge branch 'develop' into feature-current-injector + Bumps version number for doxygen docs + Adds clip function for matrix states + Adds meaningful exception for open file error + Introduces Logger exception handling in examples + Adds meaningful exception for open file error + Introduces Logger exception handling in examples + Merge branch 'master' of https://github.com/fzenke/auryn + Merge branch 'release-v0.7' + Updates README.md with quick compile instructions + Fixes version number to last stable version number + Reduces log-level in example sim_poisson + Changes warning output text in aube + Implements more convenient spike attribg handling + Fixes potential bug in localrank in SpikingGroup + Changes strategy for registering Connections + Changes to register procedure of this group + Fixes a problem with spike_attribute buffer + Adds brief doxystring to class + Changes doxystrings in LinearTrace and EulerTrace + Adds doxystring to AIF2Group + Adds and updates doxystrings + Fixes bug in spike attribute reset in SyncBuffer + Adds debug code back in with precompile switch + Adds function to read out send buffer size + Removes deprecated comment line + Remove DEBUG flag + Removes uneeded variable in SyncBuffer + API change swaps argument order in get_post_state_trace + Adds new Trace constructor to StateMonitor + Changes to StimulusGroup interace + Adds new random initializer to SparseConnection + Initial commit of MovingBumpGroup + Changes loglevel for a message in ProfilePoissonGroup + Bugfixes to MovingBumpGroup + Updates logmessage in SpikingGroup + Adds some setters to MovingBumpGroup + Adds setter for duration to MovingBumpGroup + Merge branch 'feature-moving-bump' into develop + Changes to SparseConnection + Adds setter for tau thr in IFGroup + Modifcation to SparseConnection + Merge branch 'develop' of origin + Improves SparseConnection + Undoes earlier commit and reverts to 5 sigma in SparseConnection + Adds function to ComplexMatrix + Generalizes ComplexMatrix + Changes interface for stats in Connection + Changes to access rights in StimulusGroup + Changes access rights to ttl in StimulusGroup + Adds filename formating function to System + Adds an "active" member to Monitor + Updates new filename function in System + Fixes typo + Adds a warning to SparseConnection + Improves ProfilePoissonGroup + Testing new .travis.yml + Updates copyright notice year + Changes to trusty travis ci build environment + Updates .travis.yml to openmpi + Merge branch 'master' into testdev + Cleans up travis ci config .travis.yml + Adds sim_current_stim.cpp example + Fixes to current stim example + Adds NormalStimulator to auryn.h + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Adds SIFGroup to auryn.h + Updates copyright notice dates in examples + Updates doxystrings in TIFGroup + Merge branch 'master' into tmp + Updates doxystring in BinarySpikeMonitor.h + Fixes logger output string + Extends functions to complex matrix elements + Changes logger message + Adds TripletScalingConnection and sim_bg_scaling example + Removes hardcoded unneeded strings + Fixes minimum version number in CMakeLists.txt + Fixes minimum version number in CMakeLists.txt + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Changes cmake macro in examples + Modifications to VoltageMonitor + Adds verbose logger output to save netstate + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Changes bras extension to spk + Adds function to StimulusGroup + Implements compression feature in StateMonitor + Small fixes in StateMonitor + Fixes init bug in StateMonitor + Adds bootstrap file for build + Changes ras extension to spk + Merge branch 'master' of github + Updates aube command line help + Updates aube command line help + Adds AurynVector class to replace auryn_vector_float + Implements some class functions in AurynVector + Fixes bug in AurynVector + Includes AurynVector class separately + Moves code from AurynVector to auryn_definitions + Changes doc strings + Swichtes to member methods for scale in IFGroup + Switches to member scale + Implements template functions in auryn_definitions + Adds zero init to AurynVector + Changes to AurynVector member functions + Fixes bug in AurynVector debug code + Fixes small bug in system + Fixes small bug in Connection + Fixes small bug in Connection + Fixes small bug in system + Overloads ptr function of AurynVector + Adds a example bootstrap file for debugging + Adds use of new get_log_name function in Connection + Adds new get_log_name function + Removes unused variable + Implements new get_log_name function + Removes CC bug + Adds example release bootstrap script + Moves example bootstrap files + Starts replacing legacy code in SpikingGroup and IFGroup + Moves AurynVector template to its own file + Merges feature branch for new AurynVector template + Updates readme to point to the new bootstrap file + Updates doxystring + Updates Travis script + Merge github branch 'develop' + Adds feature to System + Adds elapsed time output to sim_coba_benchmark + Adds verbose CLI switch to sim_background + Fixes acess rights of new function in System + Adds benchmarking code + Fixes probelm in benchmark extensions + Adds feature that saves the hostname in benchmark + Adds features to save last benchmark result + Adds coba test script + Merge branch 'develop' + Adds datetime column to benchmark output + Manual cherry picking of benchmarking from develop + Adds benchmarking code + Merge branch 'master' + Fixes probelm in benchmark extensions + Fixes problem in System + Updates doxystrings and aligns data ptr + Adds interface for some helper functions in auryn_definitions + Implements AurynVectorFloat as class + Corrects datatypes in AurynVectorFloat + Inlines some intriscs in AurynVector and legacy code + Adds comment to auryn_definitions.h + Adds optimized vector addition in SIMD to AurynVector.h + Adapts IFGroup to new AurynVector member routines + Adds comment to AurynVector with TODO + Replaces legacy functions in EulerTrace + Adds check for AVX2 in System + Introduces AurynStateVector as default state vector for float types + Gets rid of a bunch of functions in NeuronGroup + Removes NMDA Monitor + Adds function to AurynVector and fixes a bug + Adds unit specific add to AurynVector + Removes AmpaMonitor now replaced by StateMonitor + Bumps Auryn version number to 0.8 + Adds new logger message functions + Removes state getters and setters from NeuronGroup + Removes state getters and setters from NeuronGroup + Merge branch 'develop' of + Adds note in StateMonitor + Bumps version number in Doxyfile + Updates doxystring in AurynVector.h + Updates doxystring in AurynVector + Adds coba test for reproducibility comparison + Fixes test routines + Updates make call in test routines + Adds test routine to travis script + Virtualizes multiple member functions of AurynVector + Fixes problem in new travis file + Forgot to add test script + Adds debug output to test script to debug travis + Updates hashing code in test routines + Merge branch 'develop' of fzenke.net/var/git/auryn + Updates test routines to avoid fast-math compiled code + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Removes test routines from travis + Adds build code for debug build + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Adds the test again + Adds plot benchmark script + Switches to histogram style in plot_benchmark_results.gnu + Adds destructor to AurynVectorFloat + Makes destructor virtual in AurynVector + Adds flush to file function to Monitor + Fixes bug in EulerTrace + Adds getter for number of z-states in ComplexMatrix + Adds logstrings + Small change to load netstate in SpikingGroup + Adds debugging output with CLI switch to aube + Changes access rights for member of StimulusGroup + Changes debugging output + Changes function type in AurynVector + Adds a very simple CubaIFGroup + Adds IafPscExpGroup and restores previous CubaIFGroup + Changes src and dst to public in Connection + Adds new output function debug to Logger + Adds log level info + Minor edits to EulerTrace + Adds logger output to StateMonitor + Adds functionality that to state traces + Docstring + Adds debugging active warning to log + Adds a reference to a target state vector + Updates docstring + Adds flush to file for monitors to System + Changes access rights in SpikeMonitor + Adds a function to StimulusGroup which can be used by groups inheriting from it. + Preps Connection.h for removal of target pointer + Fixes instructions in README.md + Updates doxygen strings in System + Updates doxystrings in SpikingGroup.h + Updates doxystrings in header files + Adds doxystring + Updates doxystring + Removes GabaMonitor because it is superseded by StateMonitor + Updates doxystrings + Initial commit for spike delta based SyncBuffer + Version compiles now, but still introduces spurious spikes + Small changes in SyncBuffer + Adds print function to SpikeDelay + Fixes bug in SyncBuffer implementation + Improves print function in SpikeDelay.cpp + Changes logger output in System.h + Adds overflow managements for very large deltas in SyncBuffer + Adds check for bytesize of NeuronID and AurynFloat + Fixes bug in SpikeMonitor + Adds log messages for size of datatypes to System + Adds overflow mechanism to SyncBuffer + Adds logger output to System + Makes Delta datatype in SyncBuffer configurable + Fixes overflow management in SyncBuffer + More robust implementation of pop in SyncBuffer + Small changes + Rollback to original SyncBuffer + Solves problems of leaking spikes in SyncBuffer + Revert "Rollback to original SyncBuffer" + Merge branch 'feature-syncbuffer' into develop + Comments out sort function in SyncBuffer + Updates test scripts + Changes privacy of function in SyncBuffer + Experimentall changes delta data type to int + Uses non-negative delta values in SyncBuffer now + Adds warning about SyncBuffer delta datatype in SpikingGroup + Changes order of logger output in System + Changes bug in log output System + Simplifications to SyncBuffer + Fixes spike attribute transmission in new delta SyncBuffer + Removes obsolte count array from SyncBuffer + Changes variable init in StateMonitor for robustness + Changes variable init in EulerTrace + Adds TODO comment + Adds a pushback function for SpikeContainers + Reverts changes to StateMonitor + Changes free order in System + Adds a get_total_elapsed_time function + Adds square function to AurynVector + Changes initialization to StateMonitor + Merge branch 'develop' of https://github.com/idiot-z/auryn into idiot-z-develop + Adds doxystrings and adds TODOs + Makes stats virtual pure and adds z to param list + Renames overloaded function from WeightMonitor + Merges Lorrics additions into develop + Merge pull request #26 from idiot-z/develop + Makes AurynVector template more general + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Adds SIMD size check to AurynVector template + Adds statevectors vector to ComplexMatrix.h + Completely replaces core of ComplexMatrix + Fixes serveral bugs in ComplexMatrix + Implements copy function for states + Implements ComplexMatrix with AurynStateVectors + Merge branch 'feature-complex-matrix' into develop + Adds type def for AurynSynStateVector + Uses state vector copy function in ComplexMatrix + Fixes bug in destructor of ComplexMatrix + Adds shorter fn (filename) function to System + Adds AllToAllConnection + Removes two deprecated virtual pure functions + Adapts code to new base class + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + API change in Connection + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Adds doxystring + Small changes to DuplexConnection + Changes access level in StructuredPoissonGroup + Adds more arithmetic instructions to AurynVector + Changes access for members of StimulusGroup + Adds set_target function to Connection + Silences progressbar in "fast" sim_coba_benchmark + Performance optimizations + Adds profiling build + Performance optimizations in AurynVector + Performance optimizations in Connection + Performance optimizations in SparseConnection + Performance optimizations in ComplexMatrix + Cleans up code + Adds copy constructor + Unifies legacy codebase with AurynVector + Cleans up code + Inlines get_data_ptr functions + Adds some comments and TODO tags + Cleans up code + Adds sum and diff functions to AurynVector + Uses diff function in IFGroup now + Changes memcpy to std::copy in AurynVector + Adds diff function in legacy code + Inlines a bunch of functionx + Cleans up code IFGroup + Adds discretization error correction to variance + Removes inlining in template function + Changes memory alignment in AurynVector + Changes memory alignment in AurynVector + Doxystring + Removes inlining in template function + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Changes to access rights in ComplexMatrix + Adds basic statistics functions to AurynVector + Adds get_element function to ComplexMAtrix + Adds additional fn (filename) function to System + Adds corrections to variance function + Adds template function to Logger + Corrects data type + Adds getters for traces to Connection class + Changes Exception string + Changes calculate_vector_size implementation in auryn_definitions + Changes to allocation function in AurynVector + Implements Bessel's approxmation in stats + Changes to verbose log strings + Adds zero init to activity vector + Adds debug code to EulerTrace + Adds range check to EulerTrace for DEBUG + Removes cout from SpikingGroup + Makes several template functions virtual + Adds z parameter to set_all method + Changes default binsize in population rate monitor + Changes default recording interval in WeightMonitor + Adds Logger shortcut function + Adds exception to ComplexMatrix + Adds experimental support for state variables in SpikingGroup + Merge branch 'feature-groupstate' into develop + Updates some Doxystrings + Update README.md + Rename multiple types in AurynVector + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Update README.md + Make functions non-virtual + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Change types in AurynVector + Adds auryn_version_info.h and script to generate + Commits changes + Removes global static variables + Adds AurynVersion class + Updates AurynVersion class and mk_version_info + Updates Doxyfile + Moves script lines to mk_doxygen + Adds Doxystring + Improves documentation of WeightMonitor + Fixes typo + Updates doxystring in SparseConnection + Fixes bug in random init function + Updates and moves doxygen mainpage + Adapts AIFGroup to new AurynVector interface + Adds exp() to AurynVector.h + Makes a variable const in IFGroup + Updates doxystring + Fixes bug in TripletConnection netstate functions + Moves Doxyfile and starts adding examples to doc + Moves Doxyfile and all doc related files to /doc + Adds doxystrings to example sims + Updates doxystring + Adds logger output + Fixes mismatched new [] / delete [] in SyncBuffer + Fixes datatype in WeightMonitor + Fixes bug which affected complex synapses + Implements BinaryStateMonitor and the decoder tool/aubs + Merge branch 'feature-binary-statemon' into develop + Adds doxystring + Small bugfix + Adds Izhikevich neuron model als IzhikevichGroup + Removes unused params + Updates doxystrings + Removes make from bootstrap file + Small changes to synaptic input in IzhikevichGroup + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + Removes unused state mons from example + Fixes doxygen string + Adds example simulation + Updates transmit() in Connection + Hotfix bug in benchmark script + Fixes label in plot_benchmark_results.gnu + Hotfix default parameters in AdExGroup + Adds functionality to Connection + Updates example sim + Replaces Monitor with abstract base class Device + Implements names for Devices and Monitors + Implements smart auto names for monitors + Removes debug cout + Improvements in AurynVector + Vectorizes AdEx and makes it about 4x faster + Adds forgotten Device files + Adds API function to SpikingGroup + Modifications to progressbar (System) + Fixes progressbar bug + Adds mem clipping to AdEx for stability + Adds doxystrings + Adds unit test files for ComplexMatrix and AurynVector + Adds random init and resize func to AurynVector + Fixes bug in bisec in SimpleMatrix + Fixes two bugs in complex matrix + Updates unite test suite for ComplexMatrix + Adds random init and resize func to AurynVector + Fixes bug in bisec in SimpleMatrix + Fixes two bugs in complex matrix + Adds unit test files for ComplexMatrix and AurynVector + Updates unite test suite for ComplexMatrix + Merge AurynVector from develop branch + Updates test scripts to run units tests + Updates test_Aurynvector + Adds abs and new fast_exp to AurynVector + Reorders functions in AurynVector + Revers back to naive fast_exp256 implementation in AurynVector + Adds check to test_ComplexMatrix + Adds unit test for EulerTrace + Moves tests to test dir + Adds test for LinearTrace + Corrections to test_EulerTrace + Updates run test script + Fixes precision problem in LinearTrace + Fixes precision problem in LinearTrace + Updates test pathname in travis cl yml file + Merge branch 'release-v0.8.0' of ssh://fzenke.net/var/git/auryn into release-v0.8.0 + Adds another check to LinearTrace + Removes unused variable + Adds initial version of SpikeTimingStimGroup + Removes old code fom SpikingGroup + Adds mpi rank proxy variables to System + Mod to log output System + System: cleans up logger output + Fixes mk_version_info.sh + Fixes mk_version_info.sh + Adds a loop grid for easier temporal alignment in FileInputGroup + Refactors FileInputGroup to first load all spikes to memory + Fixes some of the issues in FileInputGroup + Adds todo to Fileinputgroup + Moves active switch to SpikingGroup + Adds prune function to DuplexConnection + Removes active switch + Updates mk_version_info + Renames a type in EulerTrace + Adds an if check to to evolve_traces() in SpikingGroup + First code of python based spike extraction tool + Makes python tool a class + Moves example file + Some small changes + Faster implementation for RF + Adds if main to python spk import lib + Adds some doc strings + Adds an example + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Moves example file + Some small changes + Faster implementation for RF + Adds if main to python spk import lib + Adds some doc strings + Adds an example + Adds readme to python subdir + Moves file + Creates new base class for Auryn binary tools + Merge branch 'release-v0.8.0' of ssh://fzenke.net/var/git/auryn into release-v0.8.0 + Imports new version of Python binary tools + Adds examples for Auryn Python toolkit + Adds examples for Auryn Python toolkit + Merge branch 'release-v0.8.0' of https://github.com/fzenke/auryn into release-v0.8.0 + Updates Auryn binary toolkit README.md + Updates Auryn binary toolkit README.md + Adds example to read BinaryStateMonitor file with Python toolkit + Change header tag for StateMonitor + Adds example to read BinaryStateMonitor file with Python toolkit + Change header tag for StateMonitor + Merge branch 'release-v0.8.0' into develop + Adds example to read BinaryStateMonitor file with Python toolkit + Change header tag for StateMonitor + Fixes typo + Fixes typo + Renames global variable communicator to mpicommunicator + Adds loglevel setters to Logger + Adapts examples to new API + Updates gitignore + Merge branch 'develop' into release-v0.8.0 + Fixes bug in Python library + Merge branch 'master' of https://github.com/fzenke/auryn + Merge branch 'release-v0.8.0' for beta release + Hotfix of log file path sim_coba_benchmark + Removes tests + Adds test for fastexp in AurynVector unit test + Hotfix binary name detection for logfile name + Hotfix logfile output sim_background for benchmark script + Fixes bug in Python library + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Hotfix test script + Updates travis yml file + Adds some more debugging output to test script + Shortens .travis yml file + Removes network tests from automated tests + Adds an auryn_free function for MPI cleanup + Merge branch 'master' into develop + Hotfix link in README + Adds new master seed mechanisms to System + Adds salt to PoissonGroup + Adds salt + Revert "Adds salt" + Hotfix link in README + Hotfix changes to aligned allocation in AurynVector + Changes to aligned allocation in AurynVector + Merge branch 'master' of https://github.com/fzenke/auryn + Switches to master seed mechanism + Merge remote-tracking branch 'github/master' + Adds simple unit test script for AurynStateVector + Updates unit tests vor AurynVector and derived classes + Fixes a bug in resize of AurynStateVector/AurynVectorFloat + Updates bootstrap script in debug build dir + Adds doxystring to auryn_init and auryn_free + Bumps version number in CMakeLists.txt and mk_version_info.sh + Fixes issues reported by haffi + Fixes signed/unsigned comparison warnings + Implements poor man's version of aligned_alloc + Merge branch 'bugfix_stdlib_memory_alignment' + Fixes some more signed unsigned comparison warns + Fixes bug in Python library + Adds new master seed mechanisms to System + Adds salt to PoissonGroup + Adds salt + Revert "Adds salt" + Adds refresh function for file wrapper in python tools + Implements boost alignment + Adds new version requirements to CMakeLists.txt + Moves Doxygen mainpage to doc + Uses master seeding mechanisms in example + Merge branch 'develop' of ssh://fzenke.net/var/git/auryn into develop + Fixes another signed unsigned warming + Merge branch 'master' into develop + Implements auryn_abort + Merge branch 'master' into develop + Implements flush() in BinarySpikeMonitor + Updates some copyright notes + Merge branch 'master' into develop + Changes interface of Connection member function + Adds README.md to test/src + Updates requirements for boost libs in travis file + Reverts new boost based alignment for Travis CI + Revert "Updates requirements for boost libs in travis file" + Reverst required boost version to 1.41 + Makes CMakeLists nicer + Changes directory structure for clean install + Adds quick install instructions + Adds zero_effective_zeros function to AurynVector + Adds get_delay function to SpikeDelay + Adds AurynDelayVector + Adds doxystring and renames method + Updates test and removes couts + Little fix + Adds new inc function to EulerTrace + Adds doxystrings to some example files + Adds doxystring to sim_coba_benchmark + Adds PoissonSpikeInjector + Adds warning to PoissonSpikeInjector + Removes old randomization functions from NeuronGroup + Fixes unsigned comparison in aube + Removes direct call to mpienv from examples + Adds preprocessor option to compile Auryn withgout MPI support + Fixes bug introduced by last commit + Comments out code for the dynamic library + Changes file output in benchmark script -2014-01-20 Friedemann Zenke - - * Added release information version v0.3. - * Changed custom written MPI code to MPI_Allgather - with adaptive receive buffer size. - * Fixes a bug in SyncBuffer that was effecting - short term plasticity. - * Several bugfixes. +Lorric Ziegler (5): + added z support to set/scale_data, fixed get_data in ComplexMatrix + Merge branch 'develop' of https://github.com/fzenke/auryn into develop + merged selected patches from dev_zynapse branch + added empty stats method in connection.h + fixed a bug in WeightMonitor related to z support + +fzenke (1): + Rename README to README.md From 19b6cb03762e562d17db38303f6ed1b732974336 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:38:32 -0700 Subject: [PATCH 47/77] Removes outdated INSTALL file --- INSTALL | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 INSTALL diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 3e29d49a..00000000 --- a/INSTALL +++ /dev/null @@ -1,11 +0,0 @@ -Since Auryn is a source package and as of now all simulation relevant code -is compiled into the simulation program directly no install other -than a local copy of the src directory is necessary. See README for more -details. - - - - -Copyright 2014 Friedemann Zenke. -Copying and distribution of this file, with or without modification, are -permitted provided the copyright notice and this notice are preserved. From c8dead28e2ba475d1f0225c5e0a8171bc2b345e2 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:40:57 -0700 Subject: [PATCH 48/77] Updates readme --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 59ac2629..304bb457 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,9 @@ which will put it under `/usr/local/` or for a local install make DESTDIR=./your/dir/ install ``` -Documentation & Installation/Use --------------------------------- + +Documentation +------------- Please visit the wiki at http://www.fzenke.net/auryn/ @@ -68,6 +69,26 @@ Bibtex: ``` -Copyright 2014-2016 Friedemann Zenke. -Copying and distribution of this file, with or without modification, are -permitted provided the copyright notice and this notice are preserved. + +License & Copyright +------------------- + +Copyright 2014-2016 Friedemann Zenke + +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. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with Auryn. If not, see . + +If you are using Auryn or parts of it for your work please cite: +Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations +of spiking neural networks using general-purpose computers. +Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 From e17d9e3dd4b0a44e153d8d189acf0af6cbd7e3ec Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:41:46 -0700 Subject: [PATCH 49/77] Changes copyright note --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 304bb457..87ce769d 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,3 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Auryn. If not, see . - -If you are using Auryn or parts of it for your work please cite: -Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations -of spiking neural networks using general-purpose computers. -Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 From 47ba7bc02a32bf9d63ef58537e6692399515f01a Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:43:23 -0700 Subject: [PATCH 50/77] Updates readme --- README.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 87ce769d..fa3bbd0e 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,13 @@ Auryn is a source package used to create highly specialized and optimized code to simulate recurrent spiking neural networks with spike timing dependent plasticity (STDP). It comes with the GPLv3 (please see COPYING). +For examples and documentation visit the wiki at http://www.fzenke.net/auryn/ Quick start ----------- -To download and compile the examples try: +Note, Auryn needs a C++ compiler, the boost libraries (www.boost.org) with MPI support installed +in development versions to compile. To download and compile the examples under Linux try: ``` sudo apt-get install cmake git build-essential libboost-all-dev @@ -31,18 +33,6 @@ make DESTDIR=./your/dir/ install ``` -Documentation -------------- - -Please visit the wiki at http://www.fzenke.net/auryn/ - - -Requirements ------------- - -Auryn needs the boost libraries (www.boost.org) with MPI support installed -in development versions to compile. - Citing Auryn ------------ From 4c9cf195acd02abecf244b5742c7cf9ae17946c6 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:44:33 -0700 Subject: [PATCH 51/77] Removes line from README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index fa3bbd0e..c9b9fcb7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Auryn ===== -This is the README file that comes with your version of Auryn. - ![Auryn logo](http://www.fzenke.net/uploads/images/logo_trans_small.png "Auryn logo") Auryn is a source package used to create highly specialized and optimized code From 12a0ebfb3ba244134368e91de47d55c8016608aa Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:45:07 -0700 Subject: [PATCH 52/77] Moves logo in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c9b9fcb7..8db820b1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ +![Auryn logo](http://www.fzenke.net/uploads/images/logo_trans_small.png "Auryn logo") + Auryn ===== -![Auryn logo](http://www.fzenke.net/uploads/images/logo_trans_small.png "Auryn logo") - Auryn is a source package used to create highly specialized and optimized code to simulate recurrent spiking neural networks with spike timing dependent plasticity (STDP). It comes with the GPLv3 (please see COPYING). From af81b3a70dd9f3b985d6129104aa0902b4c49f36 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 13:46:43 -0700 Subject: [PATCH 53/77] Updates README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8db820b1..39033db7 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ For examples and documentation visit the wiki at http://www.fzenke.net/auryn/ Quick start ----------- -Note, Auryn needs a C++ compiler, the boost libraries (www.boost.org) with MPI support installed -in development versions to compile. To download and compile the examples under Linux try: +Note, Auryn needs a C++ compiler, the boost libraries (www.boost.org) with MPI +support installed. To download and compile the examples under Linux try: ``` sudo apt-get install cmake git build-essential libboost-all-dev From 90587c680b02b4e6bd7b8dca498291733573da4c Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 14:23:12 -0700 Subject: [PATCH 54/77] Updates intro text in README --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 39033db7..939fe11e 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,8 @@ Auryn ===== -Auryn is a source package used to create highly specialized and optimized code -to simulate recurrent spiking neural networks with spike timing dependent -plasticity (STDP). It comes with the GPLv3 (please see COPYING). +Auryn is Plastic Spiking Neural Network Simulator to simulate recurrent spiking +neural networks with synaptic. It comes with the GPLv3 (please see COPYING). For examples and documentation visit the wiki at http://www.fzenke.net/auryn/ From 0e7c2f62d59c545081f9a428ea39be18ca615f5f Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:15:07 -0700 Subject: [PATCH 55/77] Fix remaining MPI dependences --- src/auryn.h | 3 +++ src/auryn/SyncBuffer.h | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/auryn.h b/src/auryn.h index e8bd977b..85c902f4 100644 --- a/src/auryn.h +++ b/src/auryn.h @@ -32,9 +32,12 @@ #include #include + +#ifdef AURYN_CODE_USE_MPI #include #include #include +#endif // AURYN_CODE_USE_MPI // Core simulator definitions #include "auryn/auryn_global.h" diff --git a/src/auryn/SyncBuffer.h b/src/auryn/SyncBuffer.h index 22bfd5e1..91a25ed8 100644 --- a/src/auryn/SyncBuffer.h +++ b/src/auryn/SyncBuffer.h @@ -41,12 +41,12 @@ #include "SpikeDelay.h" #include #include -#include -#include - #ifdef AURYN_CODE_USE_MPI +#include +#include + namespace auryn { /*! \brief Buffer object to capsulate native MPI_Allgather for SpikingGroups From 2e8fa5302f5053a2257e26e369dc00a154287db5 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:15:55 -0700 Subject: [PATCH 56/77] Updates CMake config files --- CMakeLists.txt | 26 ++++++++++++++++++-------- examples/CMakeLists.txt | 14 +++++++------- test/src/CMakeLists.txt | 14 +++++++------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0ab7bc3..c2a82bf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,19 +13,29 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic") # message("CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}") # message("CMAKE_CXX_FLAGS_RELEASE is ${CMAKE_CXX_FLAGS_RELEASE}") -# Required external MPI libraries -FIND_PACKAGE(MPI REQUIRED) +# Find external MPI libraries +# FIND_PACKAGE(MPI REQUIRED) -# Required Boost libraries +# Find Boost libraries SET(BOOST_MIN_VERSION "1.41.0") -FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization program_options date_time unit_test_framework system filesystem) +IF(MPI_FOUND) + FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS mpi serialization program_options date_time unit_test_framework system filesystem) +ELSE() + FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS serialization program_options date_time unit_test_framework system filesystem) +ENDIF() # TODO add align to the components list once AurynVector uses it -# Recommended: Doxygen -FIND_PACKAGE(Doxygen) -INCLUDE_DIRECTORIES( ${MPI_CXX_INCLUDE_PATH} ) -INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ) +IF(MPI_FOUND) + set(AURYN_EXT_LINKLIBS ${MPI_CXX_LIBRARIES} ${Boost_LIBRARIES} ) + set(AURYN_EXT_INCLUDEDIRS ${MPI_CXX_INCLUDE_PATH} ${Boost_INCLUDE_DIRS} ) +ELSE() + set(AURYN_EXT_LINKLIBS ${Boost_LIBRARIES} ) + set(AURYN_EXT_INCLUDEDIRS ${Boost_INCLUDE_DIRS} ) +ENDIF() + + +INCLUDE_DIRECTORIES( AURYN_EXT_INCLUDEDIRS ) INCLUDE_DIRECTORIES(src) ADD_SUBDIRECTORY(src) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index b812f970..f947fb77 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,8 +1,8 @@ -file( GLOB SIM_SOURCES *.cpp ) -foreach( sourcepath ${SIM_SOURCES} ) - get_filename_component( sourcefile ${sourcepath} NAME ) - string( REPLACE ".cpp" "" simname ${sourcefile} ) - add_executable( ${simname} ${sourcefile} ) - target_link_libraries( ${simname} auryn ${MPI_C_LIBRARIES} ${Boost_LIBRARIES} ) -endforeach( sourcepath ${SIM_SOURCES} ) +FILE( GLOB SIM_SOURCES *.cpp ) +FOREACH( sourcepath ${SIM_SOURCES} ) + GET_FILENAME_COMPONENT( sourcefile ${sourcepath} NAME ) + STRING( REPLACE ".cpp" "" simname ${sourcefile} ) + ADD_EXECUTABLE( ${simname} ${sourcefile} ) + TARGET_LINK_LIBRARIES( ${simname} auryn ${AURYN_EXT_LINKLIBS} ) +ENDFOREACH( sourcepath ${SIM_SOURCES} ) diff --git a/test/src/CMakeLists.txt b/test/src/CMakeLists.txt index 7383c9b0..052bd55e 100644 --- a/test/src/CMakeLists.txt +++ b/test/src/CMakeLists.txt @@ -1,9 +1,9 @@ -file( GLOB TEST_SOURCES test_*.cpp ) +FILE( GLOB TEST_SOURCES test_*.cpp ) ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK) -foreach( sourcepath ${TEST_SOURCES} ) - get_filename_component( sourcefile ${sourcepath} NAME ) - string( REPLACE ".cpp" "" simname ${sourcefile} ) - add_executable( ${simname} ${sourcefile} ) - target_link_libraries( ${simname} auryn ${MPI_C_LIBRARIES} ${Boost_LIBRARIES} ) -endforeach( sourcepath ${TEST_SOURCES} ) +FOREACH( sourcepath ${TEST_SOURCES} ) + GET_FILENAME_COMPONENT( sourcefile ${sourcepath} NAME ) + STRING( REPLACE ".cpp" "" simname ${sourcefile} ) + ADD_EXECUTABLE( ${simname} ${sourcefile} ) + TARGET_LINK_LIBRARIES( ${simname} auryn ${AURYN_EXT_LINKLIBS} ) +ENDFOREACH( sourcepath ${TEST_SOURCES} ) From 2631d8ce2b1e4b5110a8be0dd71760e0ccff26c3 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:16:19 -0700 Subject: [PATCH 57/77] Updates doxystrings in auryn_definitions.h --- src/auryn/auryn_definitions.h | 66 ++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/src/auryn/auryn_definitions.h b/src/auryn/auryn_definitions.h index 2d1e3b2e..a4e21150 100644 --- a/src/auryn/auryn_definitions.h +++ b/src/auryn/auryn_definitions.h @@ -27,52 +27,71 @@ #define AURYN_DEFINITIONS_H_ -/*! Toggle between memory alignment for - * SIMD code. +/*! \brief Compiler flag that determines whether Auryn is built using MPI or + * not */ #define AURYN_CODE_USE_MPI -/*! Toggle between memory alignment for - * SIMD code. +/*! \brief Toggles between memory alignment for SIMD code. */ #define CODE_ALIGNED_SIMD_INSTRUCTIONS -/*! Toggle prefetching in spike backpropagation */ +/*! \brief Toggle prefetching in spike backpropagation + * + * Enables prefetching for spike backpropagation in some + * plastic connections.*/ #define CODE_ACTIVATE_PREFETCHING_INTRINSICS -/*! Toggle between using auryns vector - * operations using SIMD instructions. If - * you do not enforce this here the compiler - * might still choose to use them when - * mtune settings are set appropriately. - */ +/*! \brief Toggle between using auryns vector operations using SIMD + * instructions. + * + * Even if you do not enforce this here the compiler might still choose to use + * them when mtune settings are set appropriately. + * */ #define CODE_USE_SIMD_INSTRUCTIONS_EXPLICITLY -/*! Use Intel Cilk Plus -- only has an effect when - * CODE_USE_SIMD_INSTRUCTIONS_EXPLICITLY is enabled. */ +/*! \brief Use Intel Cilk Plus -- only has an effect when + * CODE_USE_SIMD_INSTRUCTIONS_EXPLICITLY is enabled. + * + * Use this when using an Intel compiler and CPU. This is for instance what you + * want when running on Xeon Phi. */ // #define CODE_ACTIVATE_CILK_INSTRUCTIONS -#define SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS 4 //!< SSE can process 4 floats in parallel +/*! \brief Sets the number of floats your CPU can handle in parallel using SIMD + * + * Since Auryn currently only supports SSE and not the new AVX 512, this is typically 4. + * */ +#define SIMD_NUM_OF_PARALLEL_FLOAT_OPERATIONS 4 +/*! \brief Switches collection of timing stats in some classes like SyncBuffer and system + * + * This is for profiling and since it impairs simulation performance, it is disabled by default. + * */ // #define CODE_COLLECT_SYNC_TIMING_STATS //!< toggle collection of timing data on sync/all_gather -/*! System wide minimum delay which determines - * the sync interval between nodes in units of dt. +/*! \brief System wide minimum delay which determines the sync interval between + * nodes in units of dt. + * + * Per default this is set to 8 which corresponds to 0.8ms with Auryn standard + * dt timestep of 0.1ms. The resaon for setting it to 8 is that the compiler + * can then implement certain operations using MINDELAY with va bitshift + * instead of regular division. However, the effect of this is presumably + * negligible, but I am keeping this for hystoric reasons. */ #define MINDELAY 8 -/*! Groups with an effective size smaller than - * this will not be distributed. Furthermore - * groups that are distributed will not be - * cut up in chunks that are not smaller than - * this. This is done to reduce overhead +/*! \brief Groups with an effective size smaller than this will not be + * distributed. + * + * Furthermore groups that are distributed will not be cut up in chunks that + * are not smaller than this. This is done to reduce overhead */ #define DEFAULT_MINDISTRIBUTEDSIZE 16 -/*! These precompiler directives control +/*! \brief These precompiler directives control * what type of synaptic traces Auryn * implements for STDP models. */ @@ -86,8 +105,7 @@ // #define PRE_TRACE_MODEL LinearTrace - -//* -- Do not modify below -- *// +//* -- End of precompiler options -- *// #include From 8422e9c657b014ccb7550b0961c184f8a4080de6 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:16:45 -0700 Subject: [PATCH 58/77] Changes name of define macro variable --- src/auryn/Logger.cpp | 2 +- src/auryn/Logger.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/auryn/Logger.cpp b/src/auryn/Logger.cpp index 94350948..2f77bfe0 100644 --- a/src/auryn/Logger.cpp +++ b/src/auryn/Logger.cpp @@ -95,7 +95,7 @@ void Logger::msg( std::string text, LogMessageType type, bool global, int line, if ( type >= console_out && ( !global || (global && local_rank == 0) ) ) { if ( last_message != text ) { - if ( type >= CERRLEVEL ) + if ( type >= AURYN_LOGGER_CERRLEVEL ) if ( global ) { std::cerr << "(!!) " << text << std::endl; } else { diff --git a/src/auryn/Logger.h b/src/auryn/Logger.h index 20be1d44..d5d83a6f 100644 --- a/src/auryn/Logger.h +++ b/src/auryn/Logger.h @@ -33,7 +33,8 @@ #include #include -#define CERRLEVEL WARNING +#define AURYN_LOGGER_CERRLEVEL WARNING + namespace auryn { /*! \brief Enum type for significance level of a given message send to the Logger */ From 96d762127e3029e0522db68fa99a888304942f2d Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:17:37 -0700 Subject: [PATCH 59/77] Fixes problem in CMakeLists introduced by commit --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2a82bf6..79c33fb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic") # message("CMAKE_CXX_FLAGS_RELEASE is ${CMAKE_CXX_FLAGS_RELEASE}") # Find external MPI libraries -# FIND_PACKAGE(MPI REQUIRED) +FIND_PACKAGE(MPI REQUIRED) # Find Boost libraries SET(BOOST_MIN_VERSION "1.41.0") From 1664606606b595052e396f7ae05d337d6d0fe788 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:31:37 -0700 Subject: [PATCH 60/77] Adds figure to README.md --- README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 939fe11e..aa307fe6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,30 @@ git clone https://github.com/fzenke/auryn.git && cd auryn/build/release ./bootstrap.sh && make ``` -Then to install the library: +Run a first network simulation +------------------------------ + +``` +cd examples +./sim_coba_benchmark --dir . +``` +will run the Vogels Abbott benchmark, a balanced network model with conductance based synapses. +Spiking activity is written to files with the extension 'ras'. + +If you have gnuplot installed, you can visualize the output of the simulation follows: +``` +echo "set xlabel 'Time [s]'; plot [1:2] 'coba.0.e.ras' with dots lc rgb 'black'" | gnuplot -p +``` + +![Spike raster plot](http://www.fzenke.net/auryn/lib/exe/fetch.php?cache=&media=coba_ras.png "coba ras") +Here time in seconds is plotted on the x-asis and neuron id on the y-axis. + + + +Install as a library +-------------------- + +To install Auryn as a library run: ``` sudo make install ``` @@ -30,7 +53,6 @@ make DESTDIR=./your/dir/ install ``` - Citing Auryn ------------ From 464cc7fdb6067216b43b23493588f6d37435c48c Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:33:31 -0700 Subject: [PATCH 61/77] Formatting changes to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index aa307fe6..587ee1a4 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ echo "set xlabel 'Time [s]'; plot [1:2] 'coba.0.e.ras' with dots lc rgb 'black'" ``` ![Spike raster plot](http://www.fzenke.net/auryn/lib/exe/fetch.php?cache=&media=coba_ras.png "coba ras") + Here time in seconds is plotted on the x-asis and neuron id on the y-axis. From f29fb3086308971985663e031f5957240309c628 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 15:45:53 -0700 Subject: [PATCH 62/77] Updates test script --- test/run_unit_tests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/run_unit_tests.sh b/test/run_unit_tests.sh index 1d40478e..8d8acb7f 100755 --- a/test/run_unit_tests.sh +++ b/test/run_unit_tests.sh @@ -1,6 +1,8 @@ #!/bin/sh BUILDDIR="../build/release" + +echo "Running unit tests..." $BUILDDIR/test/src/test_AurynVector && \ $BUILDDIR/test/src/test_AurynStateVector && \ $BUILDDIR/test/src/test_AurynDelayVector && \ From 55a2f56b8a0cb599a9d35214d249fca3a3940c84 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 17:30:08 -0700 Subject: [PATCH 63/77] Adds tentative timestep clock variable which is not being used yet --- src/auryn/System.cpp | 3 +++ src/auryn/System.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/auryn/System.cpp b/src/auryn/System.cpp index c73e02e9..1634fe3e 100644 --- a/src/auryn/System.cpp +++ b/src/auryn/System.cpp @@ -107,6 +107,9 @@ void System::init() { die = new boost::variate_generator > ( gen, *dist ); set_master_seed(3521); + + clk_dt = dt; + #ifndef NDEBUG oss.str(""); oss << "Warning Auryn was compiled with debugging features which will impair performance."; diff --git a/src/auryn/System.h b/src/auryn/System.h index d2bce7c6..8e127396 100644 --- a/src/auryn/System.h +++ b/src/auryn/System.h @@ -153,6 +153,12 @@ namespace auryn { /*! \brief Switch to turn output to quiet mode (no progress bar). */ bool quiet; + /*! \brief Global simulation timestep in seconds. + * + * \todo Make clk_dt a system member the global timestep. + * Corrently the timestep is defined as global static variable in auryn_definition.h */ + AurynFloat clk_dt; + /*! \brief Version info */ AurynVersion build; From 142dd7caa1f670996db20c157b2eb25cc8e61c6f Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 19:48:47 -0700 Subject: [PATCH 64/77] Implements abstract baseclass Trace --- build/release/run_benchmark.sh | 4 +- src/auryn/AIF2Group.cpp | 8 +-- src/auryn/AIFGroup.cpp | 16 ++--- src/auryn/AdExGroup.cpp | 10 +-- src/auryn/AuditoryBeepGroup.cpp | 6 +- src/auryn/BinarySpikeMonitor.cpp | 2 +- src/auryn/BinaryStateMonitor.cpp | 12 ++-- src/auryn/BinaryStateMonitor.h | 10 +-- src/auryn/Connection.cpp | 6 +- src/auryn/Connection.h | 7 +- src/auryn/CorrelatedPoissonGroup.cpp | 16 ++--- src/auryn/CubaIFGroup.cpp | 4 +- src/auryn/CurrentInjector.cpp | 2 +- src/auryn/CurrentInjector.h | 4 +- src/auryn/DelayedSpikeMonitor.cpp | 2 +- src/auryn/EulerTrace.cpp | 83 ++++------------------ src/auryn/EulerTrace.h | 77 +++------------------ src/auryn/FileInputGroup.cpp | 8 +-- src/auryn/FileModulatedPoissonGroup.cpp | 2 +- src/auryn/IFGroup.cpp | 14 ++-- src/auryn/IafPscDeltaGroup.cpp | 4 +- src/auryn/IafPscExpGroup.cpp | 6 +- src/auryn/IzhikevichGroup.cpp | 8 +-- src/auryn/LPTripletConnection.cpp | 4 +- src/auryn/LPTripletConnection.h | 11 ++- src/auryn/LinearTrace.cpp | 62 +++++------------ src/auryn/LinearTrace.h | 27 +++----- src/auryn/MovingBumpGroup.cpp | 4 +- src/auryn/PairInteractionConnection.cpp | 12 ++-- src/auryn/PairInteractionConnection.h | 1 - src/auryn/PatternMonitor.cpp | 4 +- src/auryn/PatternMonitor.h | 2 +- src/auryn/PatternStimulator.cpp | 4 +- src/auryn/PoissonGroup.cpp | 6 +- src/auryn/PoissonStimulator.cpp | 2 +- src/auryn/PopulationRateMonitor.cpp | 2 +- src/auryn/PopulationRateMonitor.h | 2 +- src/auryn/ProfilePoissonGroup.cpp | 4 +- src/auryn/RateChecker.cpp | 2 +- src/auryn/RateModulatedConnection.cpp | 2 +- src/auryn/RateMonitor.cpp | 4 +- src/auryn/RateMonitor.h | 13 ++-- src/auryn/RealTimeMonitor.cpp | 4 +- src/auryn/STDPConnection.h | 6 +- src/auryn/STDPwdConnection.h | 4 +- src/auryn/STPConnection.cpp | 4 +- src/auryn/SpikeMonitor.cpp | 2 +- src/auryn/SpikeTimingStimGroup.cpp | 16 ++--- src/auryn/SpikingGroup.cpp | 20 +++--- src/auryn/SpikingGroup.h | 36 +++++----- src/auryn/StateMonitor.cpp | 12 ++-- src/auryn/StateMonitor.h | 10 +-- src/auryn/StimulusGroup.cpp | 26 +++---- src/auryn/StructuredPoissonGroup.cpp | 6 +- src/auryn/SymmetricSTDPConnection.h | 6 +- src/auryn/System.cpp | 35 +++++----- src/auryn/System.h | 7 +- src/auryn/TIFGroup.cpp | 8 +-- src/auryn/Trace.cpp | 71 +++++++++++++++++++ src/auryn/Trace.h | 92 +++++++++++++++++++++++++ src/auryn/TripletConnection.h | 12 ++-- src/auryn/TripletDecayConnection.cpp | 2 +- src/auryn/TripletDecayConnection.h | 2 +- src/auryn/TripletScalingConnection.cpp | 4 +- src/auryn/TripletScalingConnection.h | 10 +-- src/auryn/VoltageMonitor.cpp | 4 +- src/auryn/VoltageMonitor.h | 4 +- src/auryn/WeightChecker.cpp | 2 +- src/auryn/WeightMatrixMonitor.cpp | 4 +- src/auryn/WeightMonitor.cpp | 8 +-- src/auryn/WeightPatternMonitor.cpp | 2 +- src/auryn/WeightStatsMonitor.cpp | 2 +- src/auryn/WeightSumMonitor.cpp | 2 +- src/auryn/auryn_definitions.cpp | 2 + src/auryn/auryn_definitions.h | 20 ++---- 75 files changed, 465 insertions(+), 459 deletions(-) create mode 100644 src/auryn/Trace.cpp create mode 100644 src/auryn/Trace.h diff --git a/build/release/run_benchmark.sh b/build/release/run_benchmark.sh index 3aee7af5..7b3d2e11 100755 --- a/build/release/run_benchmark.sh +++ b/build/release/run_benchmark.sh @@ -1,8 +1,8 @@ #!/bin/bash # Compile code -make clean -./bootstrap.sh && make +# make clean +./bootstrap.sh && make -j 8 sleep 2 # Benchmark parameters diff --git a/src/auryn/AIF2Group.cpp b/src/auryn/AIF2Group.cpp index 3e387a9d..1112f2dc 100644 --- a/src/auryn/AIF2Group.cpp +++ b/src/auryn/AIF2Group.cpp @@ -37,7 +37,7 @@ AIF2Group::AIF2Group( NeuronID size, AurynFloat load, NeuronID total ) : AIFGrou void AIF2Group::calculate_scale_constants() { AIFGroup::calculate_scale_constants(); - scale_adapt2 = exp(-dt/tau_adapt2); + scale_adapt2 = exp(-auryn_timestep/tau_adapt2); } void AIF2Group::init() @@ -90,14 +90,14 @@ AIF2Group::~AIF2Group() void AIF2Group::integrate_linear_nmda_synapses() { - // decay of ampa and gaba channel, i.e. multiply by exp(-dt/tau) + // decay of ampa and gaba channel, i.e. multiply by exp(-auryn_timestep/tau) auryn_vector_float_scale(scale_ampa,g_ampa); auryn_vector_float_scale(scale_gaba,g_gaba); auryn_vector_float_scale(scale_adapt1,g_adapt1); auryn_vector_float_scale(scale_adapt2,g_adapt2); - // compute dg_nmda = (g_ampa-g_nmda)*dt/tau_nmda and add to g_nmda - AurynFloat mul_nmda = dt/tau_nmda; + // compute dg_nmda = (g_ampa-g_nmda)*auryn_timestep/tau_nmda and add to g_nmda + AurynFloat mul_nmda = auryn_timestep/tau_nmda; auryn_vector_float_saxpy(mul_nmda,g_ampa,g_nmda); auryn_vector_float_saxpy(-mul_nmda,g_nmda,g_nmda); diff --git a/src/auryn/AIFGroup.cpp b/src/auryn/AIFGroup.cpp index 3b67b64a..9499a8e7 100644 --- a/src/auryn/AIFGroup.cpp +++ b/src/auryn/AIFGroup.cpp @@ -36,10 +36,10 @@ AIFGroup::AIFGroup( NeuronID size, AurynFloat load, NeuronID total ) : NeuronGro void AIFGroup::calculate_scale_constants() { - scale_ampa = exp(-dt/tau_ampa) ; - scale_gaba = exp(-dt/tau_gaba) ; - scale_thr = exp(-dt/tau_thr) ; - scale_adapt1 = exp(-dt/tau_adapt1); + scale_ampa = exp(-auryn_timestep/tau_ampa) ; + scale_gaba = exp(-auryn_timestep/tau_gaba) ; + scale_thr = exp(-auryn_timestep/tau_thr) ; + scale_adapt1 = exp(-auryn_timestep/tau_adapt1); } void AIFGroup::init() @@ -111,13 +111,13 @@ AIFGroup::~AIFGroup() void AIFGroup::integrate_linear_nmda_synapses() { - // decay of ampa and gaba channel, i.e. multiply by exp(-dt/tau) + // decay of ampa and gaba channel, i.e. multiply by exp(-auryn_timestep/tau) g_ampa->scale(scale_ampa); g_gaba->scale(scale_gaba); g_adapt1->scale(scale_adapt1); - // compute dg_nmda = (g_ampa-g_nmda)*dt/tau_nmda and add to g_nmda - const AurynFloat mul_nmda = dt/tau_nmda; + // compute dg_nmda = (g_ampa-g_nmda)*auryn_timestep/tau_nmda and add to g_nmda + const AurynFloat mul_nmda = auryn_timestep/tau_nmda; g_nmda->saxpy(mul_nmda, g_ampa); g_nmda->saxpy(-mul_nmda, g_nmda); @@ -147,7 +147,7 @@ void AIFGroup::integrate_membrane() t_leak->diff(mem,e_rest); // membrane dynamics - const AurynFloat mul_tau_mem = dt/tau_mem; + const AurynFloat mul_tau_mem = auryn_timestep/tau_mem; mem->saxpy(mul_tau_mem,t_exc); mem->saxpy(-mul_tau_mem,t_inh); mem->saxpy(-mul_tau_mem,t_leak); diff --git a/src/auryn/AdExGroup.cpp b/src/auryn/AdExGroup.cpp index e5033fb5..f12c7b49 100644 --- a/src/auryn/AdExGroup.cpp +++ b/src/auryn/AdExGroup.cpp @@ -35,10 +35,10 @@ AdExGroup::AdExGroup(NeuronID size) : NeuronGroup(size) void AdExGroup::calculate_scale_constants() { - scale_mem = dt/tau_mem; - scale_w = dt/tau_w; - scale_ampa = exp(-dt/tau_ampa); - scale_gaba = exp(-dt/tau_gaba); + scale_mem = auryn_timestep/tau_mem; + scale_w = auryn_timestep/tau_w; + scale_ampa = exp(-auryn_timestep/tau_ampa); + scale_gaba = exp(-auryn_timestep/tau_gaba); } void AdExGroup::init() @@ -269,7 +269,7 @@ AurynFloat AdExGroup::get_tau_gaba() void AdExGroup::set_refractory_period(AurynDouble t) { - refractory_time = (unsigned short) (t/dt); + refractory_time = (unsigned short) (t/auryn_timestep); } void AdExGroup::virtual_serialize(boost::archive::binary_oarchive & ar, const unsigned int version ) diff --git a/src/auryn/AuditoryBeepGroup.cpp b/src/auryn/AuditoryBeepGroup.cpp index 4d606fbe..55df08b5 100644 --- a/src/auryn/AuditoryBeepGroup.cpp +++ b/src/auryn/AuditoryBeepGroup.cpp @@ -29,11 +29,11 @@ using namespace auryn; void AuditoryBeepGroup::init ( AurynFloat duration, AurynFloat interval, AurynFloat rate ) { - stimulus_duration = duration/dt; + stimulus_duration = duration/auryn_timestep; if ( duration < interval ) - stimulation_period = interval/dt-stimulus_duration; + stimulation_period = interval/auryn_timestep-stimulus_duration; else - stimulation_period = interval/dt; + stimulation_period = interval/auryn_timestep; stimulus_active = false; next_event = 0; diff --git a/src/auryn/BinarySpikeMonitor.cpp b/src/auryn/BinarySpikeMonitor.cpp index 8c645a0e..539b49b6 100644 --- a/src/auryn/BinarySpikeMonitor.cpp +++ b/src/auryn/BinarySpikeMonitor.cpp @@ -67,7 +67,7 @@ void BinarySpikeMonitor::init(SpikingGroup * source, std::string filename, Neuro // the neuronID field contains a tag // encoding the version number SpikeEvent_type spikeData; - spikeData.time = (AurynTime)(1.0/dt); + spikeData.time = (AurynTime)(1.0/auryn_timestep); spikeData.neuronID = sys->build.tag_binary_spike_monitor; outfile.write((char*)&spikeData, sizeof(SpikeEvent_type)); } diff --git a/src/auryn/BinaryStateMonitor.cpp b/src/auryn/BinaryStateMonitor.cpp index fbe70a41..4247ec78 100644 --- a/src/auryn/BinaryStateMonitor.cpp +++ b/src/auryn/BinaryStateMonitor.cpp @@ -65,7 +65,7 @@ BinaryStateMonitor::BinaryStateMonitor(auryn_vector_float * state, NeuronID id, lastval = *target_variable; } -BinaryStateMonitor::BinaryStateMonitor(EulerTrace * trace, NeuronID id, std::string filename, AurynDouble sampling_interval): Monitor(filename, default_extension) +BinaryStateMonitor::BinaryStateMonitor(Trace * trace, NeuronID id, std::string filename, AurynDouble sampling_interval): Monitor(filename, default_extension) { if ( id >= trace->get_state_ptr()->size ) return; // do not register if neuron is out of vector range @@ -96,7 +96,7 @@ void BinaryStateMonitor::open_output_file(std::string filename) void BinaryStateMonitor::init(std::string filename, AurynDouble sampling_interval) { set_stop_time(10.0); - ssize = sampling_interval/dt; + ssize = sampling_interval/auryn_timestep; if ( ssize < 1 ) ssize = 1; enable_compression = true; @@ -109,7 +109,7 @@ void BinaryStateMonitor::init(std::string filename, AurynDouble sampling_interva // the neuronID field contains a tag // encoding the version number StateValue_type headerFrame; - headerFrame.time = (AurynTime)(1.0/dt); + headerFrame.time = (AurynTime)(1.0/auryn_timestep); headerFrame.value = sys->build.tag_binary_state_monitor; outfile.write((char*)&headerFrame, sizeof(StateValue_type)); } @@ -162,8 +162,8 @@ void BinaryStateMonitor::propagate() void BinaryStateMonitor::set_stop_time(AurynDouble time) { - AurynDouble stoptime = std::min( time, std::numeric_limits::max()*dt ); - t_stop = stoptime/dt; + AurynDouble stoptime = std::min( time, std::numeric_limits::max()*auryn_timestep ); + t_stop = stoptime/auryn_timestep; } void BinaryStateMonitor::record_for(AurynDouble time) @@ -171,6 +171,6 @@ void BinaryStateMonitor::record_for(AurynDouble time) if (time < 0) { auryn::logger->msg("Warning: Negative stop times not supported -- ingoring.",WARNING); } - else t_stop = auryn::sys->get_clock() + time/dt; + else t_stop = auryn::sys->get_clock() + time/auryn_timestep; auryn::logger->debug("Set record for times for monitor."); } diff --git a/src/auryn/BinaryStateMonitor.h b/src/auryn/BinaryStateMonitor.h index ac578e93..625b7a48 100644 --- a/src/auryn/BinaryStateMonitor.h +++ b/src/auryn/BinaryStateMonitor.h @@ -61,7 +61,7 @@ class BinaryStateMonitor : public Monitor /*! \brief The source neuron id to record from */ NeuronID nid; - /*! \brief The step size (sampling interval) in units of dt */ + /*! \brief The step size (sampling interval) in units of auryn_timestep */ AurynTime ssize; /*! \brief Defines the maximum recording time in AurynTime to save space. */ @@ -90,7 +90,7 @@ class BinaryStateMonitor : public Monitor * \param filename The filename of the file to dump the output to * \param sampling_interval The sampling interval in seconds */ - BinaryStateMonitor(SpikingGroup * source, NeuronID id, string statename, std::string filename="", AurynDouble sampling_interval=dt); + BinaryStateMonitor(SpikingGroup * source, NeuronID id, string statename, std::string filename="", AurynDouble sampling_interval=auryn_timestep); /*! \brief Alternative constructor * @@ -98,15 +98,15 @@ class BinaryStateMonitor : public Monitor * \param filename The filename of the file to dump the output to * \param sampling_interval The sampling interval in seconds */ - BinaryStateMonitor(auryn_vector_float * state, NeuronID id, std::string filename="", AurynDouble sampling_interval=dt); + BinaryStateMonitor(auryn_vector_float * state, NeuronID id, std::string filename="", AurynDouble sampling_interval=auryn_timestep); - /*! \brief EulerTrace constructor + /*! \brief Trace constructor * * \param trace The source synaptic trace * \param filename The filename of the file to dump the output to * \param sampling_interval The sampling interval in seconds */ - BinaryStateMonitor(EulerTrace * trace, NeuronID id, std::string filename="", AurynDouble sampling_interval=dt); + BinaryStateMonitor(Trace * trace, NeuronID id, std::string filename="", AurynDouble sampling_interval=auryn_timestep); /*! \brief Sets relative time at which to stop recording * diff --git a/src/auryn/Connection.cpp b/src/auryn/Connection.cpp index 7ff0184a..4ac0199b 100644 --- a/src/auryn/Connection.cpp +++ b/src/auryn/Connection.cpp @@ -253,17 +253,17 @@ AurynFloat Connection::get_spike_attribute(const NeuronID spike_array_pos, const return src->get_attributes()->at(stackpos); } -DEFAULT_TRACE_MODEL * Connection::get_pre_trace(const AurynDouble tau) +Trace * Connection::get_pre_trace(const AurynDouble tau) { return src->get_pre_trace(tau); } -DEFAULT_TRACE_MODEL * Connection::get_post_trace(const AurynDouble tau) +Trace * Connection::get_post_trace(const AurynDouble tau) { return dst->get_post_trace(tau); } -DEFAULT_TRACE_MODEL * Connection::get_post_state_trace(const string state_name, const AurynDouble tau, const AurynDouble jump_size) +Trace * Connection::get_post_state_trace(const string state_name, const AurynDouble tau, const AurynDouble jump_size) { return dst->get_post_state_trace(state_name, tau, jump_size); } diff --git a/src/auryn/Connection.h b/src/auryn/Connection.h index 1775083f..58c68f67 100644 --- a/src/auryn/Connection.h +++ b/src/auryn/Connection.h @@ -33,6 +33,7 @@ #include "AurynVector.h" #include "SpikingGroup.h" #include "NeuronGroup.h" +#include "Trace.h" namespace auryn { @@ -221,13 +222,13 @@ class Connection /*! \brief Returns a pointer to a presynaptic trace object */ - DEFAULT_TRACE_MODEL * get_pre_trace(const AurynDouble tau); + Trace * get_pre_trace(const AurynDouble tau); /*! \brief Returns a pointer to a postsynaptic trace object */ - DEFAULT_TRACE_MODEL * get_post_trace(const AurynDouble tau); + Trace * get_post_trace(const AurynDouble tau); /*! \brief Returns a pointer to a postsynaptic state trace object */ - DEFAULT_TRACE_MODEL * get_post_state_trace(const string state_name, const AurynDouble tau, const AurynDouble jump_size=0.0); + Trace * get_post_state_trace(const string state_name, const AurynDouble tau, const AurynDouble jump_size=0.0); /*! \brief Computes mean synaptic weight and std dev of all weights in this connection. */ virtual void stats(AurynDouble &mean, AurynDouble &std, StateID zid = 0) = 0; diff --git a/src/auryn/CorrelatedPoissonGroup.cpp b/src/auryn/CorrelatedPoissonGroup.cpp index f3ad1006..8c71b2a4 100644 --- a/src/auryn/CorrelatedPoissonGroup.cpp +++ b/src/auryn/CorrelatedPoissonGroup.cpp @@ -38,7 +38,7 @@ void CorrelatedPoissonGroup::init(AurynDouble rate, NeuronID gsize, AurynDouble groupsize = global2rank(gsize); ngroups = size/gsize; remainersize = get_rank_size()-ngroups*groupsize; - delay = timedelay/dt; + delay = timedelay/auryn_timestep; offset = 0; amplitude = 1.0; @@ -73,7 +73,7 @@ void CorrelatedPoissonGroup::init(AurynDouble rate, NeuronID gsize, AurynDouble x = new NeuronID [ngroups]; for ( unsigned int i = 0 ; i < ngroups ; ++i ) { AurynDouble r = log(1-(AurynDouble)(*die)())/(-lambda); - x[i] += (NeuronID)(r/dt); + x[i] += (NeuronID)(r/auryn_timestep); } oss.str(""); @@ -121,25 +121,25 @@ void CorrelatedPoissonGroup::evolve() if ( tstop && auryn::sys->get_clock() > tstop ) return; // move amplitude - amplitude += (target_amplitude-amplitude)*dt/tau_amplitude; + amplitude += (target_amplitude-amplitude)*auryn_timestep/tau_amplitude; // integrate Ornstein Uhlenbeck process - o += ( mean - o )*dt/timescale; + o += ( mean - o )*auryn_timestep/timescale; // noise increment - o += 2.0*((AurynDouble)(*die)()-0.5)*sqrt(dt/timescale)*amplitude; + o += 2.0*((AurynDouble)(*die)()-0.5)*sqrt(auryn_timestep/timescale)*amplitude; int len = delay*ngroups; delay_o[auryn::sys->get_clock()%len] = std::max(thr,o*lambda); for ( unsigned int g = 0 ; g < ngroups ; ++g ) { AurynDouble grouprate = delay_o[(auryn::sys->get_clock()-(g+offset)*delay)%len]; - AurynDouble r = -log(1-(AurynDouble)(*die)())/(dt*grouprate); // think before tempering with this! + AurynDouble r = -log(1-(AurynDouble)(*die)())/(auryn_timestep*grouprate); // think before tempering with this! // I already broke the corde here once! x[g] = (NeuronID)(r); while ( x[g] < groupsize ) { push_spike ( g*groupsize + x[g] ); - AurynDouble r = -log(1-(AurynDouble)(*die)())/(dt*grouprate); + AurynDouble r = -log(1-(AurynDouble)(*die)())/(auryn_timestep*grouprate); x[g] += (NeuronID)(r); } } @@ -182,6 +182,6 @@ void CorrelatedPoissonGroup::set_offset(int off) void CorrelatedPoissonGroup::set_stoptime(AurynDouble stoptime) { - tstop = stoptime*dt; + tstop = stoptime*auryn_timestep; auryn::logger->parameter("stoptime",stoptime); } diff --git a/src/auryn/CubaIFGroup.cpp b/src/auryn/CubaIFGroup.cpp index 5d53ec02..9b090643 100644 --- a/src/auryn/CubaIFGroup.cpp +++ b/src/auryn/CubaIFGroup.cpp @@ -35,7 +35,7 @@ CubaIFGroup::CubaIFGroup(NeuronID size) : NeuronGroup(size) void CubaIFGroup::calculate_scale_constants() { - scale_mem = dt/tau_mem; + scale_mem = auryn_timestep/tau_mem; } void CubaIFGroup::init() @@ -147,5 +147,5 @@ void CubaIFGroup::load_input_line(NeuronID i, const char * buf) void CubaIFGroup::set_refractory_period(AurynDouble t) { - refractory_time = (unsigned short) (t/dt); + refractory_time = (unsigned short) (t/auryn_timestep); } diff --git a/src/auryn/CurrentInjector.cpp b/src/auryn/CurrentInjector.cpp index 1860f1e8..2445888d 100644 --- a/src/auryn/CurrentInjector.cpp +++ b/src/auryn/CurrentInjector.cpp @@ -38,7 +38,7 @@ CurrentInjector::CurrentInjector(NeuronGroup * target, std::string neuron_state_ auryn_vector_float_set_all( currents, initial_current ); - alpha = dt; + alpha = auryn_timestep; } diff --git a/src/auryn/CurrentInjector.h b/src/auryn/CurrentInjector.h index db2fede5..4a0c562b 100644 --- a/src/auryn/CurrentInjector.h +++ b/src/auryn/CurrentInjector.h @@ -39,7 +39,7 @@ namespace auryn { /*! \brief Stimulator class to add values in each timestep to arbitrary neuronal states. * * Most commonly used to inject "currents" to arbitraty neuronal states. Maintains an internal vector with - * numbers which are added (times dt) in each timestep to the neuronal target vector + * numbers which are added (times auryn_timestep) in each timestep to the neuronal target vector * (per default that is the membrane voltage and hence the operation corresponds to injecting a current). * */ @@ -59,7 +59,7 @@ class CurrentInjector : protected Device /*! Returns the lambda parameter of the pmf for Current. */ AurynFloat get_lambda(); - /*! Scale factor which should include dt and any respective resistance. */ + /*! Scale factor which should include auryn_timestep and any respective resistance. */ AurynFloat alpha; protected: diff --git a/src/auryn/DelayedSpikeMonitor.cpp b/src/auryn/DelayedSpikeMonitor.cpp index 1d2dc1ca..ef8bcf1a 100644 --- a/src/auryn/DelayedSpikeMonitor.cpp +++ b/src/auryn/DelayedSpikeMonitor.cpp @@ -77,7 +77,7 @@ void DelayedSpikeMonitor::propagate() for (it = src->get_spikes()->begin() ; it != src->get_spikes()->end() ; ++it ) { if (*it >= n_from ) { if ( *it < n_to ) - outfile << dt*(auryn::sys->get_clock()) << " " << *it+offset << "\n"; + outfile << auryn_timestep*(auryn::sys->get_clock()) << " " << *it+offset << "\n"; } } } diff --git a/src/auryn/EulerTrace.cpp b/src/auryn/EulerTrace.cpp index b1f3dfa8..050354e3 100644 --- a/src/auryn/EulerTrace.cpp +++ b/src/auryn/EulerTrace.cpp @@ -27,11 +27,11 @@ using namespace auryn; -void EulerTrace::init(NeuronID n, AurynFloat timeconstant) +void EulerTrace::init(NeuronID n, AurynFloat timeconstant) { - size = n; - set_timeconstant(timeconstant); - state = new AurynStateVector ( calculate_vector_size(size) ); + // size = n; + // set_timeconstant(timeconstant); + // state = new AurynStateVector ( calculate_vector_size(size) ); temp = new AurynStateVector ( calculate_vector_size(size) ); // temp vector set_all(0.); target_ptr = NULL; @@ -39,11 +39,10 @@ void EulerTrace::init(NeuronID n, AurynFloat timeconstant) void EulerTrace::free() { - delete state; delete temp; } -EulerTrace::EulerTrace(NeuronID n, AurynFloat timeconstant) +EulerTrace::EulerTrace(NeuronID n, AurynFloat timeconstant) : Trace(n, timeconstant) { init(n,timeconstant); } @@ -55,85 +54,27 @@ EulerTrace::~EulerTrace() void EulerTrace::set_timeconstant(AurynFloat timeconstant) { - tau = timeconstant; - scale_const = exp(-dt/tau); -} - -void EulerTrace::set(NeuronID i , AurynFloat value) -{ - state->set( i, value); -} - -void EulerTrace::set_all(AurynFloat value) -{ - state->set_all(value); -} - -void EulerTrace::add(AurynStateVector * values) -{ - state->add( values ); -} - -void EulerTrace::add(NeuronID i, AurynFloat value) -{ - // auryn_vector_float_set (state, i, auryn_vector_float_get (state, i) + value); - state->data[i] += value; + super::set_timeconstant(timeconstant); + mul_follow = auryn_timestep/tau; + scale_const = std::exp(-mul_follow); } void EulerTrace::set_target( AurynStateVector * target ) { if ( target != NULL ) { target_ptr = target ; - state->copy(target); + copy(target); } } -void EulerTrace::set_target( EulerTrace * target ) -{ - set_target( target->state ); -} - void EulerTrace::evolve() { - state->scale(scale_const); + scale(scale_const); } void EulerTrace::follow() { - temp->copy( state ); - auryn_vector_float_saxpy( -1., target_ptr, temp ); - auryn_vector_float_saxpy( -dt/tau, temp, state ); + temp->diff(this,target_ptr); + saxpy(-auryn_timestep/tau, temp ); } -AurynStateVector * EulerTrace::get_state_ptr() -{ - return state; -} - -AurynFloat EulerTrace::get_tau() -{ - return tau; -} - -void EulerTrace::inc(NeuronID i) -{ - state->data[i]++; -} - -void EulerTrace::inc(SpikeContainer * sc) -{ - for ( NeuronID i = 0 ; i < sc->size() ; ++i ) - inc((*sc)[i]); -} - -AurynFloat EulerTrace::normalized_get(NeuronID i) -{ - check_size(i); - return state->get( i ) / tau ; -} - - -void EulerTrace::clip(AurynState value) -{ - state->clip( 0.0, value); -} diff --git a/src/auryn/EulerTrace.h b/src/auryn/EulerTrace.h index dc8603cb..c5e254a5 100644 --- a/src/auryn/EulerTrace.h +++ b/src/auryn/EulerTrace.h @@ -26,8 +26,8 @@ #ifndef EULERTRACE_H_ #define EULERTRACE_H_ +#include "Trace.h" #include "auryn_definitions.h" -#include "AurynVector.h" namespace auryn { @@ -40,31 +40,21 @@ namespace auryn { * using the analytic solution. This results in less updates. However - so far * it turned out to be inferior in performance to the EulerTrace. */ -class EulerTrace +class EulerTrace : public Trace { private: - /* Functions necesssary for serialization */ - friend class boost::serialization::access; - template - void serialize(Archive & ar, const unsigned int version) - { - ar & size ; - for ( NeuronID i = 0 ; i < size ; ++i ) - ar & state->data[i]; - } - - /*! The size of the group. */ - NeuronID size; - /*! The internal state vector. */ - AurynStateVector * state; + typedef Trace super; /*! The target vector for follow operation. */ AurynStateVector * target_ptr; + /*! Temp update vector for follow operation. */ AurynStateVector * temp; + /*! Multiplicative factor to downscale the values in every timestep. */ AurynFloat scale_const; - /*! Decay time constant in [s]. */ - AurynFloat tau; + + /*! \brief precomputed euler upgrade step size. */ + AurynFloat mul_follow; void init(NeuronID n, AurynFloat timeconstant); void free(); @@ -86,71 +76,20 @@ class EulerTrace EulerTrace(NeuronID n, AurynFloat timeconstant); /*! Default destructor */ virtual ~EulerTrace(); - /*! Set value of a single trace. - * \param i Id of value to change. - * \param value The actual value to set the trace to.*/ - void set(NeuronID i , AurynFloat value); - /*! Set all traces to same value */ - void set_all( AurynFloat value); - /*! Add AurynStateVector to state vector - * \param values AurynStateVector to add - */ - void add(AurynStateVector * values); - /*! Add designated value to single trace in the group. - * \param i index of trace to change - * \param value value to add to the trace - */ - void add(NeuronID i , AurynFloat value); - - /*! Increment given trace by 1. - * \param i index of trace to increment. - */ - void inc(NeuronID i); - - /*! Increment given traces by 1. - * \param sc SpikeContainer with all neurons to increment. - */ - void inc(SpikeContainer * sc); /*! Perform Euler step. */ void evolve(); - /*! Clip trace values (0,val) . */ - void clip(AurynState val=1.0); - /*! Set the time constant of the trace */ void set_timeconstant( AurynFloat timeconstant ); /*! set the target vector for follow operation */ void set_target( AurynStateVector * target ); - /*! set the target vector for follow operation */ - void set_target( EulerTrace * target ); - /*! Perform Euler step but follow target vector instead of zero-decay */ void follow(); - /*! Get decay time constant */ - AurynFloat get_tau(); - /*! Get trace value of trace. - * Since this is functions is called a lot - * we inline it manually. - * \param i index of trace to get - */ - inline AurynFloat get(NeuronID i); - /*! Get trace value of trace dived by tau - * \param i index of trace to get - */ - AurynFloat normalized_get(NeuronID i); - /*! Get pointer to state AurynStateVector for fast processing within the GSL vector framekwork. */ - AurynStateVector * get_state_ptr(); }; -inline AurynFloat EulerTrace::get(NeuronID i) -{ - check_size(i); - return state->data[i]; -} - } // namespace #endif /*EULERTRACE_H_*/ diff --git a/src/auryn/FileInputGroup.cpp b/src/auryn/FileInputGroup.cpp index 1e70aa11..30b9a8c1 100644 --- a/src/auryn/FileInputGroup.cpp +++ b/src/auryn/FileInputGroup.cpp @@ -49,7 +49,7 @@ FileInputGroup::FileInputGroup(NeuronID n, std::string filename, : SpikingGroup( n , 0.0 ) { playinloop = loop; - time_delay = (AurynTime) (delay/dt); + time_delay = (AurynTime) (delay/auryn_timestep); time_offset = 0; init(filename); } @@ -79,7 +79,7 @@ void FileInputGroup::load_spikes(std::string filename) std::stringstream line ( buffer ) ; double t_tmp; line >> t_tmp; - event.time = t_tmp/dt; + event.time = t_tmp/auryn_timestep; line >> event.neuronID; if ( localrank(event.neuronID) ) { input_spikes.push_back(event); @@ -120,7 +120,7 @@ void FileInputGroup::evolve() if ( sys->get_clock() == reset_time ) { spike_iter = input_spikes.begin(); time_offset = sys->get_clock(); - // std::cout << "set to" << reset_time*dt << " " << time_offset << std::endl; + // std::cout << "set to" << reset_time*auryn_timestep << " " << time_offset << std::endl; } while ( spike_iter != input_spikes.end() && (*spike_iter).time <= get_offset_clock() ) { @@ -142,7 +142,7 @@ void FileInputGroup::evolve() void FileInputGroup::set_loop_grid(AurynDouble grid_size) { if ( grid_size > 0.0 ) { - loop_grid_size = 1.0/dt*grid_size; + loop_grid_size = 1.0/auryn_timestep*grid_size; if ( loop_grid_size == 0 ) loop_grid_size = 1; } } diff --git a/src/auryn/FileModulatedPoissonGroup.cpp b/src/auryn/FileModulatedPoissonGroup.cpp index 5a020484..1f581b9f 100644 --- a/src/auryn/FileModulatedPoissonGroup.cpp +++ b/src/auryn/FileModulatedPoissonGroup.cpp @@ -66,7 +66,7 @@ void FileModulatedPoissonGroup::evolve() rate_n = get_rate(); line >> t; - ftime = (AurynTime) (t/dt+0.5); + ftime = (AurynTime) (t/auryn_timestep+0.5); line >> r; if ( ftime < auryn::sys->get_clock() || inputfile.eof() ) { // if the recently read point is already in the past -> reinit interpolation diff --git a/src/auryn/IFGroup.cpp b/src/auryn/IFGroup.cpp index 280d5662..d04cd7ed 100644 --- a/src/auryn/IFGroup.cpp +++ b/src/auryn/IFGroup.cpp @@ -35,9 +35,9 @@ IFGroup::IFGroup( NeuronID size, AurynFloat load, NeuronID total ) : NeuronGroup void IFGroup::calculate_scale_constants() { - scale_ampa = exp(-dt/tau_ampa) ; - scale_gaba = exp(-dt/tau_gaba) ; - scale_thr = exp(-dt/tau_thr) ; + scale_ampa = exp(-auryn_timestep/tau_ampa) ; + scale_gaba = exp(-auryn_timestep/tau_gaba) ; + scale_thr = exp(-auryn_timestep/tau_thr) ; } void IFGroup::init() @@ -84,12 +84,12 @@ IFGroup::~IFGroup() void IFGroup::integrate_linear_nmda_synapses() { - // decay of ampa and gaba channel, i.e. multiply by exp(-dt/tau) + // decay of ampa and gaba channel, i.e. multiply by exp(-auryn_timestep/tau) g_ampa->scale(scale_ampa); g_gaba->scale(scale_gaba); - // compute dg_nmda = (g_ampa-g_nmda)*dt/tau_nmda and add to g_nmda - const AurynFloat mul_nmda = dt/tau_nmda; + // compute dg_nmda = (g_ampa-g_nmda)*auryn_timestep/tau_nmda and add to g_nmda + const AurynFloat mul_nmda = auryn_timestep/tau_nmda; g_nmda->saxpy(mul_nmda, g_ampa); g_nmda->saxpy(-mul_nmda, g_nmda); @@ -117,7 +117,7 @@ void IFGroup::integrate_membrane() t_leak->diff(mem,e_rest); // membrane dynamics - const AurynFloat mul_tau_mem = dt/tau_mem; + const AurynFloat mul_tau_mem = auryn_timestep/tau_mem; mem->saxpy(mul_tau_mem,t_exc); mem->saxpy(-mul_tau_mem,t_inh); mem->saxpy(-mul_tau_mem,t_leak); diff --git a/src/auryn/IafPscDeltaGroup.cpp b/src/auryn/IafPscDeltaGroup.cpp index ea51d195..640452b5 100644 --- a/src/auryn/IafPscDeltaGroup.cpp +++ b/src/auryn/IafPscDeltaGroup.cpp @@ -35,7 +35,7 @@ IafPscDeltaGroup::IafPscDeltaGroup(NeuronID size) : NeuronGroup(size) void IafPscDeltaGroup::calculate_scale_constants() { - scale_mem = dt/tau_mem; + scale_mem = auryn_timestep/tau_mem; } void IafPscDeltaGroup::init() @@ -60,7 +60,7 @@ void IafPscDeltaGroup::init() void IafPscDeltaGroup::set_tau_ref(AurynFloat tau_ref) { - refractory_time = (unsigned short) (tau_ref/dt); + refractory_time = (unsigned short) (tau_ref/auryn_timestep); } void IafPscDeltaGroup::clear() diff --git a/src/auryn/IafPscExpGroup.cpp b/src/auryn/IafPscExpGroup.cpp index 43328829..33d24236 100644 --- a/src/auryn/IafPscExpGroup.cpp +++ b/src/auryn/IafPscExpGroup.cpp @@ -35,8 +35,8 @@ IafPscExpGroup::IafPscExpGroup(NeuronID size) : NeuronGroup(size) void IafPscExpGroup::calculate_scale_constants() { - scale_mem = dt/tau_mem; - scale_syn = exp(-dt/tau_syn); + scale_mem = auryn_timestep/tau_mem; + scale_syn = exp(-auryn_timestep/tau_syn); } void IafPscExpGroup::init() @@ -161,7 +161,7 @@ void IafPscExpGroup::set_tau_syn(AurynFloat tau) void IafPscExpGroup::set_refractory_period(AurynDouble t) { - refractory_time = (unsigned short) (t/dt); + refractory_time = (unsigned short) (t/auryn_timestep); } void IafPscExpGroup::virtual_serialize(boost::archive::binary_oarchive & ar, const unsigned int version ) diff --git a/src/auryn/IzhikevichGroup.cpp b/src/auryn/IzhikevichGroup.cpp index 97217cbe..053c815c 100644 --- a/src/auryn/IzhikevichGroup.cpp +++ b/src/auryn/IzhikevichGroup.cpp @@ -83,8 +83,8 @@ void IzhikevichGroup::check_thresholds() void IzhikevichGroup::calculate_scale_constants() { - scale_ampa = exp(-dt/tau_ampa) ; - scale_gaba = exp(-dt/tau_gaba) ; + scale_ampa = exp(-auryn_timestep/tau_ampa) ; + scale_gaba = exp(-auryn_timestep/tau_gaba) ; } @@ -114,14 +114,14 @@ void IzhikevichGroup::evolve() temp_vector->sub(cur_inh); // update membrane voltage - mem->saxpy(dt/1e-3,temp_vector); // division by 1e-3 due to rescaling of time from ms -> s + mem->saxpy(auryn_timestep/1e-3,temp_vector); // division by 1e-3 due to rescaling of time from ms -> s // update adaptation variable temp_vector->copy(mem); temp_vector->scale(bvar); temp_vector->sub(adaptation_vector); - adaptation_vector->saxpy(avar*dt/1e-3,temp_vector); + adaptation_vector->saxpy(avar*auryn_timestep/1e-3,temp_vector); check_thresholds(); diff --git a/src/auryn/LPTripletConnection.cpp b/src/auryn/LPTripletConnection.cpp index 1e67f0ea..24f7588a 100644 --- a/src/auryn/LPTripletConnection.cpp +++ b/src/auryn/LPTripletConnection.cpp @@ -58,8 +58,8 @@ void LPTripletConnection::init(AurynFloat tau_hom, AurynFloat eta, AurynFloat ka stdp_active = true; tau_lp = 120; - timestep_lp = 1e-3*tau_lp/dt; - delta_lp = 1.0*timestep_lp/tau_lp*dt; + timestep_lp = 1e-3*tau_lp/auryn_timestep; + delta_lp = 1.0*timestep_lp/tau_lp*auryn_timestep; // Set number of synaptic states diff --git a/src/auryn/LPTripletConnection.h b/src/auryn/LPTripletConnection.h index 500c975d..cc371c64 100644 --- a/src/auryn/LPTripletConnection.h +++ b/src/auryn/LPTripletConnection.h @@ -30,11 +30,8 @@ #include "AurynVector.h" #include "DuplexConnection.h" #include "EulerTrace.h" -#include "LinearTrace.h" #include "SpikeDelay.h" -#define TRACE EulerTrace - namespace auryn { @@ -84,12 +81,12 @@ class LPTripletConnection : public DuplexConnection AurynDouble hom_fudge; /* Definitions of presynaptic traces */ - PRE_TRACE_MODEL * tr_pre; + Trace * tr_pre; /* Definitions of postsynaptic traces */ - DEFAULT_TRACE_MODEL * tr_post; - DEFAULT_TRACE_MODEL * tr_post2; - DEFAULT_TRACE_MODEL * tr_post_hom; + Trace * tr_post; + Trace * tr_post2; + Trace * tr_post_hom; // temporary state vector diff --git a/src/auryn/LinearTrace.cpp b/src/auryn/LinearTrace.cpp index 04336598..0c386d2c 100644 --- a/src/auryn/LinearTrace.cpp +++ b/src/auryn/LinearTrace.cpp @@ -27,33 +27,24 @@ using namespace auryn; -void LinearTrace::init(NeuronID n, AurynFloat timeconstant, AurynTime * clk) +void LinearTrace::init(NeuronID n, AurynFloat timeconstant) { - size = n; - tau = timeconstant; - tau_auryntime = (AurynTime) (timeconstant/dt); + tau_auryntime = (AurynTime) (timeconstant/auryn_timestep); zerointerval = 5*tau_auryntime; // clock = auryn::sys->get_clock_ptr(); - clock = clk; - state = new AurynFloat[size]; + clock = sys->get_clock_ptr(); timestamp = new AurynTime[size]; - for (NeuronID i = 0 ; i < size ; ++i ) - { - state[i] = 0.; - timestamp[i] = 0; - } } void LinearTrace::free() { - delete [] state; delete [] timestamp; } -LinearTrace::LinearTrace(NeuronID n, AurynFloat timeconstant, AurynTime * clk) +LinearTrace::LinearTrace(NeuronID n, AurynFloat timeconstant) : super(n, timeconstant) { - init(n,timeconstant,clk); + init(n,timeconstant); } LinearTrace::~LinearTrace() @@ -61,60 +52,41 @@ LinearTrace::~LinearTrace() free(); } -void LinearTrace::set(NeuronID i , AurynFloat value) -{ - state[i] = value; -} - -void LinearTrace::setall(AurynFloat value) -{ - for (NeuronID i = 0 ; i < size ; ++i ) - set(i,value); -} - -void LinearTrace::add(NeuronID i, AurynFloat value) -{ - update(i); - state[i] += value; -} - -AurynFloat * LinearTrace::get_state_ptr() -{ - return state; -} - -AurynFloat LinearTrace::get_tau() -{ - return tau; -} -inline void LinearTrace::update(NeuronID i) +void LinearTrace::update(NeuronID i) { const int timediff = *clock - timestamp[i]; if ( timediff == 0 ) return; if ( timediff >= zerointerval ) { - state[i] = 0.0; + data[i] = 0.0; } else { // as a last resort call exp - state[i] *= std::exp( -(dt*timediff)/tau); + data[i] *= std::exp( -(auryn_timestep*timediff)/tau); } timestamp[i] = *clock; } +void LinearTrace::add_specific(NeuronID i, AurynState amount) +{ + update(i); + super::add_specific(i, amount); +} + void LinearTrace::inc(NeuronID i) { update(i); - state[i] += 1.0; + data[i] += 1.0; } AurynFloat LinearTrace::get(NeuronID i) { update(i); - return state[i]; + return super::get(i); } void LinearTrace::evolve() { + // lazy on evolve updates on get and inc } diff --git a/src/auryn/LinearTrace.h b/src/auryn/LinearTrace.h index 377885f4..3440264e 100644 --- a/src/auryn/LinearTrace.h +++ b/src/auryn/LinearTrace.h @@ -27,42 +27,37 @@ #define LINEARTRACE_H_ #include "auryn_definitions.h" -#include "AurynVector.h" +#include "auryn_global.h" +#include "EulerTrace.h" namespace auryn { -/*! \brief Exponential synaptic trace which exactly solves in an event-based manner. +/*! \brief Exponential synaptic trace which exactly solves in an event-based manner in non-follow scenarios. * - * Since this trace is normally slower than brut-force computing all traces + * Since this trace is normally slower than brute-force computing all traces * with forward Euler (EulerTrace), it is disabled by default. */ -class LinearTrace +class LinearTrace : public EulerTrace { private: - NeuronID size; - AurynFloat * state; - AurynFloat tau; + typedef EulerTrace super; AurynTime tau_auryntime; AurynTime zerointerval; AurynTime * timestamp; AurynTime * clock; - void init(NeuronID n, AurynFloat timeconstant, AurynTime * clk); + void init(NeuronID n, AurynFloat timeconstant); void free(); public: - LinearTrace(NeuronID n, AurynFloat timeconstant, AurynTime * clk); + LinearTrace(NeuronID n, AurynFloat timeconstant); virtual ~LinearTrace(); - void set(NeuronID i , AurynFloat value); - void setall( AurynFloat value); - void add(NeuronID i , AurynFloat value); void inc(NeuronID i); - inline void update(NeuronID i); - void evolve(); - AurynFloat get_tau(); + void add_specific(NeuronID i, AurynState amount); AurynFloat get(NeuronID i); - AurynFloat * get_state_ptr(); + void update(NeuronID i); + void evolve(); }; } diff --git a/src/auryn/MovingBumpGroup.cpp b/src/auryn/MovingBumpGroup.cpp index adb92749..c007fd60 100644 --- a/src/auryn/MovingBumpGroup.cpp +++ b/src/auryn/MovingBumpGroup.cpp @@ -31,7 +31,7 @@ boost::mt19937 MovingBumpGroup::order_gen = boost::mt19937(); void MovingBumpGroup::init ( AurynFloat duration, NeuronID width, std::string outputfile ) { - stimulus_duration = duration/dt; + stimulus_duration = duration/auryn_timestep; set_width(0.1*get_size()); set_floor(0.1); @@ -55,7 +55,7 @@ void MovingBumpGroup::init ( AurynFloat duration, NeuronID width, std::string ou exit(1); } tiserfile.setf(std::ios::fixed); - tiserfile.precision(log(dt)/log(10)+1 ); + tiserfile.precision(log(auryn_timestep)/log(10)+1 ); } diff --git a/src/auryn/PairInteractionConnection.cpp b/src/auryn/PairInteractionConnection.cpp index b9f38a28..07071238 100644 --- a/src/auryn/PairInteractionConnection.cpp +++ b/src/auryn/PairInteractionConnection.cpp @@ -178,7 +178,7 @@ void PairInteractionConnection::load_window_from_file( const char * filename , d if ( size > 2*WINDOW_MAX_SIZE ) auryn::logger->msg("PairInteractionConnection:: STDP window too large ... truncating!",WARNING); - if ( dt < timebinsize ) + if ( auryn_timestep < timebinsize ) auryn::logger->msg("PairInteractionConnection:: Timebinning of loaded STDP window is different from simulator timestep.",WARNING); double sum_pre_post = 0 ; @@ -188,14 +188,14 @@ void PairInteractionConnection::load_window_from_file( const char * filename , d while ( infile.getline (buffer,256) ) { sscanf (buffer,"%f %f",&time,&value); - if ( abs(time) < WINDOW_MAX_SIZE*dt ) { + if ( abs(time) < WINDOW_MAX_SIZE*auryn_timestep ) { NeuronID start; if ( time < 0 ) { - start = -(time+dt/2)/dt; // plus element is for correct rounding + start = -(time+auryn_timestep/2)/auryn_timestep; // plus element is for correct rounding window_post_pre[start] = scale*value; sum_post_pre += scale*value; } else { - start = (time+dt/2)/dt; + start = (time+auryn_timestep/2)/auryn_timestep; window_pre_post[start] = scale*value; sum_pre_post += scale*value; } @@ -226,11 +226,11 @@ void PairInteractionConnection::load_window_from_file( const char * filename , d void PairInteractionConnection::set_exponential_window ( double Aplus, double tau_plus, double Aminus, double tau_minus) { for ( int i = 0 ; i < WINDOW_MAX_SIZE ; ++i ) { - window_pre_post[i] = Aplus/tau_plus*exp(-i*dt/tau_plus); + window_pre_post[i] = Aplus/tau_plus*exp(-i*auryn_timestep/tau_plus); } for ( int i = 0 ; i < WINDOW_MAX_SIZE ; ++i ) { - window_post_pre[i] = Aminus/tau_minus*exp(-i*dt/tau_minus); + window_post_pre[i] = Aminus/tau_minus*exp(-i*auryn_timestep/tau_minus); } // zero floor terms diff --git a/src/auryn/PairInteractionConnection.h b/src/auryn/PairInteractionConnection.h index 41fe165d..900d1d4a 100644 --- a/src/auryn/PairInteractionConnection.h +++ b/src/auryn/PairInteractionConnection.h @@ -26,7 +26,6 @@ #include "auryn_definitions.h" #include "AurynVector.h" #include "DuplexConnection.h" -#include "EulerTrace.h" namespace auryn { diff --git a/src/auryn/PatternMonitor.cpp b/src/auryn/PatternMonitor.cpp index c17e60cb..4308efb8 100644 --- a/src/auryn/PatternMonitor.cpp +++ b/src/auryn/PatternMonitor.cpp @@ -60,7 +60,7 @@ void PatternMonitor::init(SpikingGroup * source, std::string filename, NeuronID src = source; bsize = binsize; - ssize = bsize/dt; + ssize = bsize/auryn_timestep; if ( ssize < 1 ) ssize = 1; maxpat = maximum_patterns; @@ -87,7 +87,7 @@ void PatternMonitor::propagate() } if (auryn::sys->get_clock()%ssize==0) { - outfile << dt*(auryn::sys->get_clock()); + outfile << auryn_timestep*(auryn::sys->get_clock()); for ( std::vector::iterator pattern = patterns->begin() ; pattern != patterns->end() ; ++pattern ) { double sum = 0.; diff --git a/src/auryn/PatternMonitor.h b/src/auryn/PatternMonitor.h index dad9c287..7d193f5e 100644 --- a/src/auryn/PatternMonitor.h +++ b/src/auryn/PatternMonitor.h @@ -49,7 +49,7 @@ class PatternMonitor : protected Monitor private: /*! Array used to count the spike events of the src SpikingGroup */ NeuronID * counter; - /*! Stepsize = binsize in units of AurynTime (dt) */ + /*! Stepsize = binsize in units of AurynTime (auryn_timestep) */ AurynTime ssize; /*! Binsize used in seconds */ AurynDouble bsize; diff --git a/src/auryn/PatternStimulator.cpp b/src/auryn/PatternStimulator.cpp index e9b1ecdf..16eb6175 100644 --- a/src/auryn/PatternStimulator.cpp +++ b/src/auryn/PatternStimulator.cpp @@ -91,7 +91,7 @@ void PatternStimulator::propagate() std::stringstream iss (line); double time; iss >> time; - filetime = time/dt; + filetime = time/auryn_timestep; for ( unsigned int column = 0 ; column < patterns->size() ; ++column ) { float cur; @@ -105,7 +105,7 @@ void PatternStimulator::propagate() for ( std::vector::const_iterator pattern = patterns->begin() ; pattern != patterns->end() ; ++pattern ) { for ( type_pattern::const_iterator piter = pattern->begin() ; piter != pattern->end() ; ++piter ) { - mem->data[piter->i] += *cur_iter * piter->gamma * scl * dt; + mem->data[piter->i] += *cur_iter * piter->gamma * scl * auryn_timestep; } ++cur_iter; } diff --git a/src/auryn/PoissonGroup.cpp b/src/auryn/PoissonGroup.cpp index 8888019d..9b5cda75 100644 --- a/src/auryn/PoissonGroup.cpp +++ b/src/auryn/PoissonGroup.cpp @@ -62,11 +62,11 @@ PoissonGroup::~PoissonGroup() void PoissonGroup::set_rate(AurynDouble rate) { - lambda = 1.0/(1.0/rate-dt); + lambda = 1.0/(1.0/rate-auryn_timestep); if ( evolve_locally() ) { if ( rate > 0.0 ) { AurynDouble r = -log((*die)()+1e-128)/lambda; - x = (NeuronID)(r/dt+0.5); + x = (NeuronID)(r/auryn_timestep+0.5); } else { // if the rate is zero this triggers one spike at the end of time/groupsize // this is the easiest way to take care of the zero rate case, which should @@ -89,7 +89,7 @@ void PoissonGroup::evolve() AurynDouble r = -log((*die)()+1e-128)/lambda; // we add 1.5: one to avoid two spikes per bin and 0.5 to // compensate for rounding effects from casting - x += (NeuronID)(r/dt+1.5); + x += (NeuronID)(r/auryn_timestep+1.5); // beware one induces systematic error that becomes substantial at high rates, but keeps neuron from spiking twice per time-step } x -= get_rank_size(); diff --git a/src/auryn/PoissonStimulator.cpp b/src/auryn/PoissonStimulator.cpp index 5d44baea..11b9c5c6 100644 --- a/src/auryn/PoissonStimulator.cpp +++ b/src/auryn/PoissonStimulator.cpp @@ -88,7 +88,7 @@ AurynFloat PoissonStimulator::get_rate() { } AurynFloat PoissonStimulator::get_lambda() { - return get_rate()*dt; + return get_rate()*auryn_timestep; } void PoissonStimulator::set_target_state(std::string state_name) { diff --git a/src/auryn/PopulationRateMonitor.cpp b/src/auryn/PopulationRateMonitor.cpp index f915c189..f8208778 100644 --- a/src/auryn/PopulationRateMonitor.cpp +++ b/src/auryn/PopulationRateMonitor.cpp @@ -42,7 +42,7 @@ void PopulationRateMonitor::init(SpikingGroup * source, std::string filename, Au src = source; invbsize = 1.0/binsize; - ssize = (1.0*binsize/dt); + ssize = (1.0*binsize/auryn_timestep); if ( ssize < 1 ) ssize = 1; counter = 0; diff --git a/src/auryn/PopulationRateMonitor.h b/src/auryn/PopulationRateMonitor.h index 3fecc59c..7c1d32e5 100644 --- a/src/auryn/PopulationRateMonitor.h +++ b/src/auryn/PopulationRateMonitor.h @@ -48,7 +48,7 @@ class PopulationRateMonitor : protected Monitor private: /*! Varible used to count the spike events of the src SpikingGroup */ NeuronID counter; - /*! Stepsize = binsize in units of AurynTime (dt) */ + /*! Stepsize = binsize in units of AurynTime (auryn_timestep) */ AurynTime ssize; /*! Binsize used in seconds */ AurynDouble invbsize; diff --git a/src/auryn/ProfilePoissonGroup.cpp b/src/auryn/ProfilePoissonGroup.cpp index 1b92d554..c8f40adc 100644 --- a/src/auryn/ProfilePoissonGroup.cpp +++ b/src/auryn/ProfilePoissonGroup.cpp @@ -70,7 +70,7 @@ void ProfilePoissonGroup::set_rate(AurynDouble rate) if ( evolve_locally() ) { if ( rate > 0.0 ) { AurynDouble r = -log((*die)())/lambda; - jumpsize = (r/dt); + jumpsize = (r/auryn_timestep); x = 0; } else { // if the rate is zero this triggers one spike at the end of time/groupsize @@ -162,7 +162,7 @@ void ProfilePoissonGroup::evolve() if ( jumpsize < 0 ) { // reached jump target -> spike push_spike ( x ); AurynDouble r = -log((*die)()+1e-20)/lambda; - jumpsize = r/dt; + jumpsize = r/auryn_timestep; } x++; } diff --git a/src/auryn/RateChecker.cpp b/src/auryn/RateChecker.cpp index 0e45d241..78013f0c 100644 --- a/src/auryn/RateChecker.cpp +++ b/src/auryn/RateChecker.cpp @@ -47,7 +47,7 @@ void RateChecker::init(AurynFloat min, AurynFloat max, AurynFloat tau) size = src->get_size(); popmin = min; popmax = max; - decay_multiplier = exp(-dt/tau); + decay_multiplier = exp(-auryn_timestep/tau); reset(); } diff --git a/src/auryn/RateModulatedConnection.cpp b/src/auryn/RateModulatedConnection.cpp index 4ef78486..d1ab6a29 100644 --- a/src/auryn/RateModulatedConnection.cpp +++ b/src/auryn/RateModulatedConnection.cpp @@ -32,7 +32,7 @@ void RateModulatedConnection::init() rate_target = 5; rate_estimate = rate_target; rate_estimate_tau = 1.0; - rate_estimate_decay_mul = exp(-dt/rate_estimate_tau); + rate_estimate_decay_mul = exp(-auryn_timestep/rate_estimate_tau); rate_modulation_exponent = 2; rate_modulation_mul = 1.0; diff --git a/src/auryn/RateMonitor.cpp b/src/auryn/RateMonitor.cpp index 6a84e703..9a7dfbef 100644 --- a/src/auryn/RateMonitor.cpp +++ b/src/auryn/RateMonitor.cpp @@ -41,7 +41,7 @@ void RateMonitor::init(SpikingGroup * source, std::string filename, AurynFloat s auryn::sys->register_device(this); src = source; - ssize = samplinginterval/dt; + ssize = samplinginterval/auryn_timestep; if ( ssize < 1 ) ssize = 1; tau_filter = 3*samplinginterval; @@ -59,7 +59,7 @@ void RateMonitor::propagate() { if ( src->evolve_locally() ) { if (auryn::sys->get_clock()%ssize==0) { - outfile << dt*(auryn::sys->get_clock()) << " "; + outfile << auryn_timestep*(auryn::sys->get_clock()) << " "; for (NeuronID i = 0 ; i < src->get_rank_size() ; ++i ) { outfile << tr_post->normalized_get(i) << " "; diff --git a/src/auryn/RateMonitor.h b/src/auryn/RateMonitor.h index 83794333..33ba22bf 100644 --- a/src/auryn/RateMonitor.h +++ b/src/auryn/RateMonitor.h @@ -26,13 +26,15 @@ #ifndef RATEMONITOR_H_ #define RATEMONITOR_H_ +#include +#include + #include "auryn_definitions.h" #include "AurynVector.h" #include "Monitor.h" #include "System.h" #include "SpikingGroup.h" -#include -#include +#include "Trace.h" namespace auryn { @@ -47,19 +49,18 @@ namespace auryn { class RateMonitor : protected Monitor { private: - /*! The sampling interval in units of AurynTime (dt) */ + /*! The sampling interval in units of AurynTime (auryn_timestep) */ AurynTime ssize; /*! Filter time constant in seconds (by default 3x the sampling interval). */ AurynDouble tau_filter; + Trace * tr_post; + protected: /*! The source SpikingGroup */ SpikingGroup * src; - /*! Trace varible used to count the spike events of the src SpikingGroup */ - DEFAULT_TRACE_MODEL * tr_post; - /*! Default init method */ void init(SpikingGroup * source, string filename, AurynFloat samplinginterval); diff --git a/src/auryn/RealTimeMonitor.cpp b/src/auryn/RealTimeMonitor.cpp index bc37aa99..d441672f 100644 --- a/src/auryn/RealTimeMonitor.cpp +++ b/src/auryn/RealTimeMonitor.cpp @@ -31,8 +31,8 @@ RealTimeMonitor::RealTimeMonitor(std::string filename, AurynDouble start, AurynD { auryn::sys->register_device(this); - t_start = start/dt; - t_stop = stop/dt; + t_start = start/auryn_timestep; + t_stop = stop/auryn_timestep; ptime_offset = boost::posix_time::microsec_clock::local_time(); diff --git a/src/auryn/STDPConnection.h b/src/auryn/STDPConnection.h index b889bac9..6fe3f24e 100644 --- a/src/auryn/STDPConnection.h +++ b/src/auryn/STDPConnection.h @@ -24,7 +24,7 @@ #include "auryn_definitions.h" #include "AurynVector.h" #include "DuplexConnection.h" -#include "EulerTrace.h" +#include "Trace.h" #include "LinearTrace.h" #include "SpikeDelay.h" @@ -47,8 +47,8 @@ class STDPConnection : public DuplexConnection AurynDouble hom_fudge; - PRE_TRACE_MODEL * tr_pre; - DEFAULT_TRACE_MODEL * tr_post; + Trace * tr_pre; + Trace * tr_post; void propagate_forward(); void propagate_backward(); diff --git a/src/auryn/STDPwdConnection.h b/src/auryn/STDPwdConnection.h index 66894d11..40bdfddf 100644 --- a/src/auryn/STDPwdConnection.h +++ b/src/auryn/STDPwdConnection.h @@ -70,8 +70,8 @@ class STDPwdConnection : public DuplexConnection NeuronID * bkw_ind; AurynWeight ** bkw_data; - PRE_TRACE_MODEL * tr_pre; - DEFAULT_TRACE_MODEL * tr_post; + Trace * tr_pre; + Trace * tr_post; AurynWeight fudge_pot; diff --git a/src/auryn/STPConnection.cpp b/src/auryn/STPConnection.cpp index 54d47288..a5fdb68a 100644 --- a/src/auryn/STPConnection.cpp +++ b/src/auryn/STPConnection.cpp @@ -141,12 +141,12 @@ void STPConnection::evolve() // dynamics of x auryn_vector_float_set_all( state_temp, 1); auryn_vector_float_saxpy(-1,state_x,state_temp); - auryn_vector_float_saxpy(dt/tau_d,state_temp,state_x); + auryn_vector_float_saxpy(auryn_timestep/tau_d,state_temp,state_x); // dynamics of u auryn_vector_float_set_all( state_temp, Ujump); auryn_vector_float_saxpy(-1,state_u,state_temp); - auryn_vector_float_saxpy(dt/tau_f,state_temp,state_u); + auryn_vector_float_saxpy(auryn_timestep/tau_f,state_temp,state_u); } } diff --git a/src/auryn/SpikeMonitor.cpp b/src/auryn/SpikeMonitor.cpp index 7ca368b2..71bd8b21 100644 --- a/src/auryn/SpikeMonitor.cpp +++ b/src/auryn/SpikeMonitor.cpp @@ -61,7 +61,7 @@ void SpikeMonitor::init(SpikingGroup * source, std::string filename, NeuronID fr n_every = 1; src = source; outfile.setf(std::ios::fixed); - outfile.precision(log(dt)/log(10)+1 ); + outfile.precision(log(auryn_timestep)/log(10)+1 ); } void SpikeMonitor::free() diff --git a/src/auryn/SpikeTimingStimGroup.cpp b/src/auryn/SpikeTimingStimGroup.cpp index ca721137..a6b8b0c7 100644 --- a/src/auryn/SpikeTimingStimGroup.cpp +++ b/src/auryn/SpikeTimingStimGroup.cpp @@ -51,7 +51,7 @@ void SpikeTimingStimGroup::init() void SpikeTimingStimGroup::redraw() { for ( NeuronID i = 0; i < get_rank_size() ; ++i ) { - ttl[i] = sys->get_clock() + activity[i]/dt; + ttl[i] = sys->get_clock() + activity[i]/auryn_timestep; } } @@ -75,7 +75,7 @@ void SpikeTimingStimGroup::evolve() while ( bgx < get_rank_size() ) { push_spike ( bgx ); AurynDouble r = die(); - bgx += 1+(NeuronID)(r/dt); + bgx += 1+(NeuronID)(r/auryn_timestep); } bgx -= get_rank_size(); } @@ -90,14 +90,14 @@ void SpikeTimingStimGroup::evolve() return; } - write_stimulus_file(dt*(auryn::sys->get_clock())); + write_stimulus_file(auryn_timestep*(auryn::sys->get_clock())); if ( stimulus_order == STIMFILE ) { AurynDouble t = 0.0; int a,i; while ( t <= auryn::sys->get_time() ) { read_next_stimulus_from_file(t,a,i); - next_action_time = (AurynTime) (t/dt); + next_action_time = (AurynTime) (t/auryn_timestep); if (a==0) stimulus_active = true; else stimulus_active = false; cur_stim_index = i; @@ -113,9 +113,9 @@ void SpikeTimingStimGroup::evolve() if ( randomintervals ) { boost::exponential_distribution<> dist(1./mean_off_period); boost::variate_generator > die(order_gen, dist); - next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die()+refractory_period)/dt); + next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die()+refractory_period)/auryn_timestep); } else { - next_action_time = auryn::sys->get_clock() + (AurynTime)((mean_off_period+refractory_period)/dt); + next_action_time = auryn::sys->get_clock() + (AurynTime)((mean_off_period+refractory_period)/auryn_timestep); } } else { // stimulus was not active and is going active now if ( active && stimuli.size() ) { // the group is active and there are stimuli in the array @@ -157,10 +157,10 @@ void SpikeTimingStimGroup::evolve() set_active_pattern( cur_stim_index, 1e20 ); // puts default spikes into the not forseeable future stimulus_active = true; - next_action_time = auryn::sys->get_clock() + (AurynTime)(mean_on_period/dt); + next_action_time = auryn::sys->get_clock() + (AurynTime)(mean_on_period/auryn_timestep); } } - write_stimulus_file(dt*(auryn::sys->get_clock()+1)); + write_stimulus_file(auryn_timestep*(auryn::sys->get_clock()+1)); } } } diff --git a/src/auryn/SpikingGroup.cpp b/src/auryn/SpikingGroup.cpp index 64733ad4..b9551c41 100644 --- a/src/auryn/SpikingGroup.cpp +++ b/src/auryn/SpikingGroup.cpp @@ -357,7 +357,7 @@ void SpikingGroup::set_delay( int d ) // attribs = delay->get_attributes_immediate(); } -PRE_TRACE_MODEL * SpikingGroup::get_pre_trace( AurynFloat x ) +Trace * SpikingGroup::get_pre_trace( AurynFloat x ) { for ( NeuronID i = 0 ; i < pretraces.size() ; i++ ) { if ( pretraces[i]->get_tau() == x ) { @@ -369,16 +369,12 @@ PRE_TRACE_MODEL * SpikingGroup::get_pre_trace( AurynFloat x ) } auryn::logger->msg("Initializing pre trace instance",VERBOSE); -#ifndef PRE_TRACE_MODEL_LINTRACE - DEFAULT_TRACE_MODEL * tmp = new DEFAULT_TRACE_MODEL(get_pre_size(),x); -#else - PRE_TRACE_MODEL * tmp = new PRE_TRACE_MODEL(get_pre_size(),x,clock_ptr); -#endif + Trace * tmp = new EulerTrace(get_pre_size(),x); pretraces.push_back(tmp); return tmp; } -DEFAULT_TRACE_MODEL * SpikingGroup::get_post_trace( AurynFloat x ) +Trace * SpikingGroup::get_post_trace( AurynFloat x ) { for ( NeuronID i = 0 ; i < posttraces.size() ; i++ ) { if ( posttraces[i]->get_tau() == x ) { @@ -391,12 +387,12 @@ DEFAULT_TRACE_MODEL * SpikingGroup::get_post_trace( AurynFloat x ) auryn::logger->msg("Initializing post trace instance",VERBOSE); - DEFAULT_TRACE_MODEL * tmp = new DEFAULT_TRACE_MODEL(get_post_size(),x); + Trace * tmp = new EulerTrace(get_post_size(),x); posttraces.push_back(tmp); return tmp; } -EulerTrace * SpikingGroup::get_post_state_trace( AurynStateVector * state, AurynFloat tau, AurynFloat b ) +Trace * SpikingGroup::get_post_state_trace( AurynStateVector * state, AurynFloat tau, AurynFloat b ) { // first let's check if a state with that name exists if ( state == NULL ) { @@ -423,7 +419,7 @@ EulerTrace * SpikingGroup::get_post_state_trace( AurynStateVector * state, Auryn // trace does not exist yet, so we are creating // it and do the book keeping auryn::logger->msg("Initializing post trace instance",VERBOSE); - EulerTrace * tmp = new EulerTrace(get_post_size(),tau); + Trace * tmp = new EulerTrace(get_post_size(),tau); tmp->set_target(state); post_state_traces.push_back(tmp); post_state_traces_spike_biases.push_back(b); @@ -431,7 +427,7 @@ EulerTrace * SpikingGroup::get_post_state_trace( AurynStateVector * state, Auryn return tmp; } -EulerTrace * SpikingGroup::get_post_state_trace( std::string state_name, AurynFloat tau, AurynFloat b ) +Trace * SpikingGroup::get_post_state_trace( std::string state_name, AurynFloat tau, AurynFloat b ) { AurynStateVector * state = find_state_vector( state_name ); return get_post_state_trace(state, tau, b); @@ -472,7 +468,7 @@ void SpikingGroup::evolve_traces() spike != get_spikes_immediate()->end() ; ++spike ) { NeuronID translated_spike = global2rank(*spike); // only to be used for post traces - post_state_traces[i]->add(translated_spike, post_state_traces_spike_biases[i]); + post_state_traces[i]->add_specific(translated_spike, post_state_traces_spike_biases[i]); } } diff --git a/src/auryn/SpikingGroup.h b/src/auryn/SpikingGroup.h index 4b1d6e6d..130f21fe 100644 --- a/src/auryn/SpikingGroup.h +++ b/src/auryn/SpikingGroup.h @@ -28,10 +28,9 @@ #include "auryn_definitions.h" #include "AurynVector.h" -// #include "SpikeContainer.h" #include "SpikeDelay.h" +#include "Trace.h" #include "EulerTrace.h" -#include "LinearTrace.h" #include @@ -40,12 +39,15 @@ namespace auryn { -class System; /*! \brief Abstract base class of all objects producing spikes * - * This is the abstract/virtual base class from which all spiking objects should be derived. All classes derived from SpikingGroup have in common that they can emit spikes. Furthermore they should implement the method evolve() for carring out internal state changes such as integration of the e.g. Euler Step. - * Other classes interact with inheritants of SpikingGroup by calling the functions get_spikes() and get_spikes_immediate(). + * This is the abstract/virtual base class from which all spiking objects + * should be derived. All classes derived from SpikingGroup have in common that + * they can emit spikes. Furthermore they should implement the method evolve() + * for carring out internal state changes such as integration of the e.g. Euler + * Step. Other classes interact with inheritants of SpikingGroup by calling + * the functions get_spikes() and get_spikes_immediate(). */ class SpikingGroup { @@ -91,13 +93,13 @@ class SpikingGroup protected: /*! \brief Pretraces */ - std::vector pretraces; + std::vector pretraces; /*! \brief Posttraces */ - std::vector posttraces; + std::vector posttraces; /*! \brief Post state traces */ - std::vector post_state_traces; + std::vector post_state_traces; std::vector post_state_traces_spike_biases; std::vector post_state_traces_states; @@ -272,13 +274,13 @@ class SpikingGroup * * Checks first if an instance of a trace exists and returns it * otherwise creates a new instance first. */ - PRE_TRACE_MODEL * get_pre_trace( AurynFloat x ); + Trace * get_pre_trace( AurynFloat x ); /*! \brief Returns a post trace with time constant x * * Checks first if an instance of a trace exists and returns it * otherwise creates a new instance first. */ - DEFAULT_TRACE_MODEL * get_post_trace( AurynFloat x ); + Trace * get_post_trace( AurynFloat x ); /*! \brief Pushes a spike into the axonal SpikeDelay buffer */ void push_spike(NeuronID spike); @@ -297,7 +299,7 @@ class SpikingGroup /*! \brief Returns a post trace of a neuronal state variable e.g. the membrane * potential with time constant tau. * - * This trace is an cotinuously integrated EulerTrace which uses the follow + * This trace is an cotinuously integrated Trace which uses the follow * function on the mem state vector. * @param state_name A string stating the neurons state name * @param tau The time constant of the trace. @@ -305,11 +307,11 @@ class SpikingGroup * which will be added instantaneously to the trace upon each * postsynaptic spike. * */ - EulerTrace * get_post_state_trace( std::string state_name="mem", AurynFloat tau=10e-3, AurynFloat b=0.0 ); + Trace * get_post_state_trace( std::string state_name="mem", AurynFloat tau=10e-3, AurynFloat b=0.0 ); /*! \brief Returns a post trace of a neuronal state variable specified by pointer * - * This trace is an cotinuously integrated EulerTrace which uses the follow + * This trace is an cotinuously integrated Trace which uses the follow * function on the mem state vector. * @param state A pointer to the relevant state vector * @param tau The time constant of the trace. @@ -317,7 +319,7 @@ class SpikingGroup * which will be added instantaneously to the trace upon each * postsynaptic spike. * */ - EulerTrace * get_post_state_trace( AurynStateVector * state, AurynFloat tau=10e-3, AurynFloat b=0.0 ); + Trace * get_post_state_trace( AurynStateVector * state, AurynFloat tau=10e-3, AurynFloat b=0.0 ); /*! \brief Sets axonal delay for this SpikingGroup * @@ -355,10 +357,10 @@ class SpikingGroup BOOST_SERIALIZATION_ASSUME_ABSTRACT(SpikingGroup) - extern System * sys; - extern Logger * logger; +// extern System * sys; +extern Logger * logger; #ifdef AURYN_CODE_USE_MPI - extern mpi::communicator * mpicommunicator; + extern mpi::communicator * mpicommunicator; #endif // AURYN_CODE_USE_MPI diff --git a/src/auryn/StateMonitor.cpp b/src/auryn/StateMonitor.cpp index d0a1d710..687f9a08 100644 --- a/src/auryn/StateMonitor.cpp +++ b/src/auryn/StateMonitor.cpp @@ -64,7 +64,7 @@ StateMonitor::StateMonitor(auryn_vector_float * state, NeuronID id, std::string lastval = *target_variable; } -StateMonitor::StateMonitor(EulerTrace * trace, NeuronID id, std::string filename, AurynDouble sampling_interval): Monitor(filename, "state") +StateMonitor::StateMonitor(Trace * trace, NeuronID id, std::string filename, AurynDouble sampling_interval): Monitor(filename, "state") { if ( id >= trace->get_state_ptr()->size ) return; // do not register if neuron is out of vector range @@ -82,7 +82,7 @@ void StateMonitor::init(std::string filename, AurynDouble sampling_interval) outfile << std::setiosflags(std::ios::fixed) << std::setprecision(6); set_stop_time(10.0); - ssize = sampling_interval/dt; + ssize = sampling_interval/auryn_timestep; if ( ssize < 1 ) ssize = 1; enable_compression = true; @@ -110,7 +110,7 @@ void StateMonitor::propagate() AurynState deriv = value-lastval; if ( deriv != lastder ) { - int n = sprintf(buffer,"%f %f\n",(auryn::sys->get_clock()-ssize)*dt, lastval); + int n = sprintf(buffer,"%f %f\n",(auryn::sys->get_clock()-ssize)*auryn_timestep, lastval); outfile.write(buffer,n); } @@ -126,8 +126,8 @@ void StateMonitor::propagate() void StateMonitor::set_stop_time(AurynDouble time) { - AurynDouble stoptime = std::min( time, std::numeric_limits::max()*dt ); - t_stop = stoptime/dt; + AurynDouble stoptime = std::min( time, std::numeric_limits::max()*auryn_timestep ); + t_stop = stoptime/auryn_timestep; } void StateMonitor::record_for(AurynDouble time) @@ -135,6 +135,6 @@ void StateMonitor::record_for(AurynDouble time) if (time < 0) { auryn::logger->msg("Warning: Negative stop times not supported -- ingoring.",WARNING); } - else t_stop = auryn::sys->get_clock() + time/dt; + else t_stop = auryn::sys->get_clock() + time/auryn_timestep; auryn::logger->debug("Set record for times for monitor."); } diff --git a/src/auryn/StateMonitor.h b/src/auryn/StateMonitor.h index 26d44df8..b9ce7f48 100644 --- a/src/auryn/StateMonitor.h +++ b/src/auryn/StateMonitor.h @@ -53,7 +53,7 @@ class StateMonitor : public Monitor /*! \brief The source neuron id to record from */ NeuronID nid; - /*! \brief The step size (sampling interval) in units of dt */ + /*! \brief The step size (sampling interval) in units of auryn_timestep */ AurynTime ssize; /*! \brief Defines the maximum recording time in AurynTime to save space. */ @@ -82,7 +82,7 @@ class StateMonitor : public Monitor * \param filename The filename of the file to dump the output to * \param sampling_interval The sampling interval in seconds */ - StateMonitor(SpikingGroup * source, NeuronID id, string statename, string filename, AurynDouble sampling_interval=dt); + StateMonitor(SpikingGroup * source, NeuronID id, string statename, string filename, AurynDouble sampling_interval=auryn_timestep); /*! \brief Alternative constructor * @@ -90,15 +90,15 @@ class StateMonitor : public Monitor * \param filename The filename of the file to dump the output to * \param sampling_interval The sampling interval in seconds */ - StateMonitor(auryn_vector_float * state, NeuronID id, string filename, AurynDouble sampling_interval=dt); + StateMonitor(auryn_vector_float * state, NeuronID id, string filename, AurynDouble sampling_interval=auryn_timestep); - /*! \brief EulerTrace constructor + /*! \brief Trace constructor * * \param trace The source synaptic trace * \param filename The filename of the file to dump the output to * \param sampling_interval The sampling interval in seconds */ - StateMonitor(EulerTrace * trace, NeuronID id, string filename, AurynDouble sampling_interval=dt); + StateMonitor(Trace * trace, NeuronID id, string filename, AurynDouble sampling_interval=auryn_timestep); /*! \brief Sets relative time at which to stop recording * diff --git a/src/auryn/StimulusGroup.cpp b/src/auryn/StimulusGroup.cpp index a5c25f8d..38891327 100644 --- a/src/auryn/StimulusGroup.cpp +++ b/src/auryn/StimulusGroup.cpp @@ -129,7 +129,7 @@ void StimulusGroup::redraw() for ( NeuronID i = 0 ; i < get_rank_size() ; ++i ) { if (activity[i]>0) - ttl[i] = auryn::sys->get_clock() + (AurynTime)((AurynFloat)die()/(activity[i]*dt)); + ttl[i] = auryn::sys->get_clock() + (AurynTime)((AurynFloat)die()/(activity[i]*auryn_timestep)); } } @@ -202,14 +202,14 @@ void StimulusGroup::evolve() if ( fgx < current.size() && current.at(fgx).i < bgx ) { push_spike ( current.at(fgx).i ); AurynDouble r = die(); - fgx += 1+(NeuronID)(r/dt); + fgx += 1+(NeuronID)(r/auryn_timestep); } else { push_spike ( bgx ); boost::exponential_distribution<> bg_dist(background_rate); boost::variate_generator > bg_die(poisson_gen, bg_dist); AurynDouble r = bg_die(); - bgx += 1+(NeuronID)(r/dt); + bgx += 1+(NeuronID)(r/auryn_timestep); } } if ( background_during_stimulus ) @@ -227,7 +227,7 @@ void StimulusGroup::evolve() if ( ttl[i] < auryn::sys->get_clock() && activity[i]>0.0 ) { push_spike ( i ); - ttl[i] = auryn::sys->get_clock() + refractory_period + (AurynTime)((AurynFloat)die()*(1.0/(activity[i]*dt)-refractory_period)); + ttl[i] = auryn::sys->get_clock() + refractory_period + (AurynTime)((AurynFloat)die()*(1.0/(activity[i]*auryn_timestep)-refractory_period)); } } } @@ -239,7 +239,7 @@ void StimulusGroup::evolve() while ( bgx < get_rank_size() ) { push_spike ( bgx ); AurynDouble r = die(); - bgx += 1+(NeuronID)(r/dt); + bgx += 1+(NeuronID)(r/auryn_timestep); } bgx -= get_rank_size(); } @@ -254,7 +254,7 @@ void StimulusGroup::evolve() return; } - write_stimulus_file(dt*(auryn::sys->get_clock())); + write_stimulus_file(auryn_timestep*(auryn::sys->get_clock())); // if we have variable rate stimuli update curscale otherwise set to scale // this is only needed for binary stimuli -- otherwise the change is done in @@ -270,7 +270,7 @@ void StimulusGroup::evolve() int a,i; while ( t <= auryn::sys->get_time() ) { read_next_stimulus_from_file(t,a,i); - next_action_time = (AurynTime) (t/dt); + next_action_time = (AurynTime) (t/auryn_timestep); if (a==0) stimulus_active = true; else stimulus_active = false; cur_stim_index = i; @@ -287,9 +287,9 @@ void StimulusGroup::evolve() if ( randomintervals ) { boost::exponential_distribution<> dist(1./mean_off_period); boost::variate_generator > die(order_gen, dist); - next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die())/dt); + next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die())/auryn_timestep); } else { - next_action_time = auryn::sys->get_clock() + (AurynTime)(mean_off_period/dt); + next_action_time = auryn::sys->get_clock() + (AurynTime)(mean_off_period/auryn_timestep); } } else { // stimulus was not active and is going active now if ( active && stimuli.size() ) { // the group is active and there are stimuli in the array @@ -334,13 +334,13 @@ void StimulusGroup::evolve() if ( randomintervals && stimulus_order != STIMFILE ) { boost::normal_distribution<> dist(mean_on_period,mean_on_period/3); boost::variate_generator > die(order_gen, dist); - next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die())/dt); + next_action_time = auryn::sys->get_clock() + (AurynTime)(std::max(0.0,die())/auryn_timestep); } else { - next_action_time = auryn::sys->get_clock() + (AurynTime)(mean_on_period/dt); + next_action_time = auryn::sys->get_clock() + (AurynTime)(mean_on_period/auryn_timestep); } } } - write_stimulus_file(dt*(auryn::sys->get_clock()+1)); + write_stimulus_file(auryn_timestep*(auryn::sys->get_clock()+1)); } } } @@ -545,7 +545,7 @@ std::vector * StimulusGroup::get_patterns() } void StimulusGroup::set_next_action_time( double time ) { - next_action_time = auryn::sys->get_clock() + time/dt; + next_action_time = auryn::sys->get_clock() + time/auryn_timestep; } void StimulusGroup::set_stimulation_mode( StimulusGroupModeType mode ) { diff --git a/src/auryn/StructuredPoissonGroup.cpp b/src/auryn/StructuredPoissonGroup.cpp index 88562ef0..cd853484 100644 --- a/src/auryn/StructuredPoissonGroup.cpp +++ b/src/auryn/StructuredPoissonGroup.cpp @@ -32,8 +32,8 @@ boost::mt19937 StructuredPoissonGroup::interval_gen = boost::mt19937(); void StructuredPoissonGroup::init ( AurynFloat duration, AurynFloat mean_interval, NeuronID no, std::string outputfile ) { no_of_stimuli = no; - stimulus_duration = duration/dt; - mean_isi = mean_interval/dt; + stimulus_duration = duration/auryn_timestep; + mean_isi = mean_interval/auryn_timestep; auryn::logger->parameter("duration", (int)duration); auryn::logger->parameter("mean_isi", (int)mean_isi); @@ -61,7 +61,7 @@ void StructuredPoissonGroup::init ( AurynFloat duration, AurynFloat mean_interva exit(1); } tiserfile.setf(std::ios::fixed); - tiserfile.precision(log(dt)/log(10)+1 ); + tiserfile.precision(log(auryn_timestep)/log(10)+1 ); } diff --git a/src/auryn/SymmetricSTDPConnection.h b/src/auryn/SymmetricSTDPConnection.h index 70b4b132..6b704c52 100644 --- a/src/auryn/SymmetricSTDPConnection.h +++ b/src/auryn/SymmetricSTDPConnection.h @@ -29,7 +29,7 @@ #include "auryn_definitions.h" #include "AurynVector.h" #include "DuplexConnection.h" -#include "EulerTrace.h" +#include "Trace.h" #include "LinearTrace.h" namespace auryn { @@ -49,8 +49,8 @@ class SymmetricSTDPConnection : public DuplexConnection AurynFloat target; AurynFloat kappa_fudge; - PRE_TRACE_MODEL * tr_pre; - DEFAULT_TRACE_MODEL * tr_post; + Trace * tr_pre; + Trace * tr_post; inline AurynWeight dw_pre(NeuronID post); inline AurynWeight dw_post(NeuronID pre); diff --git a/src/auryn/System.cpp b/src/auryn/System.cpp index c73e02e9..32326015 100644 --- a/src/auryn/System.cpp +++ b/src/auryn/System.cpp @@ -46,6 +46,9 @@ void System::init() { clock = 0; + + // auryn_timestep = 1e-4; + quiet = false; set_simulation_name("default"); set_output_dir("."); @@ -90,8 +93,8 @@ void System::init() { oss.str(""); oss << "Current AurynTime good for simulations up to " - << std::numeric_limits::max()*dt << "s " - << "( " << std::numeric_limits::max()*dt/3600 << "h )"; + << std::numeric_limits::max()*auryn_timestep << "s " + << "( " << std::numeric_limits::max()*auryn_timestep/3600 << "h )"; auryn::logger->msg(oss.str(),VERBOSE); @@ -191,7 +194,7 @@ void System::step() AurynDouble System::get_time() { - return dt * clock; + return auryn_timestep * clock; } AurynTime System::get_clock() @@ -378,7 +381,7 @@ void System::progressbar ( double fraction, AurynTime clk ) { std::string System::get_nice_time(AurynTime clk) { - const AurynTime hour = 3600/dt; + const AurynTime hour = 3600/auryn_timestep; const AurynTime day = 24*hour; std::stringstream oss; if ( clk > day ) { @@ -391,7 +394,7 @@ std::string System::get_nice_time(AurynTime clk) oss << h <<"h "; clk -= h*hour; } - oss << std::fixed << std::setprecision(1) << clk*dt << "s"; + oss << std::fixed << std::setprecision(1) << clk*auryn_timestep << "s"; return oss.str(); } @@ -403,7 +406,7 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, } - double runtime = (stoptime - get_clock())*dt; + double runtime = (stoptime - get_clock())*auryn_timestep; std::stringstream oss; oss << "Simulation triggered ( " @@ -449,7 +452,7 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, while ( get_clock() < stoptime ) { if ( (mpi_rank()==0) && (not quiet) && ( (get_clock()%progressbar_update_interval==0) || get_clock()==(stoptime-1) ) ) { - double fraction = 1.0*(get_clock()-starttime+1)*dt/total_time; + double fraction = 1.0*(get_clock()-starttime+1)*auryn_timestep/total_time; progressbar(fraction,get_clock()); // TODO find neat solution for the rate } @@ -468,11 +471,11 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, if ( td > 50 ) { oss << "Ran for " << td << "s " << "with SpeedFactor=" - << std::scientific << td/(LOGGER_MARK_INTERVAL*dt); + << std::scientific << td/(LOGGER_MARK_INTERVAL*auryn_timestep); } - AurynTime simtime_left = total_time-dt*(get_clock()-starttime+1); - AurynDouble remaining_minutes = simtime_left*td/(LOGGER_MARK_INTERVAL*dt)/60; // in minutes + AurynTime simtime_left = total_time-auryn_timestep*(get_clock()-starttime+1); + AurynDouble remaining_minutes = simtime_left*td/(LOGGER_MARK_INTERVAL*auryn_timestep)/60; // in minutes if ( remaining_minutes > 5 ) { // only show when more than 5min oss << ", approximately " << std::setprecision(0) << remaining_minutes @@ -578,28 +581,28 @@ bool System::run(AurynTime starttime, AurynTime stoptime, AurynFloat total_time, bool System::run(AurynFloat simulation_time, bool checking) { // throw an exception if the stoptime is post the range of AurynTime - if ( get_time() + simulation_time > std::numeric_limits::max()*dt ) { + if ( get_time() + simulation_time > std::numeric_limits::max()*auryn_timestep ) { auryn::logger->msg("The requested simulation time exceeds the number of possible timesteps limited by AurynTime datatype.",ERROR); throw AurynTimeOverFlowException(); } AurynTime starttime = get_clock(); - AurynTime stoptime = get_clock() + (AurynTime) (simulation_time/dt); + AurynTime stoptime = get_clock() + (AurynTime) (simulation_time/auryn_timestep); return run(starttime, stoptime, simulation_time, checking); } bool System::run_chunk(AurynFloat chunk_time, AurynFloat interval_start, AurynFloat interval_end, bool checking) { - AurynTime stopclock = get_clock()+chunk_time/dt; + AurynTime stopclock = get_clock()+chunk_time/auryn_timestep; // throw an exception if the stoptime is post the range of AurynTime - if ( interval_end > std::numeric_limits::max()*dt ) { + if ( interval_end > std::numeric_limits::max()*auryn_timestep ) { auryn::logger->msg("The requested simulation time exceeds the number of possible timesteps limited by AurynTime datatype.",ERROR); throw AurynTimeOverFlowException(); } - return run(interval_start/dt, stopclock, (interval_end-interval_start), checking); + return run(interval_start/auryn_timestep, stopclock, (interval_end-interval_start), checking); } #ifdef AURYN_CODE_USE_MPI @@ -883,7 +886,7 @@ void System::load_network_state(std::string basename) void System::set_online_rate_monitor_tau(AurynDouble tau) { online_rate_monitor_tau = tau; - online_rate_monitor_mul = exp(-dt/tau); + online_rate_monitor_mul = exp(-auryn_timestep/tau); } void System::evolve_online_rate_monitor() diff --git a/src/auryn/System.h b/src/auryn/System.h index d2bce7c6..5aa2212b 100644 --- a/src/auryn/System.h +++ b/src/auryn/System.h @@ -28,9 +28,9 @@ #include "auryn_definitions.h" #include "AurynVector.h" +#include "Device.h" #include "SpikingGroup.h" #include "Connection.h" -#include "Device.h" #include "Checker.h" #include "AurynVersion.h" @@ -54,6 +54,9 @@ namespace auryn { +// class SpikingGroup; // forward declaration +// class Connection; // forward declaration + /*! \brief Class that implements system wide variables and methods to manage and run simulations. * * This Class contains methods to manage and run sets of classes that make up @@ -156,7 +159,7 @@ namespace auryn { /*! \brief Version info */ AurynVersion build; - /*! \brief The progressbar update interval in timesteps of dt. */ + /*! \brief The progressbar update interval in timesteps of auryn_timestep. */ unsigned int progressbar_update_interval; #ifdef AURYN_CODE_USE_MPI diff --git a/src/auryn/TIFGroup.cpp b/src/auryn/TIFGroup.cpp index c1b2eb67..c652442d 100644 --- a/src/auryn/TIFGroup.cpp +++ b/src/auryn/TIFGroup.cpp @@ -35,9 +35,9 @@ TIFGroup::TIFGroup(NeuronID size) : NeuronGroup(size) void TIFGroup::calculate_scale_constants() { - scale_mem = dt/tau_mem; - scale_ampa = exp(-dt/tau_ampa); - scale_gaba = exp(-dt/tau_gaba); + scale_mem = auryn_timestep/tau_mem; + scale_ampa = exp(-auryn_timestep/tau_ampa); + scale_gaba = exp(-auryn_timestep/tau_gaba); } void TIFGroup::init() @@ -203,7 +203,7 @@ AurynFloat TIFGroup::get_tau_gaba() void TIFGroup::set_refractory_period(AurynDouble t) { - refractory_time = (unsigned short) (t/dt); + refractory_time = (unsigned short) (t/auryn_timestep); } void TIFGroup::virtual_serialize(boost::archive::binary_oarchive & ar, const unsigned int version ) diff --git a/src/auryn/Trace.cpp b/src/auryn/Trace.cpp new file mode 100644 index 00000000..05284137 --- /dev/null +++ b/src/auryn/Trace.cpp @@ -0,0 +1,71 @@ +/* +* Copyright 2014-2016 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. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Auryn. If not, see . +* +* If you are using Auryn or parts of it for your work please cite: +* Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations +* of spiking neural networks using general-purpose computers. +* Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 +*/ + +#include "Trace.h" + +using namespace auryn; + + + +Trace::Trace(NeuronID n, AurynFloat timeconstant) : AurynStateVector(n) +{ + set_timeconstant(timeconstant); +} + +Trace::~Trace() +{ +} + +void Trace::set_timeconstant(AurynFloat timeconstant) +{ + tau = timeconstant; +} + +AurynFloat Trace::get_tau() +{ + return tau; +} + +AurynStateVector * Trace::get_state_ptr() +{ + return this; +} + +void Trace::inc(NeuronID i) +{ + data[i]++; +} + +void Trace::inc(SpikeContainer * sc) +{ + for ( NeuronID i = 0 ; i < sc->size() ; ++i ) + inc((*sc)[i]); +} + +AurynFloat Trace::normalized_get(NeuronID i) +{ + return get( i ) / tau ; +} + diff --git a/src/auryn/Trace.h b/src/auryn/Trace.h new file mode 100644 index 00000000..c28de7d9 --- /dev/null +++ b/src/auryn/Trace.h @@ -0,0 +1,92 @@ +/* +* Copyright 2014-2016 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. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with Auryn. If not, see . +* +* If you are using Auryn or parts of it for your work please cite: +* Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations +* of spiking neural networks using general-purpose computers. +* Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076 +*/ + +#ifndef TRACE_H_ +#define TRACE_H_ + +#include "AurynVector.h" +#include "auryn_definitions.h" + +namespace auryn { + +/*! \brief Abstract base class of synaptic traces + */ +class Trace : public AurynStateVector +{ +private: + +protected: + /*! Decay time constant in [s]. */ + AurynFloat tau; + +public: + /*! \brief Default constructor */ + Trace(NeuronID n, AurynFloat timeconstant); + + /*! \brief Default destructor */ + virtual ~Trace(); + + /*! \brief Increment given trace by 1. + * + * \param i index of trace to increment. + */ + void inc(NeuronID i); + + /*! \brief Increment given traces by 1. + * + * \param sc SpikeContainer with all neurons to increment. + */ + void inc(SpikeContainer * sc); + + /*! \brief Perform Euler step. */ + virtual void evolve() = 0; + + /*! \brief Set the time constant of the trace */ + virtual void set_timeconstant( AurynFloat timeconstant ); + + /*! \brief Get decay time constant */ + AurynFloat get_tau(); + + /*! \brief Get trace value of trace dived by tau + * + * \param i index of trace to get + */ + AurynFloat normalized_get(NeuronID i); + + /*! \brief Get pointer to state AurynStateVector for fast processing. */ + AurynStateVector * get_state_ptr(); + + /*! \brief Set the target vector for follow operation */ + virtual void set_target( AurynStateVector * target ) = 0; + + /*! \brief Follow other trace */ + virtual void follow() = 0; +}; + + +} // namespace + +#endif /*TRACE_H_*/ + diff --git a/src/auryn/TripletConnection.h b/src/auryn/TripletConnection.h index 6fb5e07d..e6d78027 100644 --- a/src/auryn/TripletConnection.h +++ b/src/auryn/TripletConnection.h @@ -29,12 +29,10 @@ #include "auryn_definitions.h" #include "AurynVector.h" #include "DuplexConnection.h" -#include "EulerTrace.h" +#include "Trace.h" #include "LinearTrace.h" #include "SpikeDelay.h" -#define TRACE EulerTrace - namespace auryn { @@ -82,12 +80,12 @@ class TripletConnection : public DuplexConnection AurynDouble hom_fudge; /* Definitions of presynaptic traces */ - PRE_TRACE_MODEL * tr_pre; + Trace * tr_pre; /* Definitions of postsynaptic traces */ - DEFAULT_TRACE_MODEL * tr_post; - DEFAULT_TRACE_MODEL * tr_post2; - DEFAULT_TRACE_MODEL * tr_post_hom; + Trace * tr_post; + Trace * tr_post2; + Trace * tr_post_hom; /*! This function propagates spikes from pre to postsynaptic cells * and performs plasticity updates upon presynaptic spikes. */ diff --git a/src/auryn/TripletDecayConnection.cpp b/src/auryn/TripletDecayConnection.cpp index 34c09c9a..c8b20601 100644 --- a/src/auryn/TripletDecayConnection.cpp +++ b/src/auryn/TripletDecayConnection.cpp @@ -33,7 +33,7 @@ void TripletDecayConnection::init(AurynFloat decay, AurynWeight wrest) w_rest = wrest; mul_decay = TRIPLETDECAYCONNECTION_EULERUPGRADE_STEP; - decay_timestep = -log(TRIPLETDECAYCONNECTION_EULERUPGRADE_STEP)*tau_decay/dt; + decay_timestep = -log(TRIPLETDECAYCONNECTION_EULERUPGRADE_STEP)*tau_decay/auryn_timestep; decay_count = decay_timestep; std::stringstream oss; diff --git a/src/auryn/TripletDecayConnection.h b/src/auryn/TripletDecayConnection.h index 124d1611..f73c8aa5 100644 --- a/src/auryn/TripletDecayConnection.h +++ b/src/auryn/TripletDecayConnection.h @@ -29,7 +29,7 @@ #include "auryn_definitions.h" #include "AurynVector.h" #include "TripletConnection.h" -#include "EulerTrace.h" +#include "Trace.h" #define TRIPLETDECAYCONNECTION_EULERUPGRADE_STEP 0.999 diff --git a/src/auryn/TripletScalingConnection.cpp b/src/auryn/TripletScalingConnection.cpp index 6fee6226..914ab499 100644 --- a/src/auryn/TripletScalingConnection.cpp +++ b/src/auryn/TripletScalingConnection.cpp @@ -253,12 +253,12 @@ void TripletScalingConnection::set_beta(AurynFloat beta) logger->parameter("beta",beta); logger->parameter("scal_beta",scal_beta); - double tmp = -log(1.0-TRIPLETSCALINGCONNECTION_EULERUPGRADE_STEP)/scal_beta/dt; + double tmp = -log(1.0-TRIPLETSCALINGCONNECTION_EULERUPGRADE_STEP)/scal_beta/auryn_timestep; if ( tmp < 1 ) scal_timestep = 1; else scal_timestep = tmp; - scal_mul = 1.0-exp(-scal_beta*scal_timestep*dt); + scal_mul = 1.0-exp(-scal_beta*scal_timestep*auryn_timestep); logger->parameter("scaling_timestep",(int)scal_timestep); } diff --git a/src/auryn/TripletScalingConnection.h b/src/auryn/TripletScalingConnection.h index c349af10..14a29c48 100644 --- a/src/auryn/TripletScalingConnection.h +++ b/src/auryn/TripletScalingConnection.h @@ -24,7 +24,7 @@ #include "auryn_definitions.h" #include "AurynVector.h" #include "DuplexConnection.h" -#include "EulerTrace.h" +#include "Trace.h" #define TRIPLETSCALINGCONNECTION_EULERUPGRADE_STEP 0.001 @@ -60,10 +60,10 @@ namespace auryn { AurynDouble hom_fudge; AurynDouble target_rate; - PRE_TRACE_MODEL * tr_pre; - DEFAULT_TRACE_MODEL * tr_post; - DEFAULT_TRACE_MODEL * tr_post2; - DEFAULT_TRACE_MODEL * tr_post_hom; + Trace * tr_pre; + Trace * tr_post; + Trace * tr_post2; + Trace * tr_post_hom; void propagate_forward(); void propagate_backward(); diff --git a/src/auryn/VoltageMonitor.cpp b/src/auryn/VoltageMonitor.cpp index 889e008c..69db9095 100644 --- a/src/auryn/VoltageMonitor.cpp +++ b/src/auryn/VoltageMonitor.cpp @@ -29,7 +29,7 @@ using namespace auryn; VoltageMonitor::VoltageMonitor(NeuronGroup * source, NeuronID id, std::string filename, AurynDouble stepsize) : Monitor(filename) { - init(source,id,filename,(AurynTime)(stepsize/dt)); + init(source,id,filename,(AurynTime)(stepsize/auryn_timestep)); } VoltageMonitor::~VoltageMonitor() @@ -90,5 +90,5 @@ void VoltageMonitor::set_stop_time(AurynDouble time) if (time < 0) { auryn::logger->msg("Warning: Negative stop times not supported -- ingoring.",WARNING); } - else tStop = auryn::sys->get_clock() + time/dt; + else tStop = auryn::sys->get_clock() + time/auryn_timestep; } diff --git a/src/auryn/VoltageMonitor.h b/src/auryn/VoltageMonitor.h index e258c115..8dbe874b 100644 --- a/src/auryn/VoltageMonitor.h +++ b/src/auryn/VoltageMonitor.h @@ -58,7 +58,7 @@ class VoltageMonitor : public Monitor /*! The source neuron id to record from */ NeuronID nid; - /*! The step size (sampling interval) in units of dt */ + /*! The step size (sampling interval) in units of auryn_timestep */ AurynTime ssize; /*! Defines the maximum recording time in AurynTime to save space. */ @@ -82,7 +82,7 @@ class VoltageMonitor : public Monitor /*! Same as record for(time) */ void set_stop_time(AurynDouble time=10.0); - VoltageMonitor(NeuronGroup * source, NeuronID id, string filename, AurynDouble stepsize=dt); + VoltageMonitor(NeuronGroup * source, NeuronID id, string filename, AurynDouble stepsize=auryn_timestep); virtual ~VoltageMonitor(); void propagate(); }; diff --git a/src/auryn/WeightChecker.cpp b/src/auryn/WeightChecker.cpp index b449464c..0eb72ddf 100644 --- a/src/auryn/WeightChecker.cpp +++ b/src/auryn/WeightChecker.cpp @@ -53,7 +53,7 @@ void WeightChecker::init(Connection * source, AurynFloat min, AurynFloat max, Au if (timestep<0.0) { logger->msg("WeightChecker:: Minimally allowed timestep is 1dt", WARNING); timestep = 1; - } else timestep_ = timestep/dt; + } else timestep_ = timestep/auryn_timestep; } diff --git a/src/auryn/WeightMatrixMonitor.cpp b/src/auryn/WeightMatrixMonitor.cpp index 66374569..b7b9a9cd 100644 --- a/src/auryn/WeightMatrixMonitor.cpp +++ b/src/auryn/WeightMatrixMonitor.cpp @@ -41,7 +41,7 @@ void WeightMatrixMonitor::init(Connection * source, AurynFloat stepsize) auryn::sys->register_device(this); src = source; - ssize = (AurynTime) (stepsize/dt); + ssize = (AurynTime) (stepsize/auryn_timestep); outfile << std::setiosflags(std::ios::fixed) << std::setprecision(6); filecount = 0; @@ -58,7 +58,7 @@ void WeightMatrixMonitor::propagate() src->write_to_file(wmatfilename); filecount++; - outfile << dt*(auryn::sys->get_clock()) << " " << mean << " " << std << " " << wmatfilename << std::endl; + outfile << auryn_timestep*(auryn::sys->get_clock()) << " " << mean << " " << std << " " << wmatfilename << std::endl; } } diff --git a/src/auryn/WeightMonitor.cpp b/src/auryn/WeightMonitor.cpp index a6283491..5b5b3c7f 100644 --- a/src/auryn/WeightMonitor.cpp +++ b/src/auryn/WeightMonitor.cpp @@ -29,18 +29,18 @@ using namespace auryn; WeightMonitor::WeightMonitor(SparseConnection * source, std::string filename, AurynDouble interval ) : Monitor(filename) { - init(source,0,0,filename,interval/dt); + init(source,0,0,filename,interval/auryn_timestep); } WeightMonitor::WeightMonitor(SparseConnection * source, ForwardMatrix * m, std::string filename, AurynDouble interval ) : Monitor(filename) { - init(source,0,0,filename,interval/dt); + init(source,0,0,filename,interval/auryn_timestep); set_mat(m); } WeightMonitor::WeightMonitor(SparseConnection * source, NeuronID i, NeuronID j, std::string filename, AurynDouble interval, RecordingMode mode, StateID z ) : Monitor(filename) { - init(source,i,j,filename,interval/dt); + init(source,i,j,filename,interval/auryn_timestep); // overwrite the following default values set in init recordingmode = mode; @@ -349,7 +349,7 @@ void WeightMonitor::propagate() { if ( src->get_destination()->evolve_locally() ) { if (auryn::sys->get_clock()%ssize==0) { - outfile << std::fixed << dt*(auryn::sys->get_clock()) << std::scientific << " "; + outfile << std::fixed << auryn_timestep*(auryn::sys->get_clock()) << std::scientific << " "; if ( recordingmode == GROUPS ) record_synapse_groups(); else record_single_synapses(); outfile << "\n"; diff --git a/src/auryn/WeightPatternMonitor.cpp b/src/auryn/WeightPatternMonitor.cpp index d685e30c..279e882d 100644 --- a/src/auryn/WeightPatternMonitor.cpp +++ b/src/auryn/WeightPatternMonitor.cpp @@ -29,7 +29,7 @@ using namespace auryn; WeightPatternMonitor::WeightPatternMonitor(Connection * source, std::string filename, AurynDouble binsize) : Monitor(filename) { - init(source,filename,binsize/dt); + init(source,filename,binsize/auryn_timestep); } WeightPatternMonitor::~WeightPatternMonitor() diff --git a/src/auryn/WeightStatsMonitor.cpp b/src/auryn/WeightStatsMonitor.cpp index e1f6569c..fc072ded 100644 --- a/src/auryn/WeightStatsMonitor.cpp +++ b/src/auryn/WeightStatsMonitor.cpp @@ -29,7 +29,7 @@ using namespace auryn; WeightStatsMonitor::WeightStatsMonitor(Connection * source, std::string filename, AurynDouble binsize, NeuronID z) : Monitor(filename) { - init(source,filename,binsize/dt,z); + init(source,filename,binsize/auryn_timestep,z); } WeightStatsMonitor::~WeightStatsMonitor() diff --git a/src/auryn/WeightSumMonitor.cpp b/src/auryn/WeightSumMonitor.cpp index 29357d2d..3de50ae6 100644 --- a/src/auryn/WeightSumMonitor.cpp +++ b/src/auryn/WeightSumMonitor.cpp @@ -29,7 +29,7 @@ using namespace auryn; WeightSumMonitor::WeightSumMonitor(Connection * source, std::string filename, AurynDouble binsize) : Monitor(filename) { - init(source,filename,binsize/dt); + init(source,filename,binsize/auryn_timestep); } WeightSumMonitor::~WeightSumMonitor() diff --git a/src/auryn/auryn_definitions.cpp b/src/auryn/auryn_definitions.cpp index 40b30563..5dde41e5 100644 --- a/src/auryn/auryn_definitions.cpp +++ b/src/auryn/auryn_definitions.cpp @@ -28,6 +28,8 @@ namespace auryn { +double auryn_timestep = 1e-4; + int auryn_AlignOffset // copied from ATLAS (const int N, /* max return value */ const void *vp, /* pointer to be aligned */ diff --git a/src/auryn/auryn_definitions.h b/src/auryn/auryn_definitions.h index a4e21150..83d87165 100644 --- a/src/auryn/auryn_definitions.h +++ b/src/auryn/auryn_definitions.h @@ -72,10 +72,10 @@ /*! \brief System wide minimum delay which determines the sync interval between - * nodes in units of dt. + * nodes in units of auryn_timestep. * * Per default this is set to 8 which corresponds to 0.8ms with Auryn standard - * dt timestep of 0.1ms. The resaon for setting it to 8 is that the compiler + * auryn_timestep timestep of 0.1ms. The resaon for setting it to 8 is that the compiler * can then implement certain operations using MINDELAY with va bitshift * instead of regular division. However, the effect of this is presumably * negligible, but I am keeping this for hystoric reasons. @@ -92,17 +92,11 @@ /*! \brief These precompiler directives control - * what type of synaptic traces Auryn - * implements for STDP models. - */ +* what type of synaptic traces Auryn +* implements for STDP models. +*/ #define DEFAULT_TRACE_MODEL EulerTrace #define PRE_TRACE_MODEL EulerTrace -// To switch to LinearTrace as default -// pre_trace model uncomment the following -// lines: -// #define PRE_TRACE_MODEL_LINTRACE dummy -// #undef PRE_TRACE_MODEL -// #define PRE_TRACE_MODEL LinearTrace //* -- End of precompiler options -- *// @@ -149,8 +143,8 @@ namespace mpi = boost::mpi; namespace auryn { - /*! \brief Simulator wide integration time step */ - const double dt = 1.0e-4; + /*! \brief Simulation timestep */ + extern double auryn_timestep; /*! \brief Specifies the different transmitter types * that Auryn knows. */ From 8bbe04f6e5d89fefbb02d9de031b6bcb01132a76 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 20:30:02 -0700 Subject: [PATCH 65/77] Updates EulerTrace test to test also follow --- test/src/test_EulerTrace.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/test/src/test_EulerTrace.cpp b/test/src/test_EulerTrace.cpp index f6f1be7d..e46a17e3 100644 --- a/test/src/test_EulerTrace.cpp +++ b/test/src/test_EulerTrace.cpp @@ -5,7 +5,7 @@ using namespace auryn; -BOOST_AUTO_TEST_CASE( EulerTrace_decay ) { +BOOST_AUTO_TEST_CASE( EulerTrace_evolve ) { double tau = 20e-3; // a typical STDP time constant EulerTrace * tr_euler = new EulerTrace(4,tau); @@ -15,8 +15,8 @@ BOOST_AUTO_TEST_CASE( EulerTrace_decay ) { float simtime = 0.1; float maxdev = 0.0; - for ( int i = 0 ; i < (int)(simtime/dt) ; ++i ) { - float solution = std::exp(-i*dt/tau); + for ( int i = 0 ; i < (int)(simtime/auryn::auryn_timestep) ; ++i ) { + float solution = std::exp(-i*auryn::auryn_timestep/tau); float deviation = std::abs(tr_euler->get(0)-solution)/solution; if ( maxdev < deviation ) maxdev = deviation; tr_euler->evolve(); @@ -26,3 +26,32 @@ BOOST_AUTO_TEST_CASE( EulerTrace_decay ) { BOOST_REQUIRE( maxdev < precision ); } +BOOST_AUTO_TEST_CASE( EulerTrace_follow ) { + double tau = 20e-3; // a typical STDP time constant + EulerTrace * tr_euler = new EulerTrace(4,tau); + + AurynStateVector * target = new AurynStateVector(4); + target->set_all(3.141592); + + tr_euler->set_target( target ); + + // set_target inits with copy + BOOST_REQUIRE( target->get(0) == target->get(0) ); + + // lets drive the trace away + tr_euler->set(0,0.0); + BOOST_REQUIRE( tr_euler->get(0) == 0.0 ); + + // The follow trace should go exponentially to the target value 3.14.. + AurynStateVector * dist = new AurynStateVector(4); + for ( AurynTime t = 0 ; t < 6*tau/auryn_timestep; ++t ) { + tr_euler->follow(); + dist->diff(target, tr_euler); + // std::cout << tr_euler->get(0) << " " << dist->get(0) << std::endl; + } + + // and be almost there after 6 tau + float precision = 1e-4; + float result = 3.141592*std::exp(-6.0) + precision; + BOOST_REQUIRE( dist->get(0) < result ); +} From 8baf01202a6ca60b4efd659bf3d7ab10f8dbd69b Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 20:30:38 -0700 Subject: [PATCH 66/77] Adds old Clock constructor to LinearTrace --- src/auryn/LinearTrace.cpp | 8 +++++++- src/auryn/LinearTrace.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/auryn/LinearTrace.cpp b/src/auryn/LinearTrace.cpp index 0c386d2c..b4c73b0e 100644 --- a/src/auryn/LinearTrace.cpp +++ b/src/auryn/LinearTrace.cpp @@ -33,7 +33,6 @@ void LinearTrace::init(NeuronID n, AurynFloat timeconstant) zerointerval = 5*tau_auryntime; // clock = auryn::sys->get_clock_ptr(); - clock = sys->get_clock_ptr(); timestamp = new AurynTime[size]; } @@ -45,6 +44,13 @@ void LinearTrace::free() LinearTrace::LinearTrace(NeuronID n, AurynFloat timeconstant) : super(n, timeconstant) { init(n,timeconstant); + clock = sys->get_clock_ptr(); +} + +LinearTrace::LinearTrace(NeuronID n, AurynFloat timeconstant, AurynTime * clk ) : super(n, timeconstant) +{ + init(n,timeconstant); + clock = clk; } LinearTrace::~LinearTrace() diff --git a/src/auryn/LinearTrace.h b/src/auryn/LinearTrace.h index 3440264e..d8a2adb4 100644 --- a/src/auryn/LinearTrace.h +++ b/src/auryn/LinearTrace.h @@ -51,7 +51,12 @@ class LinearTrace : public EulerTrace void free(); public: + /* \brief Default constructor */ LinearTrace(NeuronID n, AurynFloat timeconstant); + /* \brief Test constructor which allows to init the class without Auryn kernel + * + * This is only used in tests and should not be used in a simulation. */ + LinearTrace(NeuronID n, AurynFloat timeconstant, AurynTime * clk); virtual ~LinearTrace(); void inc(NeuronID i); void add_specific(NeuronID i, AurynState amount); From 1c0b1d4a6c7d41c16f9c95424755199e8e9f7bb3 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 20:31:15 -0700 Subject: [PATCH 67/77] Resolves a problem with virtual method in constructor --- src/auryn/EulerTrace.cpp | 14 ++++++-------- src/auryn/Trace.h | 8 ++++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/auryn/EulerTrace.cpp b/src/auryn/EulerTrace.cpp index 050354e3..fab3ecfa 100644 --- a/src/auryn/EulerTrace.cpp +++ b/src/auryn/EulerTrace.cpp @@ -29,12 +29,10 @@ using namespace auryn; void EulerTrace::init(NeuronID n, AurynFloat timeconstant) { - // size = n; - // set_timeconstant(timeconstant); - // state = new AurynStateVector ( calculate_vector_size(size) ); - temp = new AurynStateVector ( calculate_vector_size(size) ); // temp vector set_all(0.); target_ptr = NULL; + temp = new AurynStateVector ( calculate_vector_size(size) ); // temp vector + set_timeconstant(timeconstant); } void EulerTrace::free() @@ -42,7 +40,7 @@ void EulerTrace::free() delete temp; } -EulerTrace::EulerTrace(NeuronID n, AurynFloat timeconstant) : Trace(n, timeconstant) +EulerTrace::EulerTrace(NeuronID n, AurynFloat timeconstant) : Trace( calculate_vector_size(n), timeconstant ) { init(n,timeconstant); } @@ -56,7 +54,7 @@ void EulerTrace::set_timeconstant(AurynFloat timeconstant) { super::set_timeconstant(timeconstant); mul_follow = auryn_timestep/tau; - scale_const = std::exp(-mul_follow); + scale_const = std::exp(-auryn_timestep/tau); } void EulerTrace::set_target( AurynStateVector * target ) @@ -74,7 +72,7 @@ void EulerTrace::evolve() void EulerTrace::follow() { - temp->diff(this,target_ptr); - saxpy(-auryn_timestep/tau, temp ); + temp->diff(target_ptr, this); + saxpy(mul_follow, temp ); } diff --git a/src/auryn/Trace.h b/src/auryn/Trace.h index c28de7d9..9b4f5076 100644 --- a/src/auryn/Trace.h +++ b/src/auryn/Trace.h @@ -52,13 +52,13 @@ class Trace : public AurynStateVector * * \param i index of trace to increment. */ - void inc(NeuronID i); + virtual void inc(NeuronID i); /*! \brief Increment given traces by 1. * * \param sc SpikeContainer with all neurons to increment. */ - void inc(SpikeContainer * sc); + virtual void inc(SpikeContainer * sc); /*! \brief Perform Euler step. */ virtual void evolve() = 0; @@ -73,10 +73,10 @@ class Trace : public AurynStateVector * * \param i index of trace to get */ - AurynFloat normalized_get(NeuronID i); + virtual AurynFloat normalized_get(NeuronID i); /*! \brief Get pointer to state AurynStateVector for fast processing. */ - AurynStateVector * get_state_ptr(); + virtual AurynStateVector * get_state_ptr(); /*! \brief Set the target vector for follow operation */ virtual void set_target( AurynStateVector * target ) = 0; From 814e25ddd08fea971fe6891e09f9ea48c531f298 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 20:32:35 -0700 Subject: [PATCH 68/77] Finalizes changes from global const variable dt to auryn_timestep --- test/src/test_LinearTrace.cpp | 8 ++++---- tools/aube.cpp | 2 +- tools/aubs.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/src/test_LinearTrace.cpp b/test/src/test_LinearTrace.cpp index c11bdfb3..f126fe04 100644 --- a/test/src/test_LinearTrace.cpp +++ b/test/src/test_LinearTrace.cpp @@ -23,7 +23,7 @@ BOOST_AUTO_TEST_CASE( LinearTrace_decay ) { for ( int i = 0 ; i < 10 ; ++i ) { clk = i*123; - float solution = std::exp(-dt*clk/tau); + float solution = std::exp(-auryn::auryn_timestep*clk/tau); float deviation = std::abs(tr_linear->get(idx)-solution)/solution; // std::cout << solution << " " << tr_linear->get(idx) << std::endl; BOOST_CHECK( deviation < precision ); @@ -48,8 +48,8 @@ BOOST_AUTO_TEST_CASE( LinearTrace_slow_decay ) { for ( int i = 0 ; i < 10 ; ++i ) { - clk = i*123.0/dt; - float solution = std::exp(-dt*clk/tau_long); + clk = i*123.0/auryn::auryn_timestep; + float solution = std::exp(-auryn::auryn_timestep*clk/tau_long); float deviation = std::abs(tr_linear->get(idx)-solution)/solution; // std::cout << solution << " " << tr_linear->get(idx) << std::endl; BOOST_CHECK( deviation < precision ); @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE( LinearTrace_pileup ) { LinearTrace * tr_linear = new LinearTrace(4,tau,&clk); float maxdev = 0.0; - int simsteps = 1.0e-3/dt; + int simsteps = 1.0e-3/auryn::auryn_timestep; for ( int k = 0 ; k < 10 ; ++ k ) { tr_euler->inc(idx); tr_linear->inc(idx); diff --git a/tools/aube.cpp b/tools/aube.cpp index 50c72e86..c4c8e4d1 100644 --- a/tools/aube.cpp +++ b/tools/aube.cpp @@ -104,7 +104,6 @@ int main(int ac, char* av[]) double seconds_to_extract_from_end = -1.0; // negative means disabled NeuronID maxid = std::numeric_limits::max(); // one more decimal than neede to show values are not rounded - int decimal_places = -std::log(dt)/std::log(10)+2; bool debug_output = false; try { @@ -272,6 +271,7 @@ int main(int ac, char* av[]) } AurynTime time_reference = from_time/dt; + int decimal_places = -std::log(dt)/std::log(10)+2; // open output filestream if needed std::ofstream of; diff --git a/tools/aubs.cpp b/tools/aubs.cpp index 5da8bea5..8eb63c15 100644 --- a/tools/aubs.cpp +++ b/tools/aubs.cpp @@ -107,7 +107,6 @@ int main(int ac, char* av[]) double to_time = -1.0; double seconds_to_extract_from_end = -1.0; // negative means disabled // one more decimal than neede to show values are not rounded - int decimal_places = -std::log(dt)/std::log(10)+2; bool debug_output = false; try { @@ -260,6 +259,7 @@ int main(int ac, char* av[]) input->read((char*)&frame, sizeof(StateValue_type)); AurynTime time_reference = from_time/dt; + int decimal_places = -std::log(dt)/std::log(10)+2; // open output filestream if needed std::ofstream of; From 5ff3693f7028ceeb84ae6c2b83ae4e64cca44d17 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Thu, 18 Aug 2016 20:56:23 -0700 Subject: [PATCH 69/77] Undo of accidentally commited changes --- build/release/run_benchmark.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/release/run_benchmark.sh b/build/release/run_benchmark.sh index 7b3d2e11..6044a4c4 100755 --- a/build/release/run_benchmark.sh +++ b/build/release/run_benchmark.sh @@ -1,8 +1,8 @@ #!/bin/bash # Compile code -# make clean -./bootstrap.sh && make -j 8 +make clean +./bootstrap.sh && make sleep 2 # Benchmark parameters From 97428888e55624b7203029ff394e7bc4eb14cd8f Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 11:43:34 -0700 Subject: [PATCH 70/77] Updates CMakeLists.txt --- CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79c33fb6..a01fef80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,8 +35,8 @@ ELSE() ENDIF() -INCLUDE_DIRECTORIES( AURYN_EXT_INCLUDEDIRS ) -INCLUDE_DIRECTORIES(src) +# INCLUDE_DIRECTORIES( ${AURYN_EXT_INCLUDEDIRS} ) +INCLUDE_DIRECTORIES( src ) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(examples) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 367cda8b..a1a82bfa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,9 +2,12 @@ FILE(GLOB auryn_SRC "*.h" "*.cpp" "auryn/*.cpp" "auryn/*.h" ) ADD_LIBRARY( auryn STATIC ${auryn_SRC} ) +message("AURYN_EXT_LINKLIBS is ${AURYN_EXT_LINKLIBS}") +message("AURYN_EXT_INCLUDEDIRS is ${AURYN_EXT_INCLUDEDIRS}") + # Dependencies to external libraries -TARGET_LINK_LIBRARIES( auryn ${MPI_CXX_LIBRARIES} ${Boost_LIBRARIES}) -TARGET_INCLUDE_DIRECTORIES( auryn PUBLIC ${Boost_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH}) +TARGET_LINK_LIBRARIES( auryn ${AURYN_EXT_LINKLIBS} ) +TARGET_INCLUDE_DIRECTORIES( auryn PUBLIC ${AURYN_EXT_INCLUDEDIRS} ) INSTALL(TARGETS auryn LIBRARY DESTINATION lib From 81019028cecae0ca2ca7bfc77a14f4159455b5d1 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 11:46:14 -0700 Subject: [PATCH 71/77] Adds logstrings --- src/auryn/System.cpp | 15 ++++++++++++--- src/auryn/System.h | 6 ------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/auryn/System.cpp b/src/auryn/System.cpp index 349a1a14..19ee1161 100644 --- a/src/auryn/System.cpp +++ b/src/auryn/System.cpp @@ -81,6 +81,10 @@ void System::init() { << sizeof(NeuronID) << " bytes."; auryn::logger->msg(oss.str(),VERBOSE); + oss << "NeuronID type has size of " + << sizeof(NeuronID) << " bytes."; + auryn::logger->msg(oss.str(),VERBOSE); + oss.str(""); oss << "AurynLong type has size of " << sizeof(AurynLong) << " bytes."; @@ -89,13 +93,19 @@ void System::init() { oss.str(""); oss << "Current NeuronID and sync are good for simulations up to " << std::numeric_limits::max()-1 << " cells."; - auryn::logger->msg(oss.str(),VERBOSE); + auryn::logger->msg(oss.str(),INFO); + + oss.str(""); + oss << "Simulation timestep is set to " + << std::scientific << auryn_timestep << "s "; + auryn::logger->msg(oss.str(),SETTINGS); oss.str(""); oss << "Current AurynTime good for simulations up to " << std::numeric_limits::max()*auryn_timestep << "s " << "( " << std::numeric_limits::max()*auryn_timestep/3600 << "h )"; - auryn::logger->msg(oss.str(),VERBOSE); + auryn::logger->msg(oss.str(),INFO); + if ( sizeof(NeuronID) != sizeof(AurynFloat) ) { @@ -111,7 +121,6 @@ void System::init() { set_master_seed(3521); - clk_dt = dt; #ifndef NDEBUG oss.str(""); diff --git a/src/auryn/System.h b/src/auryn/System.h index d435c1fe..5aa2212b 100644 --- a/src/auryn/System.h +++ b/src/auryn/System.h @@ -156,12 +156,6 @@ namespace auryn { /*! \brief Switch to turn output to quiet mode (no progress bar). */ bool quiet; - /*! \brief Global simulation timestep in seconds. - * - * \todo Make clk_dt a system member the global timestep. - * Corrently the timestep is defined as global static variable in auryn_definition.h */ - AurynFloat clk_dt; - /*! \brief Version info */ AurynVersion build; From 2f46808cb416d6aa6f6fb90466a63a082e2108d6 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 11:59:33 -0700 Subject: [PATCH 72/77] Fixes logger output in System --- src/auryn/System.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/auryn/System.cpp b/src/auryn/System.cpp index 19ee1161..886b73a8 100644 --- a/src/auryn/System.cpp +++ b/src/auryn/System.cpp @@ -81,10 +81,6 @@ void System::init() { << sizeof(NeuronID) << " bytes."; auryn::logger->msg(oss.str(),VERBOSE); - oss << "NeuronID type has size of " - << sizeof(NeuronID) << " bytes."; - auryn::logger->msg(oss.str(),VERBOSE); - oss.str(""); oss << "AurynLong type has size of " << sizeof(AurynLong) << " bytes."; @@ -95,6 +91,12 @@ void System::init() { << std::numeric_limits::max()-1 << " cells."; auryn::logger->msg(oss.str(),INFO); + if ( sizeof(NeuronID) != sizeof(AurynFloat) ) { + oss.str(""); + oss << " NeuronID and AurynFloat have different byte sizes which is not supported by SyncBuffer."; + auryn::logger->msg(oss.str(),ERROR); + } + oss.str(""); oss << "Simulation timestep is set to " << std::scientific << auryn_timestep << "s "; @@ -107,18 +109,12 @@ void System::init() { auryn::logger->msg(oss.str(),INFO); - - if ( sizeof(NeuronID) != sizeof(AurynFloat) ) { - oss.str(""); - oss << " NeuronID and AurynFloat have different byte sizes which is not supported by SyncBuffer."; - auryn::logger->msg(oss.str(),ERROR); - } - // init random number generator // gen = boost::mt19937(); dist = new boost::random::uniform_int_distribution<> (); die = new boost::variate_generator > ( gen, *dist ); - set_master_seed(3521); + unsigned int hardcoded_seed = 3521; + set_master_seed(hardcoded_seed); @@ -984,7 +980,13 @@ void System::set_master_seed( unsigned int seed ) } const unsigned int master_seed_multiplier = 257; - gen.seed(seed*master_seed_multiplier*mpi_rank()); + const unsigned int rank_master_seed = seed*master_seed_multiplier*(mpi_rank()+1); + + std::stringstream oss; + oss << "Seeding this rank with master seed " << rank_master_seed; + auryn::logger->msg(oss.str(),INFO); + + gen.seed(rank_master_seed); } unsigned int System::get_seed() From 102e868a33a8cc0c73e74ca9c03d337f512c9f35 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 12:33:31 -0700 Subject: [PATCH 73/77] Updates log string --- src/auryn/System.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/auryn/System.cpp b/src/auryn/System.cpp index 886b73a8..1353113b 100644 --- a/src/auryn/System.cpp +++ b/src/auryn/System.cpp @@ -144,9 +144,9 @@ System::System(mpi::communicator * communicator) std::stringstream oss; if ( mpi_size() > 1 ) { - oss << "MPI run rank " - << mpi_rank() << " out of " - << mpi_size() << " ranks total."; + oss << "This is an MPI run. I am rank " + << mpi_rank() << " of a total of " + << mpi_size() << " ranks."; auryn::logger->msg(oss.str(),NOTIFICATION); } else { auryn::logger->msg("Not running a parallel simulation.",NOTIFICATION); From 7646a6946df7b51c70a380bcc2a8cc7f8ac5ae69 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 12:44:11 -0700 Subject: [PATCH 74/77] Updates doxystring --- src/auryn/auryn_definitions.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/auryn/auryn_definitions.h b/src/auryn/auryn_definitions.h index 83d87165..8a4d0c1d 100644 --- a/src/auryn/auryn_definitions.h +++ b/src/auryn/auryn_definitions.h @@ -143,7 +143,10 @@ namespace mpi = boost::mpi; namespace auryn { - /*! \brief Simulation timestep */ + /*! \brief Simulation timestep in seconds + * + * \todo For consistency the global variable for auryn_timestep should be moved + * to either auryn_definitions or into the System class */ extern double auryn_timestep; /*! \brief Specifies the different transmitter types From b62be20284718873ae770e27fb26adf49ea9db39 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 14:24:19 -0700 Subject: [PATCH 75/77] Adds deprecated note to some precompiler macros --- src/auryn/auryn_definitions.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/auryn/auryn_definitions.h b/src/auryn/auryn_definitions.h index 8a4d0c1d..7358bb34 100644 --- a/src/auryn/auryn_definitions.h +++ b/src/auryn/auryn_definitions.h @@ -91,12 +91,10 @@ #define DEFAULT_MINDISTRIBUTEDSIZE 16 -/*! \brief These precompiler directives control -* what type of synaptic traces Auryn -* implements for STDP models. +/*! \brief These precompiler directives are deprecated and should not be used any more. */ -#define DEFAULT_TRACE_MODEL EulerTrace -#define PRE_TRACE_MODEL EulerTrace +#define DEFAULT_TRACE_MODEL Trace +#define PRE_TRACE_MODEL Trace //* -- End of precompiler options -- *// From 0ecccdd02256c57e3cd4c2c4affc0df44af4bc93 Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 14:44:41 -0700 Subject: [PATCH 76/77] Removes debug output --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1a82bfa..15c6bb66 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,8 +2,8 @@ FILE(GLOB auryn_SRC "*.h" "*.cpp" "auryn/*.cpp" "auryn/*.h" ) ADD_LIBRARY( auryn STATIC ${auryn_SRC} ) -message("AURYN_EXT_LINKLIBS is ${AURYN_EXT_LINKLIBS}") -message("AURYN_EXT_INCLUDEDIRS is ${AURYN_EXT_INCLUDEDIRS}") +# message("AURYN_EXT_LINKLIBS is ${AURYN_EXT_LINKLIBS}") +# message("AURYN_EXT_INCLUDEDIRS is ${AURYN_EXT_INCLUDEDIRS}") # Dependencies to external libraries TARGET_LINK_LIBRARIES( auryn ${AURYN_EXT_LINKLIBS} ) From 596a41fcdfc895eed83dfb3b76f606749707a11f Mon Sep 17 00:00:00 2001 From: Friedemann Zenke Date: Fri, 19 Aug 2016 15:55:01 -0700 Subject: [PATCH 77/77] Adds new add_trace functions to SpikingGroup --- src/auryn/SpikingGroup.cpp | 22 ++++++++++++++++++++-- src/auryn/SpikingGroup.h | 13 ++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/auryn/SpikingGroup.cpp b/src/auryn/SpikingGroup.cpp index b9551c41..f0e2d46d 100644 --- a/src/auryn/SpikingGroup.cpp +++ b/src/auryn/SpikingGroup.cpp @@ -370,10 +370,19 @@ Trace * SpikingGroup::get_pre_trace( AurynFloat x ) auryn::logger->msg("Initializing pre trace instance",VERBOSE); Trace * tmp = new EulerTrace(get_pre_size(),x); - pretraces.push_back(tmp); + add_pre_trace(tmp); return tmp; } +void SpikingGroup::add_pre_trace( Trace * tr ) +{ + if ( tr->size != get_pre_size() ) { + logger->warning("Trying to add as pretrace, but its size does not match the SpikinGroup."); + return; + } + pretraces.push_back(tr); +} + Trace * SpikingGroup::get_post_trace( AurynFloat x ) { for ( NeuronID i = 0 ; i < posttraces.size() ; i++ ) { @@ -388,10 +397,19 @@ Trace * SpikingGroup::get_post_trace( AurynFloat x ) auryn::logger->msg("Initializing post trace instance",VERBOSE); Trace * tmp = new EulerTrace(get_post_size(),x); - posttraces.push_back(tmp); + add_post_trace(tmp); return tmp; } +void SpikingGroup::add_post_trace( Trace * tr ) +{ + if ( tr->size != get_vector_size() ) { + logger->warning("Trying to add as pretrace, but its size does not match the SpikinGroup."); + return; + } + posttraces.push_back(tr); +} + Trace * SpikingGroup::get_post_state_trace( AurynStateVector * state, AurynFloat tau, AurynFloat b ) { // first let's check if a state with that name exists diff --git a/src/auryn/SpikingGroup.h b/src/auryn/SpikingGroup.h index 130f21fe..7895575c 100644 --- a/src/auryn/SpikingGroup.h +++ b/src/auryn/SpikingGroup.h @@ -32,7 +32,6 @@ #include "Trace.h" #include "EulerTrace.h" - #include #include @@ -276,12 +275,24 @@ class SpikingGroup * otherwise creates a new instance first. */ Trace * get_pre_trace( AurynFloat x ); + /*! \brief Adds trace to pretrace stack of a connection + * + * Mostly for internal use by get_pre_trace() + */ + void add_pre_trace( Trace * tr ); + /*! \brief Returns a post trace with time constant x * * Checks first if an instance of a trace exists and returns it * otherwise creates a new instance first. */ Trace * get_post_trace( AurynFloat x ); + /*! \brief Adds trace to posttrace stack of a connection + * + * Mostly for internal use by get_post_trace() + */ + void add_post_trace( Trace * tr ); + /*! \brief Pushes a spike into the axonal SpikeDelay buffer */ void push_spike(NeuronID spike);