Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into integrate_odes_hi…
Browse files Browse the repository at this point in the history
…gh_order
  • Loading branch information
pnbabu committed Nov 6, 2024
2 parents bf24e99 + ac9b6e5 commit 34adbdc
Show file tree
Hide file tree
Showing 59 changed files with 1,357 additions and 509 deletions.
171 changes: 171 additions & 0 deletions .github/workflows/continuous_benchmarking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
on:
pull_request_target:
types: [opened, reopened, edited, synchronize]

jobs:
fork_pr_requires_review:
environment: ${{ (github.event.pull_request.head.repo.full_name == github.repository && 'internal') || 'external' }}
runs-on: ubuntu-latest
steps:
- run: true

benchmark_fork_pr_branch:
needs: fork_pr_requires_review
name: Continuous Benchmarking Fork PRs with Bencher
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- uses: bencherdev/bencher@main

# Setup Python version
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8

# Install dependencies
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libltdl7-dev libgsl0-dev libncurses5-dev libreadline6-dev pkg-config
sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3
# Install Python dependencies
- name: Python dependencies
run: |
python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy pandas pytest-benchmark
python -m pip install -r requirements.txt
# Install NEST simulator
- name: NEST simulator
run: |
python -m pip install cython
echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
NEST_SIMULATOR=$(pwd)/nest-simulator
NEST_INSTALL=$(pwd)/nest_install
echo "NEST_SIMULATOR = $NEST_SIMULATOR"
echo "NEST_INSTALL = $NEST_INSTALL"
git clone --depth=1 https://github.com/nest/nest-simulator
mkdir nest_install
echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV
cd nest_install
cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR
make && make install
cd ..
# Install NESTML (repeated)
- name: Install NESTML
run: |
export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.8/site-packages
#echo PYTHONPATH=`pwd` >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
python setup.py install
- name: Track Fork PR Benchmarks with Bencher
env:
LD_LIBRARY_PATH: ${{ env.NEST_INSTALL }}/lib/nest
run: |
echo "NEST_INSTALL = $NEST_INSTALL"
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest bencher run \
--project nestml \
--token '${{ secrets.BENCHER_API_TOKEN }}' \
--branch '${{ github.event.number }}/merge' \
--branch-start-point '${{ github.base_ref }}' \
--branch-start-point-hash '${{ github.event.pull_request.base.sha }}' \
--branch-reset \
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
--testbed ubuntu-latest \
--adapter python_pytest \
--file results.json \
--err \
'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest python3 -m pytest --benchmark-json results.json -s $GITHUB_WORKSPACE/tests/nest_continuous_benchmarking/test_nest_continuous_benchmarking.py'
on:
push:
branches: master

jobs:
benchmark_base_branch:
name: Continuous Benchmarking Fork PRs with Bencher
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- uses: bencherdev/bencher@main

# Setup Python version
- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8

# Install dependencies
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install libltdl7-dev libgsl0-dev libncurses5-dev libreadline6-dev pkg-config
sudo apt-get install python3-all-dev python3-matplotlib python3-numpy python3-scipy ipython3
# Install Python dependencies
- name: Python dependencies
run: |
python -m pip install --upgrade pip pytest jupyterlab matplotlib pycodestyle scipy pandas pytest-benchmark
python -m pip install -r requirements.txt
# Install NEST simulator
- name: NEST simulator
run: |
python -m pip install cython
echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
NEST_SIMULATOR=$(pwd)/nest-simulator
NEST_INSTALL=$(pwd)/nest_install
echo "NEST_SIMULATOR = $NEST_SIMULATOR"
echo "NEST_INSTALL = $NEST_INSTALL"
git clone --depth=1 https://github.com/nest/nest-simulator
mkdir nest_install
echo "NEST_INSTALL=$NEST_INSTALL" >> $GITHUB_ENV
cd nest_install
cmake -DCMAKE_INSTALL_PREFIX=$NEST_INSTALL $NEST_SIMULATOR
make && make install
cd ..
# Install NESTML (repeated)
- name: Install NESTML
run: |
export PYTHONPATH=${{ env.PYTHONPATH }}:${{ env.NEST_INSTALL }}/lib/python3.8/site-packages
#echo PYTHONPATH=`pwd` >> $GITHUB_ENV
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
python setup.py install
- name: Track Fork PR Benchmarks with Bencher
env:
LD_LIBRARY_PATH: ${{ env.NEST_INSTALL }}/lib/nest
run: |
echo "NEST_INSTALL = $NEST_INSTALL"
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest bencher run \
--project nestml \
--token '${{ secrets.BENCHER_API_TOKEN }}' \
--branch master \
--threshold-measure latency \
--threshold-test t_test \
--threshold-max-sample-size 64 \
--threshold-upper-boundary 0.99 \
--thresholds-reset \
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
--testbed ubuntu-latest \
--adapter python_pytest \
--file results.json \
--err \
'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ env.NEST_INSTALL }}/lib/nest python3 -m pytest --benchmark-json results.json -s $GITHUB_WORKSPACE/tests/nest_continuous_benchmarking/test_nest_continuous_benchmarking.py'
11 changes: 9 additions & 2 deletions doc/models_library/aeif_cond_alpha_neuron.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@ and

