Common Slurm Directives

Common Slurm directives are used in interactive and batch jobs to request resources and configure job behavior, such as specifying the hardware (cpus/gpus/memory), outputs, alerts, and much more.
Note
With Slurm there is often multiple directives that behave similar and even sometimes conflict with each other. It's important to know which ones work best for your intended workflow.
Key directives include:
Essential Resource Allocation
- --nodes=X: Request the number of nodes.
- --ntasks=X: Total number of tasks (processes) to run.
- --ntasks-per-node=X: Number of tasks to run on each node.
- --cpus-per-task=X: Request CPUs per task (useful for multi-threaded jobs).
- --mem=X: Request the amount of system memory
- --gres=gpu:X: Request a specific number of GPUs.
- --time=dd-hh:mm:ss: Set a maximum runtime for the job.
- --partition=name: Submit the job to a specific partition.
Job Management & Output
- --job-name=name: Assign a name to the job.
- --output=filename: Redirect stdout to a file (e.g., job.%j.out where %j is the job ID).
- --error=filename: Redirect stderr to a file.
- --account=name: Charge resources to a specific account.
- --mail-type=type: Email notification type (e.g., BEGIN, END, FAIL, ALL).
- --mail-user=user@email: Email address for notifications.
- --constraint=features: Request nodes with specific features (e.g., ib for infiniband networking).