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

Errors when using the brian2genn interface #545

Closed
Kwartke opened this issue Aug 24, 2015 · 3 comments
Closed

Errors when using the brian2genn interface #545

Kwartke opened this issue Aug 24, 2015 · 3 comments

Comments

@Kwartke
Copy link
Contributor

Kwartke commented Aug 24, 2015

When running the attached code (adapted from tests/features/speed.py) using the brian2genn interface, the compilation fails.
Recent and clean versions of brian2 (master branch), brian2genn (develop branch) and genn (master branch) from the respective git repositories were used.
When running the attached examples (HHNeuronsOnly and CUBAFixedConnectivity): the following compiler errors show up (the compiler errors are the same for both examples but differ when using different cuda versions):

on a GTX Titan Black (CUDA 6.5):

magicnetwork_model.cc: error: ‘struct neuronModel’ has no member named ‘supportCode’
   n.supportCode= tS("\n\
     ^

on a GTX 580 (CUDA 7.0):

  File "p.py", line 36, in <module>
    group.v = El
...
File "/home/wartke/brian2genn/brian2genn/device.py", line 150, in code_object_class
    raise ValueError("Cannot specify codeobj_class for GeNN device.")
ValueError: Cannot specify codeobj_class for GeNN device.

Our aim is to run all examples from tests/features/speed.py using brian2genn. However, errors similar as those above show up for the other examples as well.

Kind regards, Konrad Wartke & Moritz Augustin


attached example no. 1:


from brian2 import *
import brian2genn

set_device("genn")
num_neurons = 10
# Parameters
area = 20000 * umetre**2
Cm = 1 * ufarad * cm**-2 * area
gl = 5e-5 * siemens * cm**-2 * area
El = -65 * mV
EK = -90 * mV
ENa = 50 * mV
g_na = 100 * msiemens * cm**-2 * area
g_kd = 30 * msiemens * cm**-2 * area
VT = -63 * mV
        # The model
eqs = Equations('''
        dv/dt = (gl*(El-v) - g_na*(m*m*m)*h*(v-ENa) - g_kd*(n*n*n*n)*(v-EK) + I)/Cm : volt
        dm/dt = 0.32*(mV**-1)*(13.*mV-v+VT)/
            (exp((13.*mV-v+VT)/(4.*mV))-1.)/ms*(1-m)-0.28*(mV**-1)*(v-VT-40.*mV)/
            (exp((v-VT-40.*mV)/(5.*mV))-1.)/ms*m : 1
        dn/dt = 0.032*(mV**-1)*(15.*mV-v+VT)/
            (exp((15.*mV-v+VT)/(5.*mV))-1.)/ms*(1.-n)-.5*exp((10.*mV-v+VT)/(40.*mV))/ms*n : 1
        dh/dt = 0.128*exp((17.*mV-v+VT)/(18.*mV))/ms*(1.-h)-4./(1+exp((40.*mV-v+VT)/(5.*mV)))/ms*h : 1
        I : amp
        ''')
        # Threshold and refractoriness are only used for spike counting
group = NeuronGroup(num_neurons, eqs,
                            threshold='v > -40*mV',
                            refractory='v > -40*mV')
group.v = El
group.I = '0.7*nA * i / num_neurons'
run(1*second)
device.build(directory="genn", compile=True, run=True)

attached example no. 2:


from brian2 import *
import brian2genn

set_device("genn")
N = 10
Ne = int(.8 * N)
taum = 20 * ms
taue = 5 * ms
taui = 10 * ms
Vt = -50 * mV
Vr = -60 * mV
El = -49 * mV
eqs = '''
        dv/dt  = (ge+gi-(v-El))/taum : volt (unless refractory)
        dge/dt = -ge/taue : volt (unless refractory)
        dgi/dt = -gi/taui : volt (unless refractory)
        '''
P = NeuronGroup(
            N, eqs, threshold='v>Vt', reset='v = Vr', refractory=5 * ms)
P.v = 'Vr + rand() * (Vt - Vr)'
P.ge = 0 * mV
P.gi = 0 * mV
we = (60 * 0.27 / 10) * mV  # excitatory synaptic weight (voltage)
wi = (-20 * 4.5 / 10) * mV  # inhibitory synaptic weight
Ce = Synapses(P, P, pre='ge += we')
Ci = Synapses(P, P, pre='gi += wi')
Ce.connect('i<Ne', p=80. / N)
Ci.connect('i>=Ne', p=80. / N)
s_mon = SpikeMonitor(P)
run(1*second)
device.build(directory="genn2", compile=True, run=True)
@Kwartke
Copy link
Contributor Author

Kwartke commented Aug 24, 2015

First we missed the right repository for this issue (apologize). Maybe one could move this issue to brian-team/brian2genn as it fits better there...

Additionally we forgot to mention, that due to issue #19 of brian2genn we removed ('mod', 'fmod') in the function name translation of brian2genn/genn_generator.py to allow code generation.

To complete the initial issue report: the first error we describe above shows up when -- after the brian device.build call fails -- we manually execute "cd genn ; buildmodel.sh magicnetwork_model". This command yields then the full error:

[wartke@asterope genn]$ buildmodel.sh magicnetwork_model
model path: /home/wartke/genn
model name: magicnetwork_model
rm -rf obj bin/generateALL
mkdir -p obj
g++ -DNVCC="/opt/cuda/bin/nvcc" -include /home/wartke/genn/magicnetwork_model.cc -I/opt/cuda/include -I/home/wartke/genn-git/lib/include -I/home/wartke/genn-git/userproject/include src/generateALL.cc -o obj/generateALL.o -c
In file included from :0:0:
/home/wartke/genn/magicnetwork_model.cc: In function ‘void modelDefinition(NNmodel&)’:
/home/wartke/genn/magicnetwork_model.cc:55:3: error: ‘GENN_PREFERENCES’ has not been declared
GENN_PREFERENCES::autoRefractory= 0;
^
/home/wartke/genn/magicnetwork_model.cc:105:5: error: ‘struct neuronModel’ has no member named ‘supportCode’
n.supportCode= tS("\n
^
GNUmakefile:51: recipe for target 'obj/generateALL.o' failed
make: *** [obj/generateALL.o] Error 1
/home/wartke/genn-git/lib/bin/buildmodel.sh: line 26: bin/generateALL: No such file or directory
Model build complete ...

@mstimberg
Copy link
Member

Hi, brian2genn development is synchronized with genn development, so you'll also need the develop branch for genn itself. But it seems that in addition there is something missing in the current state of the brian2genn repository, maybe Thomas did not push something. I'll move the issue over to the brian2genn repository, then Thomas can comment (but in general note that brian2genn is under heavy development, so it's expected that it breaks from time to time).

@mstimberg
Copy link
Member

This issue was moved to brian-team/brian2genn#21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants