Neuron 7 returns Segmentation violation

The basics of how to develop, test, and use models.
Post Reply
phendric

Neuron 7 returns Segmentation violation

Post by phendric »

Hi,

At the beginning of 2007, I did some work with Poirazi's CA1 pyramidal neuron model (ModelDB accession #20212) using what was then the most current version of NEURON on Windows XP. Now, more than 2 years later, I'm returning to her model to do some different work, but this time I'm running NEURON 7.0 on Ubuntu x64 (compiled from source). However, when trying to run some of her experiments as a sanity check that everything's working properly, I get a Segmentation violation that stops the .hoc scripts from running.

Here's the error that comes up:
phendric@phendricUbuntu:cd CA1_multi/experiment/single-shock
phendric@phendricUbuntu:nrngui Apical_Tips.hoc
NEURON -- Release 7.0 (281:80827e3cd201) 2009-01-16
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html

1
1
1
1
1
1
1
1
object ExperimentControl created.

1
0
0
1
0
1
0
/home/phendric/neuron/nrn/x86_64/bin/nrniv: syntax error
in ../../morphology/n123/cell-analysis.hoc near line 12
forall insert d3 // mod file to enable 3-D mapping of each point along the cell
^
xopen("../../morphology/n123/cell-analysis.hoc")
ExperimentControl[0].execute1("xopen("../../morphology/n123/cell-analysis.hoc")")
ExperimentControl[0].xopen_geometry_dependent("cell-analysis")
0
/home/phendric/neuron/nrn/x86_64/bin/nrniv: Segmentation violation
in ../../morphology/n123/cell-analysis.hoc near line 14
$o1.defvar("Distance Calculation", "adjustment", "41.1", "This adjustment factor is supplied to the vector distance function so that distance calculations are measured at the cell body.")
The same error comes up when trying to run any of the experiments in the CA1_multi/experiment/ directories.

Am I doing something wrong, or has something changed between NEURON ~5.9 and 7.0 to introduce that error?

Thanks,
Phillip
ted
Site Admin
Posts: 6358
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Neuron 7 returns Segmentation violation

Post by ted »

Am I doing something wrong
That appears to be the case.

Depending on one's viewpoint, this particular implementation is an example of elegant and sophisticated programming, or a serious violation of the KISS principle.

Read CA1_multi/readme.txt to find the following:
Within each experiment directory, the *.hoc files contain the code to be executed and the respective run* files are the executables.
The user need to turn these files into executables by using the command:

chmod +x run_Afreq
Nuts to that. Here's what's in CA1_multi/experiment/single-shock/run_Trunk_A--

Code: Select all

../../mechanism/i686/special  Apical_Tips.hoc -
Which is to be expected, since all of the mod files for the custom mechanisms that these hoc files use are in CA1_multi/mechanism, and that's also the location of the i686 directory that contains the compiled NEURON executable with all these mechanisms in it.

So chmod +x run_*, and then ./run_whatever_the_heck will launch the custom NEURON executable, which will in turn load whatever_the_heck.hoc, and Bob's your uncle.
phendric

Re: Neuron 7 returns Segmentation violation

Post by phendric »

Which is to be expected, since all of the mod files for the custom mechanisms that these hoc files use are in CA1_multi/mechanism, and that's also the location of the i686 directory that contains the compiled NEURON executable with all these mechanisms in it.

So chmod +x run_*, and then ./run_whatever_the_heck will launch the custom NEURON executable, which will in turn load whatever_the_heck.hoc, and Bob's your uncle.
Thanks for the hilarious reply, Ted. Only one problem...in the CA1_multi/mechanism directory, there is no i686 subdirectory, which means that the custom Neuron executable doesn't exist. I've downloaded this code multiple times from both the modelDB servers and the USC servers that are hosting Poirazi's work, and neither of them has the /i686 subdirectory...

Running ./run_whatever_the_heck was actually the first thing I tried, as per the instructions in the Readme, and when that didn't work, I moved onto trying to run the .hoc files themselves.

Oh where, oh where might the missing files be...?

Phillip
phendric

Re: Neuron 7 returns Segmentation violation

Post by phendric »

I've downloaded this code multiple times from both the modelDB servers and the USC servers that are hosting Poirazi's work, and neither of them has the /i686 subdirectory...
Ok, quick correction...I was incorrect in stating that the USC servers don't have a ./mechanism/i686 directory, because they do (here's the link: http://lnc.usc.edu/CA1-pyramidal-cell-model/ ).

However, when I try to execute ./run_whatever_the_heck after modifying the permissions, I get the following:

Code: Select all

phendric@phendricUbuntu:~/CA1/experiment/single-shock$ ./run_Apical_Tips 
lt-special: error while loading shared libraries: libnrniv.so.0: cannot open shared object file: No such file or directory
Blah.
ted
Site Admin
Posts: 6358
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Neuron 7 returns Segmentation violation

Post by ted »

Forget about the Poirazi model for a moment. Does neurondemo work? If so, cd to CA1_multi/mechanism, then
rm -rf i686
nrnivmodl
ls i686
Do you see a file called special?
phendric

Re: Neuron 7 returns Segmentation violation

Post by phendric »

Doh!

Problem solved. I forgot to execute nrnivmodl in the /mechanism sub-directory. That created a directory named x86_64, and to finish, I went and edited all of the run_* files, changing "i686" to "x86_64".

Everything runs beautifully now. Thanks for the help.

Phillip
ted
Site Admin
Posts: 6358
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Neuron 7 returns Segmentation violation

Post by ted »

A sterling example of what can be accomplished through clever program organization. One gets used to having all the mod files in the same directory as the hoc and ses files that need them. There are times when one is forced to factor source code into pieces that end up in different directories, and I suppose this is such a case.
mrunal
Posts: 2
Joined: Wed May 14, 2014 5:35 am

