SLURM Interactive
Interactive Jobs
The SLURM system on CIRCE/SC allows users to run applications on available compute nodes while in a full shell session. This allows users to run applications that require direct user input and full graphical applications that require more extensive compute resources.
Directly via SRUN
Interactive jobs can be run within a scheduled shell using the srun
command. You’ll want to see the User’s Guide for more information about these options. Here is an example:
[user@login0 ~]$ srun --pty /bin/bash [user@svc-3024-6-25 ~]$
You can now run any compute-intensive task interactively.
Let us say that you require a minimum of 4GB of RAM for your interactive task. We can ask the scheduler to put us on a node with >4GB of RAM by requesting the mem
constraint like so:
[user@login0 ~]$ srun --mem=4096 --pty /bin/bash [user@svc-3024-6-25 ~]$ free total used free shared buffers cached Mem: 16396468 8315580 8080888 0 246772 3247420 -/+ buffers/cache: 4821388 11575080 Swap: 18612216 0 18612216
You can specify a wide variety of complexes. See Using Features
Please note: Unless the “—time=HH:MM:SS” constraint is used, all jobs submitted to SLURM (interactive or batch) will receive the default runtime of 1 hour!
Via SALLOC and SRUN
If you need to create an interactive session that you can connect to and disconnect from on-demand (while the job is running), you can:
- use
salloc
to create the resource allocation - use
srun
to connect to it.
To do so, you'd run the command below (customized as needed):
salloc --ntasks=1 --time=00:30:00
This will display the following:
[user@itn0 ~]$ salloc --ntasks=1 --time=00:30:00 salloc: Pending job allocation 12345678 salloc: job 12345678 queued and waiting for resources salloc: job 12345678 has been allocated resources salloc: Granted job allocation 12345678 [user@itn0 ~]$
Notice that the prompt did not change. This is because while SLURM granted your job an allocation, you are not yet connected to that allocation interactively. To connect to it, you'd then run:
srun --jobid=12345678 --pty /bin/bash
This will then result in your prompt changing, as such:
[user@itn0 ~]$ srun --jobid=12345678 --pty /bin/bash [user@svc-3024-6-25 ~]$
Graphical Jobs
The same rules apply for graphical jobs. Your X11 connection will not automatically be forwarded to the remote compute node. You must first obtain your DISPLAY variable by performing the following actions:
[user@itn0 ~]$ echo $DISPLAY :158.0 [user@itn0 ~]$ export DISPLAY=$(hostname)$DISPLAY [user@itn0 ~]$ echo $DISPLAY itn0.rc.usf.edu:158.0 [user@itn0 ~]$ $ srun --time=00:05:00 --pty /bin/bash srun: job 12345678 queued and waiting for resources srun: job 12345678 has been allocated resources [user@svc-3024-6-25 ~]$
Please note:
- the login node (itn0.rc.usf.edu) and DISPLAY (:158.0) will most likely not be the same, therefore it is imperative that you take note. Once you have exported the display, you will be able to use GUI applications on compute nodes within the cluster.
- as this is a scheduled/dispatched job (just like SBATCH jobs), it may take some time for the "has been allocated resources" message to appear, and the prompt to change.
We highly recommend using the CIRCE/SC Desktop Environment if you plan to utilize any graphical applications on the cluster.