.. math::
\tau_w \frac{dw}{dt} = a(V_m-E_L) - w
\tau_w \frac{dw}{dt} = a(V_m-E_L) - w
Note that the membrane potential can diverge to positive infinity due to the exponential term. To avoid numerical instabilities, instead of :math:`V_m`, the value :math:`\min(V_m,V_{peak})` is used in the dynamical equations.

.. note::

The default refractory period for ``aeif`` models is zero, consistent with the model definition in
Brette & Gerstner [1]_. Thus, an ``aeif`` neuron with default parameters can fire multiple spikes in a single
time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
To avoid such unphysiological behavior, you should set a refractory time ``refr_t > 0``.


References
++++++++++
Expand Down Expand Up @@ -108,4 +115,4 @@ The model source code can be found in the NESTML models repository here: `aeif_c

.. footer::

Generated at 2024-05-22 14:51:14.532753
Generated at 2024-05-22 14:51:14.532753
8 changes: 7 additions & 1 deletion doc/models_library/aeif_cond_exp_neuron.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ and
Note that the membrane potential can diverge to positive infinity due to the exponential term. To avoid numerical instabilities, instead of :math:`V_m`, the value :math:`\min(V_m,V_{peak})` is used in the dynamical equations.

.. note::
The default refractory period for ``aeif`` models is zero, consistent with the model definition in
Brette & Gerstner [1]_. Thus, an ``aeif`` neuron with default parameters can fire multiple spikes in a single
time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
To avoid such unphysiological behavior, you should set a refractory time ``refr_t > 0``.


References
++++++++++
Expand Down Expand Up @@ -109,4 +115,4 @@ The model source code can be found in the NESTML models repository here: `aeif_c

.. footer::

Generated at 2024-05-22 14:51:14.484055
Generated at 2024-05-22 14:51:14.484055
8 changes: 1 addition & 7 deletions doc/models_library/output.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,4 @@ <h3 id="stdp_triplet_synapse-stdp_triplet_synapse"><code
<p>Synapse type with triplet spike-timing dependent plasticity</p>
<p>Source file: <a
href="https://www.github.com/nest/nestml/blob/master/models/synapses/stdp_triplet_synapse.nestml">stdp_triplet_synapse.nestml</a></p>
<h3 id="third_factor_stdp_synapse-third_factor_stdp_synapse"><code
class="interpreted-text"
role="doc">third_factor_stdp_synapse &lt;third_factor_stdp_synapse&gt;</code></h3>
<p>Synapse model for spike-timing dependent plasticity with postsynaptic
third-factor modulation</p>
<p>Source file: <a
href="https://www.github.com/nest/nestml/blob/master/models/synapses/third_factor_stdp_synapse.nestml">third_factor_stdp_synapse.nestml</a></p>

24 changes: 24 additions & 0 deletions doc/nestml_language/nestml_language_concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,30 @@ Each model can only send a single type of event. The type of the event has to be
Calling the ``emit_spike()`` function in the ``update`` block results in firing a spike to all target neurons and devices time stamped with the simulation time at the end of the time interval ``t + timestep()``.

Event attributes
~~~~~~~~~~~~~~~~

Each spiking output event can be parameterised by one or more attributes. For example, a synapse could assign a weight (as a real number) and delay (in milliseconds) to its spike events by including these values in the call to ``emit_spike()``:

.. code-block:: nestml
parameters:
weight real = 10.
update:
emit_spike(weight, 1 ms)
If spike event attributes are used, their names and types must be given as part of the output port specification, for example:

.. code-block:: nestml
output:
spike(weight real, delay ms)
The names are only used externally, so that other models can refer to the correct attribute (such as a downstream neuron that is receiving the spike through its input port). It is thus allowed to have a state variable called ``weight`` and an output port attribute by the same name; the output port attribute name does not refer to names declared inside the model.

Specific code generators may support a specific set of attributes; please check the documentation of each individual code generator for more details.


