issues on equivalence of implementations of conductances decay

31 views
Skip to first unread message

Hossan Cheng

unread,
Dec 6, 2017, 5:53:51 AM12/6/17
to ANNarchy
Hi Julien, 

I noticed that the conductances decay in ANNarchy is implemented in neuron class. However, for example, the NMDA synapse and its decay are defined in the synapse class. So I am wondering if these two implementations are equivalent to each other? May I define the instantaneous conductance decay in synapse too?

Huzi

Julien Vitay

unread,
Dec 6, 2017, 7:34:19 AM12/6/17
to ANNarchy
Hi Huzi,

you mean the NMDA synapse here: http://annarchy.readthedocs.io/en/stable/manual/SpikeSynapse.html#continuous-synaptic-transmission ? There are many possible models of a NMDA synapse.

When the conductance decay is defined at the (post) neuron level, the conductance ge follows this equation:

    tau *dge/dt + ge = \sum_{all incoming spikes} w * dirac(t_spike)

i.e. all incoming spikes increment the conductance (dirac function of the spike time), but the decay is proportional to the global conductance.

If all synapses maintain a "trace" ge_i of their spiking activity:

    tau * dge_i/dt + ge_i = dirac(t_spike_i)

and the post-synaptic continuously integrates these traces:

    ge = sum_i ge_i

the two resulting conductances are mathematically equivalent (as far as I know), as we have linear first-order ODEs. At least as long as the different synapses do have the same time constant.

Here is a script that "shows" that the two deliver the same results:

from ANNarchy import *

inp
= SpikeSourceArray([[10, 20]])

neuron1
= Neuron(
    parameters
= "tau =20.0",
    equations
="tau*dv/dt + v = g_exc; tau*dg_exc/dt + g_exc = 0",
    spike
="v>1",
    reset
="v=0"
)
pop1
= Population(1, neuron1)
proj1
= Projection(inp, pop1, 'exc').connect_all_to_all(0.5)
m1
= Monitor(pop1, ['spike', 'v', 'g_exc'])


neuron2
= Neuron(
    parameters
= "tau =20.0",
    equations
="tau*dv/dt + v = g_exc",
    spike
="v>1",
    reset
="v=0"
)
synapse
= Synapse(
    parameters
= "tau =20.0",
    equations
="tau*dg/dt + g = 0",
    pre_spike
="g+=w",
    psp
="g"
)
pop2
= Population(1, neuron2)
proj2
= Projection(inp, pop2, 'exc', synapse).connect_all_to_all(0.5)
m2
= Monitor(pop2, ['spike', 'v', 'g_exc'])


compile
()

simulate
(50)

data1
= m1.get()
data2
= m2.get()

import matplotlib.pyplot as plt
plt
.subplot(121)
plt
.plot(data1['g_exc'][:, 0])
plt
.plot(data1['v'][:, 0])
plt
.subplot(122)
plt
.plot(data2['g_exc'][:, 0])
plt
.plot(data2['v'][:, 0])
plt
.show()

BUT the computational time is not equivalent: in the second version, all synapses update their variable g at each time step, while in the first version it is only when they spike. The second version is orders of magnitude slower than the first one.

Hope it helps!

Best
Julien

Hossan Cheng

unread,
Dec 7, 2017, 8:56:58 AM12/7/17
to ANNarchy
Thank you, Julien! Your answer helped me a lot! It seems the server will consume more time when the decay was defined in the synapses.

I still have another question about the installation of ANNarchy yesterday. I could install it on my Macbookpro without error. But when I try to install it on a computation server, errors occurred.

My server:
OS: Ubuntu 16.04
nvcc version: 8.0
All prerequisites satisfied including python packages.
Python version: 2.7.13 (Anaconda 4.4.0)

LD_LIBRARY_PATH: /usr/local/cuda-8.0/lib64:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64

Installing with pip shows no error during installation, but when import ANNarchy, it shows

