Using “screen” to run simulations on a remote host
The suggested way to run your simulations on a remote host (let say for instance on ada-18) is to use screen, which allows you to:
- use multiple shell windows from a single SSH session
- keep a shell active even through network disruptions
- disconnect and re-connect to a shell sessions from multiple locations
- run a long running process without maintaining an active shell session.
Start screen
Enter in a terminal
screen
or – better – start a screen session by giving it a name (for instance “sim1”):
screen -S sim1
This is very useful if you are going to start several screen sessions on the same host.
Start a simulation
After you’ve started a screen session (see above) you will see a normal terminal prompt and at this point you can start your simulation:
./start_my_simulation_nr_1 with some parameters
Afterwards to disconnect from the screen session just type “Ctrl+a” and “d” (i.e. the control key and a lowercase “a” and then the lowercase “d”; d=disconnect).
Later you can re-connect to this screen session with the command:
screen -r
or – if you started screen with the “-S” option – with the command:
screen -r sim1
More information
See the man page of screen:
man screen
In particular read about the “screen commands”, those that begin with Ctrl+a.
Posted on
in Computing