Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get an interactive session using Slurm?

Tags:

slurm

I found references to srun --pty bash -i (see https://slurm.schedmd.com/faq.html#prompt) but when I run that on my cluster it exits immediately.

$ srun --pty bash -i
$ squeue
             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
               1  team     bash schmmd  R       0:02      1 team-server1

I can get an interactive session with srun bash, but I don't have a shell prompt (e.g. $) and my session just looks like the following:

$ srun bash
ls
miniconda3
Miniconda3-latest-Linux-x86_64.sh
test

Is something misconfigured on my installation or should I be running a different command?

$ srun --version
slurm 19.05.0
like image 395
schmmd Avatar asked Apr 26 '26 06:04

schmmd


2 Answers

Interactive using srun (Synchronous)

This interactive session exits immediately when you close the current terminal.

srun --time=30:00 --pty /bin/bash

Interactive using salloc (Asynchronous)

This creates a job on the cluster which you can connect to using ssh. WARNING: This job will not terminate until it is explicitly canceled or it reaches its time limit!

  1. Create the job:
$ salloc --nodes=1 --time=30:00

Output:

salloc: Granted job allocation 1234567
salloc: Nodes evc1 are ready for job
  1. Connect to the node interactively:
$ ssh evc1

Adding additional flags to your interactive session

You can add additional requirements to the srun and salloc commands as needed. For instance, to request one node and one task for 30 minutes with 10GB of memory and X11 forwarding type:

srun --export=ALL --nodes=1 --ntasks=1 --x11 --mem=10G --time=00:30:00 --pty /bin/bash
like image 193
Austin Avatar answered May 04 '26 08:05

Austin


Try with salloc and the requirements for your job. It will forward you to a new session prompt with the requested resources.

For instance:

salloc -N1

to request one node.

like image 36
Bub Espinja Avatar answered May 04 '26 09:05

Bub Espinja



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!