From 86995162927f84256a020d44ee51089ee9991509 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Wed, 28 Jan 2026 17:48:14 +0100 Subject: [PATCH 1/2] Apply patch provided by Goran Jelic-Cizmek for compatibility with NEURON 9 https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/ebrains-spack-builds/-/blob/master/packages/py-pynn/pynn-0.12.3-neuron-9.0.0.patch?ref_type=heads --- pyNN/neuron/nmodl/gif.mod | 9 +++++++-- pyNN/neuron/nmodl/netstim2.mod | 7 ++++++- pyNN/neuron/nmodl/quantal_stp.mod | 9 +++++++-- pyNN/neuron/nmodl/stochastic_synapse.mod | 9 +++++++-- pyNN/neuron/nmodl/stochastic_tsodyksmarkram.mod | 9 +++++++-- pyNN/neuron/nmodl/tsodyksmarkram.mod | 1 + pyNN/neuron/simulator.py | 12 +++++++----- 7 files changed, 42 insertions(+), 14 deletions(-) diff --git a/pyNN/neuron/nmodl/gif.mod b/pyNN/neuron/nmodl/gif.mod index 7829fcd34..b14599b5d 100644 --- a/pyNN/neuron/nmodl/gif.mod +++ b/pyNN/neuron/nmodl/gif.mod @@ -55,8 +55,13 @@ VERBATIM #include #include +#ifndef NRN_VERSION_GTEQ_8_2_0 double nrn_random_pick(void* r); void* nrn_random_arg(int argpos); +#define RANDCAST +#else +#define RANDCAST (Rand*) +#endif ENDVERBATIM ASSIGNED { @@ -199,7 +204,7 @@ VERBATIM : each instance. However, the corresponding hoc Random : distribution MUST be set to Random.negexp(1) */ - value = nrn_random_pick(_p_rng); + value = nrn_random_pick(RANDCAST _p_rng); //printf("random stream for this simulation = %lf\n",value); return value; }else{ @@ -208,7 +213,7 @@ ENDVERBATIM : independent of nhost or which host this instance is on : is desired, since each instance on this cpu draws from : the same stream - value = scop_random(1) + value = scop_random() VERBATIM } ENDVERBATIM diff --git a/pyNN/neuron/nmodl/netstim2.mod b/pyNN/neuron/nmodl/netstim2.mod index c612422ef..eb60a82ca 100755 --- a/pyNN/neuron/nmodl/netstim2.mod +++ b/pyNN/neuron/nmodl/netstim2.mod @@ -72,8 +72,13 @@ FUNCTION invl(mean (ms)) (ms) { } } VERBATIM +#ifndef NRN_VERSION_GTEQ_8_2_0 double nrn_random_pick(void* r); void* nrn_random_arg(int argpos); +#define RANDCAST +#else +#define RANDCAST (Rand*) +#endif ENDVERBATIM FUNCTION erand() { @@ -84,7 +89,7 @@ VERBATIM : each instance. However, the corresponding hoc Random : distribution MUST be set to Random.negexp(1) */ - _lerand = nrn_random_pick(_p_donotuse); + _lerand = nrn_random_pick(RANDCAST _p_donotuse); }else{ /* only can be used in main thread */ if (_nt != nrn_threads) { diff --git a/pyNN/neuron/nmodl/quantal_stp.mod b/pyNN/neuron/nmodl/quantal_stp.mod index 6d9765016..f7ed37c9e 100644 --- a/pyNN/neuron/nmodl/quantal_stp.mod +++ b/pyNN/neuron/nmodl/quantal_stp.mod @@ -82,8 +82,13 @@ NET_RECEIVE(w, available, t_last (ms)) { } VERBATIM +#ifndef NRN_VERSION_GTEQ_8_2_0 double nrn_random_pick(void* r); void* nrn_random_arg(int argpos); +#define RANDCAST +#else +#define RANDCAST (Rand*) +#endif ENDVERBATIM PROCEDURE setRNG() { @@ -110,12 +115,12 @@ VERBATIM : each instance. However, the corresponding hoc Random : distribution MUST be set to Random.negexp(1) */ - value = nrn_random_pick(_p_rng); + value = nrn_random_pick(RANDCAST _p_rng); //printf("random stream for this simulation = %lf\n",value); return value; } else { ENDVERBATIM - value = scop_random(1) + value = scop_random() VERBATIM } ENDVERBATIM diff --git a/pyNN/neuron/nmodl/stochastic_synapse.mod b/pyNN/neuron/nmodl/stochastic_synapse.mod index 87da7bada..8a8906c19 100644 --- a/pyNN/neuron/nmodl/stochastic_synapse.mod +++ b/pyNN/neuron/nmodl/stochastic_synapse.mod @@ -21,8 +21,13 @@ VERBATIM #include #include +#ifndef NRN_VERSION_GTEQ_8_2_0 double nrn_random_pick(void* r); void* nrn_random_arg(int argpos); +#define RANDCAST +#else +#define RANDCAST (Rand*) +#endif ENDVERBATIM @@ -63,12 +68,12 @@ VERBATIM : each instance. However, the corresponding hoc Random : distribution MUST be set to Random.negexp(1) */ - value = nrn_random_pick(_p_rng); + value = nrn_random_pick(RANDCAST _p_rng); //printf("random stream for this simulation = %lf\n",value); return value; } else { ENDVERBATIM - value = scop_random(1) + value = scop_random() VERBATIM } ENDVERBATIM diff --git a/pyNN/neuron/nmodl/stochastic_tsodyksmarkram.mod b/pyNN/neuron/nmodl/stochastic_tsodyksmarkram.mod index 519e578ca..5e2fc104e 100644 --- a/pyNN/neuron/nmodl/stochastic_tsodyksmarkram.mod +++ b/pyNN/neuron/nmodl/stochastic_tsodyksmarkram.mod @@ -85,8 +85,13 @@ NET_RECEIVE(w, p_surv, t_surv) { } VERBATIM +#ifndef NRN_VERSION_GTEQ_8_2_0 double nrn_random_pick(void* r); void* nrn_random_arg(int argpos); +#define RANDCAST +#else +#define RANDCAST (Rand*) +#endif ENDVERBATIM PROCEDURE setRNG() { @@ -113,12 +118,12 @@ VERBATIM : each instance. However, the corresponding hoc Random : distribution MUST be set to Random.negexp(1) */ - value = nrn_random_pick(_p_rng); + value = nrn_random_pick(RANDCAST _p_rng); //printf("random stream for this simulation = %lf\n",value); return value; } else { ENDVERBATIM - value = scop_random(1) + value = scop_random() VERBATIM } ENDVERBATIM diff --git a/pyNN/neuron/nmodl/tsodyksmarkram.mod b/pyNN/neuron/nmodl/tsodyksmarkram.mod index c4580fe3e..569e014aa 100644 --- a/pyNN/neuron/nmodl/tsodyksmarkram.mod +++ b/pyNN/neuron/nmodl/tsodyksmarkram.mod @@ -5,6 +5,7 @@ Andrew Davison, UNIC, CNRS, 2013 ENDCOMMENT NEURON { + THREADSAFE POINT_PROCESS TsodyksMarkramWA RANGE tau_rec, tau_facil, U, u0, tau_syn POINTER wsyn diff --git a/pyNN/neuron/simulator.py b/pyNN/neuron/simulator.py index f95c33391..d57c8971e 100644 --- a/pyNN/neuron/simulator.py +++ b/pyNN/neuron/simulator.py @@ -92,11 +92,13 @@ def load_mechanisms(path): else: arch_list = [platform.machine(), 'i686', 'x86_64', 'powerpc', 'umac'] for arch in arch_list: - lib_path = os.path.join(path, arch, '.libs', 'libnrnmech.so') - if os.path.exists(lib_path): - h.nrn_load_dll(lib_path) - nrn_dll_loaded.append(path) - return + path_list = ['.so', '.dylib'] + for p in path_list: + lib_path = os.path.join(path, arch, f'libnrnmech{p}') + if os.path.exists(lib_path): + h.nrn_load_dll(lib_path) + nrn_dll_loaded.append(path) + return raise IOError( f"NEURON mechanisms not found in {path}. " "You may need to run 'nrnivmodl' in this directory.") From 756493977c370ad82b38dc77c4b7d3aa318250b0 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Wed, 28 Jan 2026 21:00:39 +0100 Subject: [PATCH 2/2] Fix the NEST 3.8 build in CI (see https://github.com/nest/nest-simulator/issues/3495) --- .github/workflows/full-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/full-test.yml b/.github/workflows/full-test.yml index f62789e0c..349ac922c 100644 --- a/.github/workflows/full-test.yml +++ b/.github/workflows/full-test.yml @@ -44,7 +44,7 @@ jobs: - name: Install NEST if: startsWith(matrix.os, 'ubuntu') run: | - python -m pip install cython + python -m pip install "cython<3.1.0" wget https://github.com/nest/nest-simulator/archive/refs/tags/v3.8.tar.gz -O nest-simulator-3.8.tar.gz tar xzf nest-simulator-3.8.tar.gz cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -Dwith-mpi=ON ./nest-simulator-3.8