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

NESTML Benchmark with MPI #1069

Draft
wants to merge 72 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
311c3d9
Initial commit for benchmark scripts with MPI
pnbabu Jun 25, 2024
f8a7c30
Modify script to add memory benchmark
pnbabu Jul 8, 2024
968ed08
add ISI plotting to benchmark script
Jul 8, 2024
610382b
Merge remote-tracking branch 'upstream/master' into nestml_benchmark
pnbabu Jul 8, 2024
610a9fc
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Jul 8, 2024
21f9e07
add aeif_psc_alpha neuron model
Jul 10, 2024
4240afb
Update benchmark scripts
pnbabu Jul 12, 2024
ffd20bc
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Jul 12, 2024
d886bac
Update sbatch script
pnbabu Jul 12, 2024
3149489
add N_rec_exc and N_rec_inh parameters
Jul 15, 2024
6b34d2a
add debug print information
Jul 15, 2024
cd84db9
Add print statements
pnbabu Jul 15, 2024
9cf62ee
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Jul 15, 2024
fb36493
add ISI plots script
Jul 15, 2024
ce14597
Add short_sim command line arg
pnbabu Jul 15, 2024
f065e4e
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Jul 15, 2024
2120c74
adding better RNG seeding
Jul 15, 2024
b6ea30f
add ISI plots script
Jul 15, 2024
6b94665
add ISI plots script
Jul 15, 2024
b0e8546
fix isi plotting script
Jul 16, 2024
4302bf2
Update iterations for short simulations
pnbabu Jul 16, 2024
8a5aae5
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Jul 16, 2024
156d060
update aeif_psc_alpha neuron to eliminate kernels and convolutions
Jul 21, 2024
104416c
merge benchmarking across threads and across compute nodes in benchma…
Jul 24, 2024
4d7f57f
merge benchmarking across threads and across compute nodes in benchma…
Jul 24, 2024
c0ce5c2
merge benchmarking across threads and across compute nodes in benchma…
Jul 24, 2024
babd614
merge benchmarking across threads and across compute nodes in benchma…
Jul 24, 2024
8ede374
merge benchmarking across threads and across compute nodes in benchma…
Jul 24, 2024
aa31332
merge benchmarking across threads and across compute nodes in benchma…
Jul 25, 2024
9700877
merge benchmarking across threads and across compute nodes in benchma…
Jul 28, 2024
618e3ae
merge benchmarking across threads and across compute nodes in benchma…
Jul 29, 2024
afe6b48
merge benchmarking across threads and across compute nodes in benchma…
Jul 29, 2024
9faa6fa
merge benchmarking across threads and across compute nodes in benchma…
Jul 29, 2024
30ddb28
merge benchmarking across threads and across compute nodes in benchma…
Jul 29, 2024
7e3a12f
merge benchmarking across threads and across compute nodes in benchma…
Jul 29, 2024
2509b45
merge benchmarking across threads and across compute nodes in benchma…
Aug 1, 2024
a18f8a3
Merge remote-tracking branch 'upstream/master' into nestml_benchmark
pnbabu Aug 6, 2024
e6a42d7
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Aug 6, 2024
78a35d0
disable minor ticks on x-axis
Aug 13, 2024
20d6b4e
fix axis labels for threads run
Aug 13, 2024
8bd269d
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Aug 15, 2024
738d4cb
make plot styles consistent
Aug 16, 2024
39429b7
make plot styles consistent
Aug 16, 2024
e935983
make plot styles consistent
Aug 16, 2024
a177c3d
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
pnbabu Aug 16, 2024
b11e06b
ISI plots for MPI runs
pnbabu Aug 20, 2024
1deb2cf
update benchmark plots
Aug 20, 2024
b5f8c0f
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
Aug 20, 2024
0ffcf65
update benchmark plots
Aug 23, 2024
38ccb83
plot runtime data log-log
Aug 25, 2024
d4f81f5
Modify the path of benchmark.py in the template
pnbabu Sep 4, 2024
939c42a
add K-S distance metric
Sep 4, 2024
e166be8
add K-S distance metric
Sep 4, 2024
c98b3f3
update plots
Sep 5, 2024
686e0af
add KS statistic to benchmarking script
Sep 9, 2024
3d0f035
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
Sep 9, 2024
6b83ea9
updates to memory plots
Sep 9, 2024
d05e989
updates to memory plots
Sep 9, 2024
4a06acd
fix plotting in brunel script
Sep 10, 2024
e88b582
plotting updates in benchmark script
clinssen Sep 11, 2024
16b3e2a
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
clinssen Sep 11, 2024
5e4148f
plotting updates in benchmark script
clinssen Sep 12, 2024
f6d6aa4
make all benchmarking panels part of the same figure
Sep 12, 2024
bde951f
Peformance benchmark changes
pnbabu Sep 13, 2024
aad3faa
make all benchmarking panels part of the same figures
Sep 13, 2024
4d3248d
Merge remote-tracking branch 'origin/nestml_benchmark' into nestml_be…
Sep 13, 2024
107a760
make all benchmarking panels part of the same figures
clinssen Sep 13, 2024
1411a18
make all benchmarking panels part of the same figures
clinssen Sep 13, 2024
3a5070b
fix memory plot
clinssen Sep 18, 2024
2c00af4
fix plots vertical axes
clinssen Sep 18, 2024
7d7379d
add column labels to performance plot
clinssen Sep 19, 2024
34a4a4c
fix plotting order
clinssen Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
803 changes: 803 additions & 0 deletions extras/benchmark/Running/benchmark.py

