Segmentation fault on AMD

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
eugenio
Posts: 2
Joined: Mon Oct 25, 2010 10:38 am

Segmentation fault on AMD

Post by eugenio »

Hi everybody,

I have a strange architecture-specific problem with NetCons connecting cells inside objects.
Consider the following code:

Code: Select all

from neuron import h

class Dummy(object):
    pass

a = Dummy()

a.source = h.NetStim(0.5)
a.target = h.NetStim(0.5)

a.nc = h.NetCon(a.source, a.target)

h.load_file("stdrun.hoc")
h.run()
The problem is not that I can't run it, but that when I run it on an AMD Opteron processor (64bit) the interpreter doesn't exit cleanly and gives me a segmentation fault (but I've tested it on 32- and 64-bit Intels and they do just fine). In other words, if during an interactive session I type the above commands I don't get any error until I type Ctrl-D to exit. Then I get

Code: Select all

python
Python 2.6.5 (r265:79063, May 28 2010, 10:39:40) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from neuron import h
MPI_Initialized==false, disabling MPI functionality.
NEURON -- VERSION 7.2  (?:?) 1999-12-31
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html

>>> 
>>> class Dummy(object):
...     pass
... 
>>> a = Dummy()
>>> 
>>> a.source = h.NetStim(0.5)
>>> a.target = h.NetStim(0.5)
>>> 
>>> a.nc = h.NetCon(a.source, a.target)
>>> 
>>> h.load_file("stdrun.hoc")
1.0
>>> h.run()
0.0
>>> exit()
Segmentation fault
Obviously, this happens also if I use this kind of code inside a function: I get a segfault on function exit.
NEURON mercurial revision number is 475.
Any ideas? Thank you for your help!
hines
Site Admin
Posts: 1711
Joined: Wed May 18, 2005 3:32 pm

Re: Segmentation fault on AMD

Post by hines »

I'm not experiencing that problem on my x86_64 Intel(R) Xeon(TM). I'm guessing there is a cleanup problem during exit where the NetStim are deleted prior to the NetCon. See if the problem goes away if you do
del a.nc
or
a.nc = None
prior to exit.

I thought I had fixed this a few months ago but can't find a changeset log message that refers to it directly. Perhaps
http://www.neuron.yale.edu/hg/neuron/nr ... bf61c95d17
Unfortunately I can't diagnose further without a segmentation violation myself so I can see what is being accessed that was previously destroyed.
eugenio
Posts: 2
Joined: Mon Oct 25, 2010 10:38 am

Re: Segmentation fault on AMD

Post by eugenio »

I confirm that doing

Code: Select all

del a.nc
or

Code: Select all

a.nc = None
prior to exit works around the issue. Thanks.
I'll see if I can use this method to run the simulations I need for my current work, but please let me know if there's anything I could do to help you better diagnose the problem.
Post Reply