Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Allocations with salloc

Form

salloc [options] [command...]

What salloc Does

salloc creates an allocation-only top-level job, waits for it to become runnable, and then starts a foreground command inside that allocation.

If no command is given, it starts your shell.

When --ntasks is greater than 1, the foreground command launches one local process per task rank on the same host.

Typical output:

Granted job allocation 4

Main Options

OptionMeaning
-J, --job-name <name>Set the allocation name
-p, --partition <partition>Choose a partition
-c, --cpus-per-task <n>CPUs per task
-n, --ntasks <n>Number of concurrently launched local tasks
--mem <size>Requested memory
-t, --time <time>Time limit
-G, --gpus <n>Requested GPU slots
-D, --chdir <path>Working directory
--constraint <feature>Require matching local features
--immediateFail if the allocation cannot start immediately

Example

salloc -p gpu -c 4 --mem 8G -G 1 -t 00:30:00

Expected result:

  • an allocation record is created
  • the command waits until the allocation is running
  • your shell starts inside the allocation
  • later srun commands become steps under that allocation
  • the allocation command uses the allocation task count for local multi-task execution