Hi,
I've set up a Linux machine to be used exclusively for running simulations. The idea is to run neuron both locally and remotely, depending on the kind of simulation. In the remote case (and maybe in the local case too), I would like to start a simulation and be able to close the session (to shutdown the 'client' computer, for instance) without interrupting the simulation.
How can that be done?
Regards
Leave neuron running and close the session
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Leave neuron running and close the session
If a program requires no user interaction*, you can run it in the background in a subshell, e.g.
% (programname -options &)
Then it should continue to execute after you log out. For more information you may want to read about "job control" and "disowning processes" in a reference on UNIX or Linux.
*--if the program generates terminal output or expects terminal input, you may be able to use redirection to satisfy these i/o requirements.
% (programname -options &)
Then it should continue to execute after you log out. For more information you may want to read about "job control" and "disowning processes" in a reference on UNIX or Linux.
*--if the program generates terminal output or expects terminal input, you may be able to use redirection to satisfy these i/o requirements.
Re: Leave neuron running and close the session
Thanks,
Then I guess neuron will have to be started without the GUI, right? but nrniv doesn't read additional mechanisms present in the directory as nrngui does, so what would be the correct way of starting the process?
Then I guess neuron will have to be started without the GUI, right? but nrniv doesn't read additional mechanisms present in the directory as nrngui does, so what would be the correct way of starting the process?
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Leave neuron running and close the session
That's a fair question.
nrngui -help
reveals some interesting things, including this answer to your question:
nrngui -nogui
nrngui -help
reveals some interesting things, including this answer to your question:
nrngui -nogui
Re: Leave neuron running and close the session
Thanks a lot!
I don't know why the subshell trick does not work for me, but if I do
nrngui -nogui myfile.hoc &
and then
disown processID
it's just what I need. The simulation keeps running after logout!
I don't know why the subshell trick does not work for me, but if I do
nrngui -nogui myfile.hoc &
and then
disown processID
it's just what I need. The simulation keeps running after logout!
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Leave neuron running and close the session
Excellent! I am sure that other NEURON users will find this to be useful. Thanks for asking the question that led to this answer.
Re: Leave neuron running and close the session
You can also run NEURON within a "screen" session. GNU screen is a standard Linux/Unix program that can manage multiple shell sessions for you (i.e., "screens") and keep them running even if you're not logged into the system. Think of it as a "window manager" for the terminal. You can read the manual page by running "man screen" while logged into your Linux system. There are a lot of options and it's an extremely versatile program, but there are plenty of online tutorials if you search for them in Google.
For basic usage, this is how I use screen:
One advantage here is that you don't have to redirect output to a file (though you may still want to do so if your program will output a lot of data and you want to look at it afterwards) as you would if you're putting it into the background using the "&" method.
There's a bit of a learning curve to screen, but I've found it invaluable whenever I'm running programs on a remote system. It can even be simply used as "basic insurance" in case your connection is broken. If you're running everything within screen, your programs continue running, and you just have to login again and resume the session with no loss of productivity.
For basic usage, this is how I use screen:
Code: Select all
$ ssh myhost
myhost$ screen
--new screen session started--
myhost$ nrngui -nogui myfile.hoc
myhost$ <CTRL-A> <d>
--screen session detached--
myhost$ exit
$
(Some time later)
$ ssh myhost
$ screen -R -D
--screen session resumed--
(nrngui still running from before in terminal)
There's a bit of a learning curve to screen, but I've found it invaluable whenever I'm running programs on a remote system. It can even be simply used as "basic insurance" in case your connection is broken. If you're running everything within screen, your programs continue running, and you just have to login again and resume the session with no loss of productivity.
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Leave neuron running and close the session
Outstanding tip. screen is an underused gem.
Re: Leave neuron running and close the session
Thanks!!
I'll give it a try.Sounds really amazing!
I'll give it a try.Sounds really amazing!