Some things require user interaction - debugging, and many uses of Matlab for example. And sometimes when preparing a job script it is helpful to work through it interactively first. However, the login nodes are not suitable for work requiring large amount of memory or computation. To support interactive use in a batch environment, Slurm allows for interactive batch jobs.
Options for running interactively on the compute nodes:
(Don't just submit the job, but also wait for it to start and connect
stdin to the current terminal)
-nnumSpecify the number of tasks to run, e.g. -n4. Default is one CPU core per task.
Request job running duration, e.g.
Specify the real memory required per node in MegaBytes, e.g.
Execute the first task in pseudo terminal mode, e.g.
--pty /bin/bash,to start a bash command shell
Enable X forwarding, so programs using a GUI can be used during the session (provided you have X forwarding to your workstation set up)
- To leave an interactive batch session, type
exitat the command prompt.
Certain tasks need user interaction - such as debugging and some GUI-based applications. However the HPC clusters rely on batch job scheduling to efficiently allocate resources. Interactive batch jobs allow these apparently conflicting requirements to be met.
When you start an interactive batch job the command prompt is not immediately returned. Instead, you wait until the resource is available when the prompt is returned and you are on a compute node and in a batch job - much like the process of logging in to a host with
ssh. To end the session, type '
exit', again just like the process of logging in and out with
To use any GUI-based program within the interactive batch session you will need to extend X forwarding with the --x11 option. This of course still relies on you having X forwarding at your login session - try running '
xterm' before starting the interactive to verify that this is working correctly.
You can request resources for an interactive batch session just as you would for any other job, for example to request 4 processors with 4GB memory for 2 hours:
If you do not request resources you will get the default settings. If after some directory navigation in your interactive session, you can jump back to the directory you submitted from with:
Start an interactive batch session with the --x11 option for X forwarding. NYU has a site license for Matlab, so find and load the Matlab module, and start the GUI. Tinker with it, if you wish.
(Don't forget to quit Matlab and exit the interactive batch session after you're done)