/home/huzi/anaconda2/lib/python2.7/site-packages/ANNarchy/core/cython_ext/Connector.so: undefined symbol: _ZTINSt8ios_base7failureB5cxx11E
/home/huzi/anaconda2/lib/python2.7/site-packages/ANNarchy/core/cython_ext/Connector.so: undefined symbol: _ZTINSt8ios_base7failureB5cxx11E
Error: Could not import Cython modules. Try reinstalling ANNarchy.
ANNarchy 4.6 (4.6.4.1) on linux2 (posix).



When build from source code, it shows 

nvcc -c cuda_check.cu -Xcompiler -fPIC -o cuda_check_cu.o
nvcc warning
: The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
cython
--cplus cuda_check.pyx
g
++ cuda_check.cpp -fPIC -shared -g -I. `/home/huzi/anaconda2/bin/python-config --includes` cuda_check_cu.o -lcudart -o cuda_check.so -L/home/huzi/anaconda2/lib -L/usr/local/cuda-8.0/lib64 -L/usr/local/cuda-8.0/lib
no previously-included directories found matching 'docs/_build'

Do you know the reason for why these errors occurred? Are they related to my CUDA installation?

Julien Vitay

unread,
Dec 7, 2017, 9:06:14 AM12/7/17
to ANNarchy
Cool that it helped!

For the first error, can you try:

conda install libgcc

It is a problem that often happens with anaconda. For the second case (from source), there is no error, just normal warnings. What happens when you run the code?

Hossan Cheng

unread,
Dec 8, 2017, 1:36:55 AM12/8/17
to ANNarchy
When installing from source code then import it in python, it will output "no Connector".





Julien Vitay於 2017年12月7日星期四 UTC+8下午10時06分14秒寫道:

Julien Vitay

unread,
Dec 8, 2017, 7:00:12 AM12/8/17
to ANNarchy
ANNarchy depends on some Cython modules which have to be compiled and installed when you run setup.py. The "no Connector" message appears mostly when the .so libraries corresponding to these modules are not found.

I guess something went wrong during the installation. I would suggest to:

1. completely remove all installed versions of ANNarchy (in /home/huzi/anaconda2/lib/python2.7/site-packages, but potentially also in /home/huzi/.local/lib/python2.7/ if you made it outside of anaconda once.
2. Reinstall ANNarchy from source with 

python setup.py install

and send me the output. There should be messages like "Cythonizing Connector.pyx", otherwise that means the modules are not compiled.

Hossan Cheng

unread,
Dec 9, 2017, 11:33:00 AM12/9/17
to ANNarchy
After installed libgcc with conda, ANNarchy( with pip) could work now.

Besides, I tested installation with source code, and below is the output of python setup.py install:

annarchy-annarchy-8f29a8f8acee|⇒ python setup.py install
No module named Connector
No module named Connector

Error: Could not import Cython modules. Try reinstalling ANNarchy.
ANNarchy 4.6 (4.6.4.1) on linux2 (posix).
Checking for setuptools... OK
Checking for numpy... OK
Checking for cython... OK
nvcc
: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
Checking for CUDA... OK
Configuring CUDA...
rm
-f cuda_check_cu.o
rm
-f cuda_check.cpp
rm
-f cuda_check.so
nvcc
-c cuda_check.cu -Xcompiler -fPIC -o cuda_check_cu.o
nvcc warning
: The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

cython
--cplus cuda_check.pyx
g
++ cuda_check.cpp -fPIC -shared -g -I. `/home/huzi/anaconda2/bin/python-config --includes` cuda_check_cu.o -lcudart -o cuda_check.so -L/home/huzi/anaconda2/lib -L/usr/local/cuda-8.0/lib64 -L/usr/local/cuda-8.0/lib
no previously-included directories found matching 'docs/_build'


Julien Vitay於 2017年12月8日星期五 UTC+8下午8時00分12秒寫道:
Reply all
Reply to author
Forward
0 new messages