Skip to content

How to run an interactive session on the ScienceCluster

What is an interactive session and why should I use one?

The main protocol for submitting jobs to the 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 the 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.

Warning

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 -p vesta --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:

  • the Vesta partition, requested via -p vesta
  • a single task with 2 cores, requested via -n 1 -c 2
  • a 1 hour time limit, requested via --time=01:00:00
  • a single GPU device, requested via --gres=gpu:1
  • 8GB of RAM, requested via --mem=8G
  • the session would be a standard Bash Command Line terminal, requested via bash

This example will work if you have access to the Vesta partition; if you don't have access to the Vesta partition, you will receive an error similar to Requested node configuration is not available. If you instead have access to the Generic partition, consider the following line of code for an interactive session:

srun -p generic --pty -n 1 -c 2 --time=01:00:00 --mem=8G bash -l

Observe that many of the same parameters are unchanged, with the exception of the --gres=gpu:1 parameter that requests a GPU and the -p generic parameter that specifies the partition of interest. Since the Generic partition is not equipped with GPU's, you should not request a GPU.

In other words, you should customize these parameters to tailor the interactive session to your needs. 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.

Note

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.


Last update: March 21, 2022