Skip to content

Commit 8699516

Browse files
committed
1 parent 5a53a51 commit 8699516

7 files changed

Lines changed: 42 additions & 14 deletions

File tree

pyNN/neuron/nmodl/gif.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ VERBATIM
5555
#include<stdio.h>
5656
#include<math.h>
5757

58+
#ifndef NRN_VERSION_GTEQ_8_2_0
5859
double nrn_random_pick(void* r);
5960
void* nrn_random_arg(int argpos);
61+
#define RANDCAST
62+
#else
63+
#define RANDCAST (Rand*)
64+
#endif
6065
ENDVERBATIM
6166

6267
ASSIGNED {
@@ -199,7 +204,7 @@ VERBATIM
199204
: each instance. However, the corresponding hoc Random
200205
: distribution MUST be set to Random.negexp(1)
201206
*/
202-
value = nrn_random_pick(_p_rng);
207+
value = nrn_random_pick(RANDCAST _p_rng);
203208
//printf("random stream for this simulation = %lf\n",value);
204209
return value;
205210
}else{
@@ -208,7 +213,7 @@ ENDVERBATIM
208213
: independent of nhost or which host this instance is on
209214
: is desired, since each instance on this cpu draws from
210215
: the same stream
211-
value = scop_random(1)
216+
value = scop_random()
212217
VERBATIM
213218
}
214219
ENDVERBATIM

pyNN/neuron/nmodl/netstim2.mod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ FUNCTION invl(mean (ms)) (ms) {
7272
}
7373
}
7474
VERBATIM
75+
#ifndef NRN_VERSION_GTEQ_8_2_0
7576
double nrn_random_pick(void* r);
7677
void* nrn_random_arg(int argpos);
78+
#define RANDCAST
79+
#else
80+
#define RANDCAST (Rand*)
81+
#endif
7782
ENDVERBATIM
7883

7984
FUNCTION erand() {
@@ -84,7 +89,7 @@ VERBATIM
8489
: each instance. However, the corresponding hoc Random
8590
: distribution MUST be set to Random.negexp(1)
8691
*/
87-
_lerand = nrn_random_pick(_p_donotuse);
92+
_lerand = nrn_random_pick(RANDCAST _p_donotuse);
8893
}else{
8994
/* only can be used in main thread */
9095
if (_nt != nrn_threads) {

pyNN/neuron/nmodl/quantal_stp.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ NET_RECEIVE(w, available, t_last (ms)) {
8282
}
8383

8484
VERBATIM
85+
#ifndef NRN_VERSION_GTEQ_8_2_0
8586
double nrn_random_pick(void* r);
8687
void* nrn_random_arg(int argpos);
88+
#define RANDCAST
89+
#else
90+
#define RANDCAST (Rand*)
91+
#endif
8792
ENDVERBATIM
8893

8994
PROCEDURE setRNG() {
@@ -110,12 +115,12 @@ VERBATIM
110115
: each instance. However, the corresponding hoc Random
111116
: distribution MUST be set to Random.negexp(1)
112117
*/
113-
value = nrn_random_pick(_p_rng);
118+
value = nrn_random_pick(RANDCAST _p_rng);
114119
//printf("random stream for this simulation = %lf\n",value);
115120
return value;
116121
} else {
117122
ENDVERBATIM
118-
value = scop_random(1)
123+
value = scop_random()
119124
VERBATIM
120125
}
121126
ENDVERBATIM

pyNN/neuron/nmodl/stochastic_synapse.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ VERBATIM
2121
#include<stdio.h>
2222
#include<math.h>
2323

24+
#ifndef NRN_VERSION_GTEQ_8_2_0
2425
double nrn_random_pick(void* r);
2526
void* nrn_random_arg(int argpos);
27+
#define RANDCAST
28+
#else
29+
#define RANDCAST (Rand*)
30+
#endif
2631

2732
ENDVERBATIM
2833

@@ -63,12 +68,12 @@ VERBATIM
6368
: each instance. However, the corresponding hoc Random
6469
: distribution MUST be set to Random.negexp(1)
6570
*/
66-
value = nrn_random_pick(_p_rng);
71+
value = nrn_random_pick(RANDCAST _p_rng);
6772
//printf("random stream for this simulation = %lf\n",value);
6873
return value;
6974
} else {
7075
ENDVERBATIM
71-
value = scop_random(1)
76+
value = scop_random()
7277
VERBATIM
7378
}
7479
ENDVERBATIM

pyNN/neuron/nmodl/stochastic_tsodyksmarkram.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ NET_RECEIVE(w, p_surv, t_surv) {
8585
}
8686

8787
VERBATIM
88+
#ifndef NRN_VERSION_GTEQ_8_2_0
8889
double nrn_random_pick(void* r);
8990
void* nrn_random_arg(int argpos);
91+
#define RANDCAST
92+
#else
93+
#define RANDCAST (Rand*)
94+
#endif
9095
ENDVERBATIM
9196

9297
PROCEDURE setRNG() {
@@ -113,12 +118,12 @@ VERBATIM
113118
: each instance. However, the corresponding hoc Random
114119
: distribution MUST be set to Random.negexp(1)
115120
*/
116-
value = nrn_random_pick(_p_rng);
121+
value = nrn_random_pick(RANDCAST _p_rng);
117122
//printf("random stream for this simulation = %lf\n",value);
118123
return value;
119124
} else {
120125
ENDVERBATIM
121-
value = scop_random(1)
126+
value = scop_random()
122127
VERBATIM
123128
}
124129
ENDVERBATIM

pyNN/neuron/nmodl/tsodyksmarkram.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Andrew Davison, UNIC, CNRS, 2013
55
ENDCOMMENT
66

77
NEURON {
8+
THREADSAFE
89
POINT_PROCESS TsodyksMarkramWA
910
RANGE tau_rec, tau_facil, U, u0, tau_syn
1011
POINTER wsyn

pyNN/neuron/simulator.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ def load_mechanisms(path):
9292
else:
9393
arch_list = [platform.machine(), 'i686', 'x86_64', 'powerpc', 'umac']
9494
for arch in arch_list:
95-
lib_path = os.path.join(path, arch, '.libs', 'libnrnmech.so')
96-
if os.path.exists(lib_path):
97-
h.nrn_load_dll(lib_path)
98-
nrn_dll_loaded.append(path)
99-
return
95+
path_list = ['.so', '.dylib']
96+
for p in path_list:
97+
lib_path = os.path.join(path, arch, f'libnrnmech{p}')
98+
if os.path.exists(lib_path):
99+
h.nrn_load_dll(lib_path)
100+
nrn_dll_loaded.append(path)
101+
return
100102
raise IOError(
101103
f"NEURON mechanisms not found in {path}. "
102104
"You may need to run 'nrnivmodl' in this directory.")

0 commit comments

Comments
 (0)