Page 1 of 1

Segmentation violation

Posted: Fri Mar 15, 2013 1:12 pm
by patoorio
Hi,

The following code is giving me a Segmentation violation. It doesn't occur inmediately, but after some simulation time. It can be 50000, 1e5, 2e5 ms and as you can see I'm trying to do a 5e5 ms run.
Before anybody asks, there are so many synaptic inputs because they will have different weights. I just trimmed the code to the minimal and still gives the fault. It happens in two 64bit Linux machines (Ubuntu 12.04 and Debian; in the first it was compiled and in the second it was installed from the .deb file). I haven't tried in a Windows machine yet.

Code: Select all

N_ex=800 //Excitatory inputs
N_in=200 //Inhibitory inputs

create soma
access soma
soma {L=20 diam=20}
insert hh

tstop = 500000
v_init= -65

objref AMPAinp[N_ex], AMPApre[N_ex], AMPAconn[N_ex]
objref GABAinp[N_in], GABApre[N_in], GABAconn[N_in]

for ii= 0,N_ex-1 {
	AMPAinp[ii] = new ExpSyn(0.5)
	AMPAinp[ii].tau = 1

	AMPApre[ii] = new NetStim(0.5)
	AMPApre[ii].interval = 1000  //interval 1 sec => rate 1Hz
	AMPApre[ii].start = 0
	AMPApre[ii].number = 1e6
	AMPApre[ii].noise = 1  //totally random (Poisson)

	AMPAconn[ii] = new NetCon(AMPApre[ii],AMPAinp[ii])
	AMPAconn[ii].weight = 0.0004
}

for ii= 0,N_in-1 {
	GABAinp[ii] = new Exp2Syn(0.5)
	GABAinp[ii].tau1 = 1
	GABAinp[ii].tau2 = 10
	GABAinp[ii].e = -70

	GABApre[ii] = new NetStim(0.5)
	GABApre[ii].interval = 1000  //interval 1 sec => rate 1Hz
	GABApre[ii].start = 0
	GABApre[ii].number = 1e6
	GABApre[ii].noise = 1  //totally random (Poisson)

	GABAconn[ii] = new NetCon(GABApre[ii],GABAinp[ii])
    GABAconn[ii].weight = 0.0005
}
Of course, after the code is loaded I open the Control Menu and hit Run, after a lot of time the error appears. I think I have been able to run it to the end like 2 or 3 times, the rest (many) it crashed before completion. The error is:

Code: Select all

oc>/usr/local/nrn/x86_64/bin/nrniv: Segmentation violation
 near line 10
 {run()}
        ^
        doNotify()
      screen_update()
    continuerun(500000)
  run()
Segmentation fault
and the program quits.

Re: Segmentation violation

Posted: Fri Mar 15, 2013 2:04 pm
by ted
First thing I tried was get rid of all synaptic mechanisms but 1 AMPAinp and 1 GABAinp, and direct all excitatory streams to the former and all inhibitory streams to the latter. Naturally the simulation ran much faster and completed without problems; this was with 32 bit CentOS 5.9 (RHEL 5.9 clone) with NEURON 7.3 (780:0e41c589de63) 2013-02-01 and had no problem. I need to try this a couple more times, but was eager to see what happened with the full model; so far no errors have been reported but I don't know that it hasn't just gotten stuck in a loop.

In the meantime, can you tell me what version of NEURON you are using?

Re: Segmentation violation

Posted: Fri Mar 15, 2013 6:33 pm
by ted
ted wrote:so far no errors have been reported but I don't know that it hasn't just gotten stuck in a loop.
Well, after 9587 seconds (part of that time the PC may also have been doing an incremental backup) a simulation that used your original code finished with no errors. The ratio
execution time/model time
stabilized at about 19 seconds of execution time/1 second of model time
after about 4-5 seconds of model time (probably because it took that long for the event queue to stabilize).

I'll try a couple more runs to see if problems appear, but I suspect they won't.

Re: Segmentation violation

Posted: Fri Mar 15, 2013 7:56 pm
by patoorio
hmmm...
in case you don't reproduce the error, can you give me any suggestion to debug it?

Thanks a lot for your answer

Re: Segmentation violation

Posted: Fri Mar 15, 2013 9:43 pm
by ted
Tried the full model a second time and it ran like a charm, finishing in ~9626 seconds (~2 hours 40 minutes), but I was using this machine for other tasks at the same time, which may have slowed it down a bit.

If you're using anything earlier than
NEURON 7.3 (780:0e41c589de63) 2013-02-01
I'd suggest getting the latest source code from the mercurial repository, compiling that, and seeing if that takes care of the problem.

Re: Segmentation violation

Posted: Mon Mar 18, 2013 1:28 pm
by patoorio
Hi,

I'm having problems compiling the latest mercurial repository version. While solivng it, I tried the 7.3-alpha-755 (which I could compile with no problems) and it also crashes. Is there a big difference between those version?

Regarding the compilation problem, it happens during make, with the follonwing error:

Code: Select all

Making all in modlunit
make[3]: se ingresa al directorio «/home/porio/neuron/nrn/src/modlunit»
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/nrnoc -I../../src/oc -I../../src/parallel -I../../src/nrnjava -I../../src/nrncvode -I../../src/ivos -I../../src/sundials -I../../src/nrnpython  -DNRNUNIT=1   -g -O2 -MT parse1.o -MD -MP -MF .deps/parse1.Tpo -c -o parse1.o parse1.c
parse1.y: En la función ‘yyparse’:
parse1.y:139:3: error: ‘yyps’ no se declaró aquí (primer uso en esta función)
parse1.y:139:3: nota: cada identificador sin declarar se reporta sólo una vez para cada función en el que aparece
parse1.y:139:3: error: ‘yypv’ no se declaró aquí (primer uso en esta función)
I'm so sorry it's in spanish; the critical lines I think can be translated as

Code: Select all

parse1.y:139:3: error: ‘yyps’ was not declared here (first use in this function)

parse1.y:139:3: error: ‘yypv’ was not declared here (first use in this function)
BTW, configure exists without problems.

And another question: when the segmentation violation occurs, it says that a 'core' file is generated. Where is it? It's not in the working directory. Would it be of any help?

Thank you!

Re: Segmentation violation

Posted: Tue Mar 19, 2013 8:24 am
by hines
Try the following with the 755 sources.
Add to your configure
CFLAGS='-g' CXXFLAGS='-g'
This will cause it to build with optimization turned off.
Now run to see if you still get the error. (skip this step if you want to save time)
Assuming your environment is setup up so you an launch nrniv from a terminal window, try

gdb nrniv
run args you normally use

when the program segfaults you can see the stack with the command
where

You can send me the output and we can take it from there (send to michael dot hines at yale dot edu)

Re: Segmentation violation

Posted: Tue Mar 19, 2013 8:27 am
by hines
I forgot to mention that since you are starting with nrniv you will need a - (dash) as the last arg to prevent
immediate exit.

Re: Segmentation violation

Posted: Tue Mar 19, 2013 10:48 am
by patoorio
hines wrote:Try the following with the 755 sources.
Add to your configure
CFLAGS='-g' CXXFLAGS='-g'
This will cause it to build with optimization turned off.
Do you mean to add it as a parameter of the ./configure command? Like in

Code: Select all

./configure --prefix=`pwd` --with-iv=/opt/iv-18 CFLAGS='-g' CXXFLAGS='-g'
?
(does it have to be without hyphen or like -CFLAGS... ?)

Re: Segmentation violation

Posted: Tue Mar 19, 2013 2:33 pm
by hines
Just as you wrote. No hyphens for CFLAGS and CXXFLAGS