Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions pyNN/neuron/nmodl/gif.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ VERBATIM
#include<stdio.h>
#include<math.h>

#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 {
Expand Down Expand Up @@ -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{
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion pyNN/neuron/nmodl/netstim2.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) {
Expand Down
9 changes: 7 additions & 2 deletions pyNN/neuron/nmodl/quantal_stp.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down
9 changes: 7 additions & 2 deletions pyNN/neuron/nmodl/stochastic_synapse.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ VERBATIM
#include<stdio.h>
#include<math.h>

#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

Expand Down Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions pyNN/neuron/nmodl/stochastic_tsodyksmarkram.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyNN/neuron/nmodl/tsodyksmarkram.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Andrew Davison, UNIC, CNRS, 2013
ENDCOMMENT

NEURON {
THREADSAFE
Copy link
Author

Choose a reason for hiding this comment

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

POINT_PROCESS TsodyksMarkramWA
RANGE tau_rec, tau_facil, U, u0, tau_syn
POINTER wsyn
Expand Down
30 changes: 6 additions & 24 deletions pyNN/neuron/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import warnings

import numpy as np
import neuron
from neuron import h, nrn_dll_loaded

from .. import common
Expand Down Expand Up @@ -76,30 +77,11 @@ def load_mechanisms(path):
which the directory 'i686' (or 'x86_64' or 'powerpc' depending on your
platform) was created.
"""
import platform

if path in nrn_dll_loaded:
logger.warning("Mechanisms already loaded from path: %s" % path)
return
# in case NEURON is assuming a different architecture to Python,
# we try multiple possibilities
if platform.system() == 'Windows':
lib_path = os.path.join(path, 'nrnmech.dll')
if os.path.exists(lib_path):
h.nrn_load_dll(lib_path)
nrn_dll_loaded.append(path)
return
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
raise IOError(
f"NEURON mechanisms not found in {path}. "
"You may need to run 'nrnivmodl' in this directory.")
result = neuron.load_mechanisms(path)
if not result:
raise IOError(
f"NEURON mechanisms not found in {path}. "
"You may need to run 'nrnivmodl' in this directory.")


def is_point_process(obj):
Expand Down