Equations
---------
Expand Down
4 changes: 2 additions & 2 deletions doc/nestml_language/synapses_in_nestml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ For example:
.. code-block:: nestml
parameters:
a real = 3.14159 @homogeneous
b real = 100. @heterogeneous # the default!
a real = pi @homogeneous
b integer = 42 @heterogeneous # the default!
Third-factor plasticity
Expand Down
8 changes: 8 additions & 0 deletions doc/running/running_nest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ For a full example, please see `iaf_psc_exp_multisynapse_vectors.nestml <https:/
Generating code
---------------

Output event attributes
~~~~~~~~~~~~~~~~~~~~~~~

In neuron models, no spike event attributes are supported.

In synapse models, precisely two spike event attributes are supported: a synaptic weight (as a real number) and a synaptic (dendritic) delay (in milliseconds).


Generating code for plastic synapses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/stdp_dopa_synapse/stdp_dopa_synapse.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
" mod_spikes <- spike\n",
"\n",
" output:\n",
" spike\n",
" spike(weight real, delay ms)\n",
"\n",
" onReceive(mod_spikes):\n",
" n += A_vt / tau_n\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
" I_post_dend pA <- continuous\n",
"\n",
" output:\n",
" spike\n",
" spike(weight real, delay ms)\n",
"\n",
" onReceive(post_spikes):\n",
" # potentiate synapse\n",
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorials/stdp_windows/stdp_windows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
" post_spikes <- spike\n",
"\n",
" output:\n",
" spike\n",
" spike(weight real, delay ms)\n",
"\n",
" onReceive(post_spikes):\n",
" # potentiate synapse\n",
Expand Down Expand Up @@ -3214,7 +3214,7 @@
" post_spikes <- spike\n",
"\n",
" output:\n",
" spike\n",
" spike(weight real, delay ms)\n",
"\n",
" onReceive(post_spikes):\n",
" post_nn_trace = 1\n",
Expand Down Expand Up @@ -4805,7 +4805,7 @@
" post_spikes <- spike\n",
"\n",
" output:\n",
" spike\n",
" spike(weight real, delay ms)\n",
"\n",
" onReceive(post_spikes, priority=2):\n",
" w += lambda * (pre_trace + post_trace)\n",
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorials/triplet_stdp_synapse/triplet_stdp_synapse.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
" post_spikes <- spike\n",
"\n",
" output:\n",
" spike\n",
" spike(weight real, delay ms)\n",
"\n",
" onReceive(post_spikes):\n",
" # increment post trace values\n",
Expand Down Expand Up @@ -1120,7 +1120,7 @@
" post_spikes <- spike\n",
"\n",
" output:\n",
" spike\n",
" spike(weight real, delay ms)\n",
"\n",
" onReceive(post_spikes):\n",
" # increment post trace values\n",
Expand Down
9 changes: 8 additions & 1 deletion models/neurons/aeif_cond_alpha_neuron.nestml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ and

.. math::

\tau_w \frac{dw}{dt} = a(V_m-E_L) - w
\tau_w \frac{dw}{dt} = a(V_m-E_L) - w

Note that the membrane potential can diverge to positive infinity due to the exponential term. To avoid numerical instabilities, instead of :math:`V_m`, the value :math:`\min(V_m,V_{peak})` is used in the dynamical equations.

.. note::

The default refractory period for ``aeif`` models is zero, consistent with the model definition in
Brette & Gerstner [1]_. Thus, an ``aeif`` neuron with default parameters can fire multiple spikes in a single
time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
To avoid such unphysiological behavior, you should set a refractory time ``refr_t > 0``.


References
++++++++++
Expand Down
7 changes: 7 additions & 0 deletions models/neurons/aeif_cond_exp_neuron.nestml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ and

Note that the membrane potential can diverge to positive infinity due to the exponential term. To avoid numerical instabilities, instead of :math:`V_m`, the value :math:`\min(V_m,V_{peak})` is used in the dynamical equations.

.. note::

The default refractory period for ``aeif`` models is zero, consistent with the model definition in
Brette & Gerstner [1]_. Thus, an ``aeif`` neuron with default parameters can fire multiple spikes in a single
time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
To avoid such unphysiological behavior, you should set a refractory time ``refr_t > 0``.


References
++++++++++
Expand Down
2 changes: 1 addition & 1 deletion models/synapses/neuromodulated_stdp_synapse.nestml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ model neuromodulated_stdp_synapse:
mod_spikes <- spike

output:
spike
spike(weight real, delay ms)

onReceive(mod_spikes):
n += 1. / tau_n
Expand Down
Loading

0 comments on commit 34adbdc

Please sign in to comment.