Large diffs are not rendered by default.

705 changes: 705 additions & 0 deletions extras/benchmark/Running/brunel_alpha_nest.py

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions extras/benchmark/Running/plotting_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import matplotlib.pyplot as plt

# Plotting options

# plt.style.use('tableau-colorblind10')
palette = plt.get_cmap("tab10")

# def palette(x):
# return plt.rcParams['axes.prop_cycle'].by_key()['color'][x]


plt.rcParams['axes.grid'] = True

plt.rcParams['grid.color'] = 'gray'
plt.rcParams['grid.linestyle'] = '--'
plt.rcParams['grid.linewidth'] = 0.5

plt.rcParams['axes.labelsize'] = 16 # Size of the axis labels
plt.rcParams['xtick.labelsize'] = 14 # Size of the x-axis tick labels
plt.rcParams['ytick.labelsize'] = 14 # Size of the y-axis tick labels
plt.rcParams['legend.fontsize'] = 14 # Size of the legend labels
plt.rcParams['figure.titlesize'] = 16 # Size of the figure title
26 changes: 26 additions & 0 deletions extras/benchmark/Running/sbatch_run.sh.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#SBATCH --job-name=nestml_benchmark
#SBATCH --account=jinm60
#SBATCH --partition=dc-cpu
#SBATCH --time=05:00:00
#SBATCH --nodes={{nodes}}
#SBATCH --ntasks-per-node={{ntasks_per_node}}
#SBATCH --cpus-per-task={{cpus_per_task}}
#SBATCH --hint=nomultithread
#SBTACH --exclusive
#SBATCH --output={{combination["output_file"]}}
#SBATCH --error={{combination["error_file"]}}
#SBATCH --disable-perfparanoid

{%- if enable_profile %}
ml AMD-uProf
{%- endif %}

export OMP_PROC_BIND=TRUE
export PROGRAM="python3 Running/brunel_alpha_nest.py --simulated_neuron {{combination["simulated_neuron"]}} --network_scale {{combination["network_scale"]}} --nodes {{ combination["nodes"] }} --threads {{combination["threads"]}} --iteration {{combination["iteration"]}} --benchmarkPath {{combination["benchmarkPath"]}} --rng_seed {{combination["rng_seed"]}}"

{%- if enable_profile %}
srun AMDuProfCLI collect --config tbp --mpi -o cpuprof $PROGRAM
{%- else %}
srun $PROGRAM
{%- endif %}
4 changes: 4 additions & 0 deletions extras/benchmark/Running/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

source "/home/charl/julich/nest-simulator-install/bin/nest_vars.sh"

39 changes: 39 additions & 0 deletions extras/benchmark/buildAll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

ml Stages/2024 GCC Boost ParaStationMPI GSL jemalloc Python SciPy-Stack mpi4py CMake Autotools

echo installing nestml-simulator

#Install nestsimulator
rm -rf nest-build
rm -rf nest-simulator-install


# Paths
srcPath=$(pwd)/nest-simulator
installPath=$(pwd)/nest-simulator-install

mkdir nest-build
mkdir nest-simulator-install

cd nest-build

cmake -DCMAKE_INSTALL_PREFIX:PATH=$installPath $srcPath -Dwith-mpi=OFF -Dwith-optimize="-O3" -Dwith-readline=OFF -Dwith-detailed-timers=ON
make -j24 install

cd ..

echo installing nestml
#install nestml
cd nestml
python3 -m pip install .
cd ..

source nest-simulator-install/bin/nest_vars.sh

echo installing custom neurons
#install custom neurons

source updateCustomNeurons.sh

source run.sh
22 changes: 22 additions & 0 deletions extras/benchmark/compile_nest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -x

ml Stages/2024 GCC Boost ParaStationMPI GSL jemalloc Python SciPy-Stack mpi4py CMake Autotools

python3 -m pip install pytest-xdist pytest-timeout junitparser

cd
mv -vi nest-simulator /tmp
git clone https://github.com/nest/nest-simulator
cd nest-simulator
git checkout v3.6
cd ..

mv -vi nest-simulator-build /tmp/
mkdir nest-simulator-build
cd nest-simulator-build

# TODO: -Dwith-detailed-timers=ON required?
cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME/nest-simulator-install -Dwith-mpi=ON -Dwith-optimize="-O3" -Dwith-readline=OFF ../nest-simulator

make -j16
make install
7 changes: 7 additions & 0 deletions extras/benchmark/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