Re: Neuron 7 returns Segmentation violation

Post by mrunal »

Hi,
I am trying the same thing but in windows and getting error as follows,
[c:\nrn\bin\nrniv.exe: syntax error
in ../../morphology/n123/cell-analysis.hoc near line 12
forall insert d3 // mod file to enable 3-D mapping of each point along the cell
^
xopen("../../morp...")
ExperimentControl[0].execute1("xopen("../...")
ExperimentControl[0].xopen_geometry_dependent("cell-analysis")
0
c:\nrn\bin\nrniv.exe: cell_analysis undefined function
in ../../morphology/n123/cell-analysis.hoc near line 32
cell_analysis(econ)
^
cell_analysis(ExperimentControl[0])]

I am not understanding how to change the directory in windows. The folder x86_64 is been created and I edited all hoc files respectively. but did not work. I do not know where I am going wrong. Can you help me.
Thanks.
Mrunal
ted
Site Admin
Posts: 6358
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Neuron 7 returns Segmentation violation

Post by ted »

You'll have to help me out a bit here.

What version of MSWin are you using, and what version of NEURON? (what is the first line that the interpreter prints to the monitor when NEURON starts?).
I am trying the same thing
What "same thing" are you trying, and how are you going about it? This is one of the worst model entries, in terms of egregious complexity of code and lack of user instructions. To help you, I first need a little help from you.

What exactly did you do that culminated in the error message you quote?

Were you running NEURON from the command line in its own bash shell? If so, what directory were you in, and exactly what was the command line?

Had you already compiled the mod files? How?
mrunal
Posts: 2
Joined: Wed May 14, 2014 5:35 am

Re: Neuron 7 returns Segmentation violation

Post by mrunal »

Hi,
I am extremely sorry for providing insufficient information.
I want to use model of CA1 neuron built by Poirazi and Mel.
I am using windows 10 and Neuron 7.4, 64 bit version.
I downloaded the model from modeldb and compiled it using “mknrndll”.
Subdirectory mechanisms in the main folder has a folder x86_64.
I want to run one experiment that is Single shock. This has 3 hoc files namely, Apical_Tips, Trunk_A and Trunk_aplusB. I tried running it from the “experiment” folder (by double clicking the hoc file) and this culminated in the error.

[NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits

loading membrane mechanisms from nrnmech.dll
Additional mechanisms from files

1
1
1
1
1
1
1
1
object ExperimentControl created.

1
0
0
1
0
1
0
c:\nrn\bin\nrniv.exe: syntax error
in ../../morphology/n123/cell-analysis.hoc near line 12
forall insert d3 // mod file to enable 3-D mapping of each point along the
cell
^
xopen("../../morp...")
ExperimentControl[0].execute1("xopen("../...")
ExperimentControl[0].xopen_geometry_dependent("cell-analysis")
0
c:\nrn\bin\nrniv.exe: cell_analysis undefined function
in ../../morphology/n123/cell-analysis.hoc near line 32
cell_analysis(econ)
^
cell_analysis(ExperimentControl[0])
oc>]

Help me with this.
Thank you.
ted
Site Admin
Posts: 6358
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Neuron 7 returns Segmentation violation

Post by ted »

Progress will be fastest if we switch to email. I'm sending you a message now.
ted
Site Admin
Posts: 6358
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Neuron 7 returns Segmentation violation

Post by ted »

The problem you encountered has nothing to do with the discussion thread to which you posted your query. It would be a disservice to you if I didn't mention that posting an unrelated message to a discussion thread is generally regarded as a violation of forum etiquette--not just on the NEURON Forum but on any forum about any subject. But your question is important, and other NEURON users will benefit from knowing about the problem you encountered and how to fix it. So we're even. After you have had a chance to read the following, I will split off your question and the following answer into a new thread.

The useful part of the error message occurs in the first few lines printed by NEURON:

Code: Select all

[NEURON -- Release 7.4 (1370:16a7055d4a86) 2015-11-09
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2015
See http://www.neuron.yale.edu/neuron/credits

loading membrane mechanisms from nrnmech.dll
Additional mechanisms from files

        1
The 1s mean that some hoc statements were executed successfully. But what is essential is what NEURON didn't print. It didn't print the names of any mod files. If your nrnmech.dll file contained compiled mechanisms, the names of the source mod files would have been printed.

So your nrnmech.dll contained no mechanisms, and the first hoc statement that references a mechanism that is not built into NEURON will produce an error message, and that's what happened.

This model's authors chose to organize their files in a very complex, idiosyncratic way. "Too clever by half" is a massive understatement. Nobody else on the planet does things the way they do. And their instructions for how to reuse their files are completely insufficient. The result is endless headaches for anyone who tries to use their source code.

Why is your nrnmech.dll useless? Who knows--from our email exchange, I found out that you generated it with some kind of third party software that I don't know anything about. But I can tell you that NEURON comes with a GUI-based tool that will compile mod files perfectly well. If you're going to spend any time using NEURON, you should learn about it. Go to https://www.neuron.yale.edu/neuron/docs, then click on FAQ, then click on the question How do I compile mod files?

After you see how easy it is to compile mod files under MSWin, use the mknrndll tool to navigate to the mechanism directory and compile those mod files. After it finishes, you will find a file called nrnmech.dll inside the mechanisms directory.

Drag that nrnmech.dll file into the single-shock directory.
Then decide which of the three hoc files
Apical_Tips.hoc
Trunk_A.hoc
Trunk_AplusB.hoc
you want to launch, and double click on it.
NEURON should start, create some windows and a RunControl panel, and execute a simulation.
Post Reply