We've seen partitions in the "Slurm basics" chapter. To run an interactive job using the interactive partition, invoke the command:
interactive
This will return an interactive shell to the user. The resources are limited to 1 processor and 3 GB of RAM.
An interactive job allows a user to interact with the requested resources in real time. Users can run applications and run commands directly on a node. So for example interactive jobs should be used for applications that require input from users during runtime or when the applications have a GUI.
To obtain an interactive shell using the interactive partition, the user can also use the following command:
srun --pty --mem=1g -n 1 -J interactive -p interactive /bin/bash
To run an interactive job in a specific node (hostname), use the command:
srun --pty --mem=1g -n 1 -w hostname -J interactive -p interactive /bin/bash
The interactive shell is active for a maximum of 24 hours.
Please note
Interactive jobs should only be used when a real time interaction is needed and/or for tasks having low computational burden. Typical examples are the installation of software having an interactive installation procedure, simple file managing/manipulation (e.g. compressing files), etc.
Do not use the interactive partition to run tasks having a long execution time and/or having a high computation burden. These kind of jobs should be executed in the allgroups partition.
The use of the interactive partition is monitored: jobs that will use this partition in a wrong way will be terminated.
To run an interactive job that uses one GPU, use the command:
srun --pty --mem=1g -n 1 --gres=gpu:1 -J interactive -p interactive /bin/bash
To run an interactive job that uses for example 2 specific GPUs, use the command:
srun --pty --mem=1g -n 1 --gres=gpu:titan_rtx:2 -J interactive -p interactive /bin/bash
Please note
If the GPUs are already used by other jobs/users, the previous commands will not work.
Another way to get an interactive session with more flexibility and the possibility to access a graphical interface is the sinteractive
command.
Unlike the sbatch
, resources must be requested via the command line through the use of options or flags. Running sinteractive without any option is possible, this will result in default values being used for your jobs, but remember:
The amount of time must always be defined through the
--time
option.
As an example we can get a server with a specific kind of GPU, let's say one Nvidia RTX, to graphically test our code in Matlab. Let's suppose our DEI username is username, that we need to run this test for one hour or a little less and that we have estimated less than 40 GB of memory usage:
ssh -X username@login.dei.unipd.it
sinteractive --gres=gpu:rtx:1 --time=01:00:00 --mem 40G
matlab -desktop
this will trigger the opening of the graphic window of the program with a time limit of 1 hour and 40 GB of dedicated RAM memory.
Apart from Matlab, after connecting with the -X
option launching firefox
or any other installed program which presents a GUI will open it in the graphical mode.
The
-X
option is requested in order to enable X11 forwarding so to have the graphical interface.
If you run the command
nvidia-smi
after the assignment of the resource it will show just the cards that have been requested, not all the GPU of the machine hosting your job. More information about resources usage in this chapter.
With the sinteractive command you can also ask for other resources as you can read in the Slurm basics chapter. Let's say we need 100 GB of RAM and we will have 4 tasks running:
sinteractive --mem 100G --ntasks 4
The maximum duration allowed for a session is 35 days. In certain situation a long period of time can't be accepted by the scheduler: if a maintainance is due in a week, the request made without expliciting a shorter amount of time will surely fail because the theoretical duration of the job would overlap the time of the scheduled maintenance.
To avoid this kind of situation is advisable to always be careful with the request done through the --time
option. The syntax is:
--time=D-HH:MM:SS
If you just need 1 hour at most (or less than 1 day) you can ignore the indication of the days:
sinteractive --time=01:00:00
If the job exceeds the time, it is automatically terminated.