ml Stages/2024 GCC Boost ParaStationMPI GSL jemalloc Python SciPy-Stack mpi4py CMake Autotools

cd Running
python3 benchmark.py
cd ..
27 changes: 27 additions & 0 deletions extras/benchmark/updateCustomNeurons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
source ../nest-simulator-install/bin/nest_vars.sh

cd Running/targets_aeif_psc_alpha/target_optimized
rm -rf CMakeCache.txt CMakeFiles
cmake .
make -j24 install
cd ../../..

cd Running/targets_aeif_psc_alpha/target
rm -rf CMakeCache.txt CMakeFiles
cmake .
make -j24 install
cd ../../..

cd Running/targets_aeif_psc_alpha/target_plastic
rm -rf CMakeCache.txt CMakeFiles
cmake .
make -j24 install
cd ../../..


cd Running/targets_aeif_psc_alpha/target_plastic_noco
rm -rf CMakeCache.txt CMakeFiles
cmake .
make -j24 install
cd ../../..
119 changes: 119 additions & 0 deletions models/neurons/aeif_psc_alpha_neuron.nestml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
"""
aeif_psc_alpha - Conductance based exponential integrate-and-fire neuron model
###############################################################################

Description
+++++++++++

aeif_psc_alpha is the adaptive exponential integrate and fire neuron according to Brette and Gerstner (2005), with post-synaptic conductances in the form of a bi-exponential ("alpha") function.

The membrane potential is given by the following differential equation:

.. math::

C_m \frac{dV_m}{dt} =
-g_L(V_m-E_L)+g_L\Delta_T\exp\left(\frac{V_m-V_{th}}{\Delta_T}\right) -
g_e(t)(V_m-E_e) \\
-g_i(t)(V_m-E_i)-w + I_e

and

.. math::

\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.


References
++++++++++

.. [1] Brette R and Gerstner W (2005). Adaptive exponential
integrate-and-fire model as an effective description of neuronal
activity. Journal of Neurophysiology. 943637-3642
DOI: https://doi.org/10.1152/jn.00686.2005


See also
++++++++

iaf_psc_alpha, aeif_psc_exp
"""
model aeif_psc_alpha_neuron:

state:
V_m mV = E_L # Membrane potential
w pA = 0 pA # Spike-adaptation current
refr_t ms = 0 ms # Refractory period timer
is_refractory integer = 0
g_exc nS = 0 nS # AHP conductance
g_exc' nS/ms = 0 nS/ms # AHP conductance
g_inh nS = 0 nS # AHP conductance
g_inh' nS/ms = 0 nS/ms # AHP conductance

equations:
inline V_bounded mV = min(V_m, V_peak) # prevent exponential divergence

g_exc'' = -2 * g_exc' / tau_exc - g_exc / tau_exc**2
g_inh'' = -2 * g_inh' / tau_inh - g_inh / tau_inh**2

# Add inlines to simplify the equation definition of V_m
inline exp_arg real = (V_bounded - V_th) / Delta_T
inline I_spike pA = g_L * Delta_T * exp(exp_arg)
inline I_syn_exc pA = g_exc / nS * pA
inline I_syn_inh pA = g_exc / nS * pA

V_m' = is_refractory * (-g_L * (V_bounded - E_L) + I_spike + I_syn_exc - I_syn_inh - w + I_e + I_stim) / C_m
w' = (a * (V_bounded - E_L) - w) / tau_w

parameters:
# membrane parameters
C_m pF = 281.0 pF # Membrane Capacitance
refr_T ms = 2 ms # Duration of refractory period
V_reset mV = -60.0 mV # Reset Potential
g_L nS = 30.0 nS # Leak Conductance
E_L mV = -70.6 mV # Leak reversal Potential (aka resting potential)

# spike adaptation parameters
a nS = 4 nS # Subthreshold adaptation
b pA = 80.5 pA # Spike-triggered adaptation
Delta_T mV = 2.0 mV # Slope factor
tau_w ms = 144.0 ms # Adaptation time constant
V_th mV = -50.4 mV # Threshold Potential
V_peak mV = 0 mV # Spike detection threshold

# synaptic parameters
tau_exc ms = 0.2 ms # Synaptic Time Constant Excitatory Synapse
tau_inh ms = 2.0 ms # Synaptic Time Constant for Inhibitory Synapse

# constant external input current
I_e pA = 0 pA

input:
exc_spikes <- excitatory spike
inh_spikes <- inhibitory spike
I_stim pA <- continuous

output:
spike

update:
if is_refractory == 1:
# neuron is absolute refractory, do not evolve V_m
refr_t -= resolution()

# always evolve all ODEs; V_m
integrate_odes()

onCondition(V_m >= V_th):
# threshold crossing
refr_t = refr_T # start of the refractory period
is_refractory = 1
V_m = V_reset
w += b
emit_spike()

onCondition(is_refractory == 1 and refr_t <= resolution() / 2):
# end of refractory period
refr_t = 0 ms
is_refractory = 0