Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exponential lookup tables for homogenous STDP synapses #3247

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

otcathatsya
Copy link
Contributor

@otcathatsya otcathatsya commented Jul 9, 2024

Updated implementation of lookup tables for exponential computations in homogenous STDP synapses (original commits by @suku248 @jarsi), for now just applied to stdp_pl_synapse_hom. There are a few potential concerns:

  • Ideally we'd be able to keep ArchivingNode as a common base class and support both (potentially) precise spike times as well as size_t-implemented grid steps, but due to the way history is stored this is impossible without costly conversion on multiple occasions. A dynamic polymorphism approach + conversions was implemented, but did considerably worse in benchmarks (albeit still better than the baseline, see figures below). For a simplified implementation, see: Make regular histentry step-based #3307

  • Since we now require a separate archiving node (could be a static template impl but that also has minor overhead), we also need to duplicate the nodes that support homogenous STDP synapses; we introduced iaf_psc_alpha_hom. A better solution would probably require a restructuring for the way archivers are implemented, e.g. as pointers.

In the figures below, "plain" is an implementation that just replaced existing structures for testing purposes while "separate" is the current version with duplicated classes, they are both listed as a sanity check and performance should be the same. "Converted" uses a templated histentry and conversion approach in archiving node. Std and mean values taken over 3 rng seeds.
exp_tables
exp_tables_2

@otcathatsya otcathatsya added the T: Enhancement New functionality, model or documentation label Jul 9, 2024
@clinssen clinssen self-requested a review July 9, 2024 13:59
@JanVogelsang JanVogelsang self-requested a review July 9, 2024 15:06
@JanVogelsang JanVogelsang added S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: High Should be handled next and removed S: Normal Handle this with default priority labels Jul 9, 2024
@otcathatsya otcathatsya force-pushed the exp_lookup_hom_stdp branch from e4b9e0e to 96cd3b0 Compare July 12, 2024 11:25
@otcathatsya otcathatsya force-pushed the exp_lookup_hom_stdp branch from 96cd3b0 to 1807697 Compare July 12, 2024 11:30
@otcathatsya otcathatsya marked this pull request as ready for review September 10, 2024 11:32
@@ -144,7 +144,6 @@ def
/V_reset 0.0 mV % Reset Potential (mV)
/tau_syn_ex tau_syn % time const. postsynaptic excitatory currents (ms)
/tau_syn_in tau_syn % time const. postsynaptic inhibitory currents (ms)
/tau_minus 30.0 ms %time constant for STDP (depression)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed in the hpc_benchmark? Should it not use the default (non-lookup-table) version of exp?

@@ -0,0 +1,408 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this could be named differently from "hom[ogeneous]", like "lookup" or "fast"? Please indicate in the model docstring how this model is different from iaf_psc_alpha.


constexpr double TAU_MINUS_PLACEHOLDER = 1.0; // indicate that tau minus has not been set yet

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add documentation here about the fixed time step based lookup table.

// Includes from sli:
#include "dictdatum.h"

#define DEBUG_ARCHIVER 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be 1?

@@ -43,6 +43,18 @@ class histentry
size_t access_counter_; //!< access counter to enable removal of the entry, once all neurons read it
};

class histentry_step
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a docstring describing how this is different from histentry

@@ -761,7 +763,9 @@ class Node
* return the Kminus value at t (in ms).
* @throws UnexpectedEvent
*/
virtual double get_K_value( double t );
virtual double get_K_value( long t, size_t& dt_steps );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a detailed docstring

@@ -777,6 +781,11 @@ class Node
* return the spike history for (t1,t2].
* @throws UnexpectedEvent
*/
virtual void get_history( long t1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a detailed docstring

@@ -224,10 +224,10 @@ def build_network(logger):
nest.overwrite_files = True

nest.message(M_INFO, "build_network", "Creating excitatory population.")
E_neurons = nest.Create("iaf_psc_alpha", NE, params=model_params)
E_neurons = nest.Create("iaf_psc_alpha_hom", NE, params=model_params)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be a user-configurable option which version of the model to select? Should the default remain the same (as the changed proposed in this PR is a numerical approximation for the purpose of runtime performance benefit)?

@@ -18,12 +18,12 @@
#
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

import unittest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use pytest instead? unittest is deprecated.

@@ -42,8 +42,8 @@ M_ERROR setverbosity
/total_num_virtual_procs 1
>> SetKernelStatus

/iaf_psc_alpha Create /n1 Set
/iaf_psc_alpha Create /n2 Set
/iaf_psc_alpha_hom Create /n1 Set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this remain the original? Should the test for the "hom" version be added rather than replacing the original?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: High Should be handled next T: Enhancement New functionality, model or documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants