Error: stack too deep

Anything that doesn't fit elsewhere.
Post Reply
Ginetto
Posts: 14
Joined: Tue Mar 09, 2010 4:50 am

Error: stack too deep

Post by Ginetto »

Hello folks,

I am running my model several times (for statistical significance), but always after the 6th run I get the error:

Stack too deep. Increase with -NSTACK stacksize option

I don't understand which problem causes this error and how to solve it.
Could someone jelp me?
Thanks a lot!

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

Re: Error: stack too deep

Post by ted »

What OS are you using?
Ginetto
Posts: 14
Joined: Tue Mar 09, 2010 4:50 am

Error: stack too deep

Post by Ginetto »

right... I forgot to mention it.
The OS is Linux
ted
Site Admin
Posts: 6305
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Error: stack too deep

Post by ted »

Execute
nrngui -h
and discover how to adjust stack size.
Ginetto
Posts: 14
Joined: Tue Mar 09, 2010 4:50 am

Re: Error: stack too deep

Post by Ginetto »

Is it one of the interpreter options?
How can I check the current size of stack? The default value is 1000, but I want to check if I really change it.
Where I can find info about this argument? I had a look on "quick reference" and NEURON book, but nothing...

I don't understand if my program is unefficient or it really needs more memory.
I have to run many times the same simulation for statistical reasons, so I image/hope that at each run the memory is reset.
I am not an expert programmer, so I don't know how to check it.

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

Re: Error: stack too deep

Post by ted »

Ginetto wrote:Is it one of the interpreter options?
It's a command line option, like command line options that other Linux programs have. If you want to specify a different value from NEURON's default, for example 2000, then instead of
nrngui foo.hoc
type
nrngui -NSTACK 2000 foo.hoc
I don't understand if my program is unefficient or it really needs more memory.
The error message told you the stack was too small for your code. If you want NEURON to run your code, increase the stack size until you find a value that works.
I have to run many times the same simulation for statistical reasons, so I image/hope that at each run the memory is reset.
Linux reclaims memory when programs exit.
Ginetto
Posts: 14
Joined: Tue Mar 09, 2010 4:50 am

Re: Error: stack too deep

Post by Ginetto »

ted wrote:It's a command line option, like command line options that other Linux programs have. If you want to specify a different value from NEURON's default, for example 2000, then instead of
nrngui foo.hoc
type
nrngui -NSTACK 2000 foo.hoc
I meet some problems when I want to run my simulation using the command line.
I am using the model of Poirazi 2003. To run the sumulation I type in the terminal:

Code: Select all

./run_experiment
where run_experiment is an executable file which contains the lines:

Code: Select all

../x86_64/experiment.hoc -
where x86_64 is the folder created after compiling.

If I run the NEURON's GUI through the command nrngui and then I load my hoc file experiment.hoc, I have an error. I think the problem is that NEURON cannot find the mechanisms of the model (note that experiment.hoc is in a different directory respect to the mechanisms).
Even if I load a session I meet similar error.

In conclusion, if I type nrngui -NSTACK 2000 experiment.hoc my model cannot run, but if I run my simulation with ./run_experiment I don't know how to change the stack size!
ted
Site Admin
Posts: 6305
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Error: stack too deep

Post by ted »

I think the problem is that NEURON cannot find the mechanisms of the model (note that experiment.hoc is in a different directory respect to the mechanisms).
So you know never to do anything like that yourself. There is such a thing as being too clever.
To run the sumulation I type in the terminal:

Code: Select all

./run_experiment
where run_experiment is an executable file which contains the lines:

Code: Select all

../x86_64/experiment.hoc -
where x86_64 is the folder created after compiling.
I don't understand. experiment.hoc is a text file that contains hoc statements? How can typing the name of a hoc file at the command line do anything useful?
Ginetto
Posts: 14
Joined: Tue Mar 09, 2010 4:50 am

Re: Error: stack too deep

Post by Ginetto »

ted wrote:I don't understand. experiment.hoc is a text file that contains hoc statements? How can typing the name of a hoc file at the command line do anything useful?
experiment.hoc is a text file which contains hoc statements, as you said. Once exectuted, It loads the model and runs the simulations. In other words it is the main hoc file of the model.
I created a new file called run_experiment with no extension, which contains a sigle line of code:

Code: Select all

../x86_64/experiment.hoc -
On the linux shell I type chmod +x run_experiment to make it executable.
In order to execute experiment.hoc and so my model, I type in the Linux shell the command ./run_experiment.

Maybe it is more laborious, but for me it is the only way to run the model correctly.

I think this procedure should be equivalent to type in the shell nrngui and then load the hoc file experiment.hoc using the GUI... But for some reasons, I cannot run my model with this second procedure.
ted
Site Admin
Posts: 6305
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Error: stack too deep

Post by ted »

In the directory that contains your hoc files, execute
nrnivmodl pathtoyourmodfiles
where
pathtoyourmodfiles
is the path to the location of your mod files. Then x86_64 will be created and the compiled mechanisms will be placed in that directory, and you will be able to execute
nrngui -NSTACK 2000 foo.hoc
or whatever you like.
Ginetto
Posts: 14
Joined: Tue Mar 09, 2010 4:50 am

Re: Error: stack too deep

Post by Ginetto »

It works! Thanks!

Where can I find some info about the command line options of nrngui and their meanings?
ted
Site Admin
Posts: 6305
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Error: stack too deep

Post by ted »

nrngui --help
Post Reply