How to run an interactive session on ScienceCluster¶
What is an interactive session and why should I use one?¶
The main protocol for submitting jobs to ScienceCluster is the batch queueing system, where a user submits a job to the queue then waits for its output after the job has finished running. However, there are cases when your workflow may benefit from having more rapid feedback.
For example, if you'd like to actively debug your code on the cluster then you may need to interact with your code more without constantly submitting jobs to the queue. As such, if you need a more interactive experience on ScienceCluster when developing your code, consider using requested interactive sessions.
An interactive session gives you an active Terminal / coding session on the partition you specify, for the time period that you request, and with the resources you request. You submit an interactive session request to the queue, just as you would a job; when the available resources can be allocated, your interactive session opens, and you can run/debug your code in real time.
There is an important distinction between running code "interactively from the login area/node" and running code from a "requested interactive session".
You should not simply log in to the cluster and start running your code from the command line. When you do so, you are using the login node resources, which are only equipped for cluster user logins and small installation tasks. You risk crashing the login node when running code this way.
How do I request an interactive session?¶
Requesting an interactive session is a straight-forward process. To do so, you could run the following line of code from the log in area:
srun --pty -n 1 -c 2 --time=01:00:00 --gres=gpu:1 --mem=8G bash -l
This would request an interactive session with the following attributes:
- a single task with 2 cores, requested via
-n 1 -c 2
- a 1 hour time limit, requested via
- a single GPU device, requested via
- 8GB of RAM, requested via
- the session would be a standard Bash Command Line terminal, requested via
You should customize these parameters to tailor the interactive session to your needs. For example, you can omit
--gres=gpu:1 if you do not need a GPU. After the interactive session begins, your Terminal's host name will change to indicate the partition where you're running your code, and you can begin to load modules and run shell commands in real-time.
Depending on the resources and time limit you've requested, in addition to your recent usage and the current cluster utilization, you may need to wait for your interactive session to begin. Keep your Terminal open while you wait, lest you risk losing your interactive session.