Interactive Jobs

From HPCwiki
Revision as of 09:19, 16 June 2026 by Haars0011 (talk | contribs) (Phase 1 § 4 P1.4.5: split Interactive Jobs out of Using Slurm § sinteractive + § salloc (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For quick exploration on a compute node — testing a snippet, profiling memory usage, debugging an environment — request an interactive shell instead of submitting a batch job. SLURM offers two commands for this: sinteractive, which drops you straight into a shell on a compute node, and salloc, which reserves resources you can use from the login node.

sinteractive

sinteractive is a thin wrapper on srun that requests an allocation and gives you a shell on the allocated node:

sinteractive -c <num_cpus> --mem <amount_mem> --time <minutes> -p <partition>

After SLURM allocates resources you land at a new shell prompt on a compute node — run hostname to confirm which one. From there, run commands as you would in any shell; the allocation ends when you exit.

If you run sinteractive with no flags, you get a default allocation of 1 CPU, 100 MB of memory, and 1 hour of wall time. That is fine for a quick test but too small for real work.

Wrapper source

The wrapper itself is a four-line shell script:

#!/bin/bash
srun "$@" -I60 -N 1 -n 1 --pty bash -i

The flags translate to: time out the allocation request after 60 seconds (-I60), one node (-N 1), one task (-n 1), and a pseudo-terminal running an interactive bash (--pty bash -i).

salloc

salloc requests resources without immediately running anything. Use it when you want to keep your shell on the login node and dispatch tasks into the allocation as you go:

salloc -p main --time=2:00:00

Once the allocation is granted, launch tasks with srun:

srun <command>

The default salloc wall time is 1 hour. For longer sessions add --time as in the example above.

See also