Guide · SLURM · VASP · LAMMPS · 12 min read

How do I submit a job on a SLURM cluster?

Checked against the docs · SLURM documentation 26.05 and VASP wiki · Last checked 12 November 2026 · Spot a mistake? Tell us

Short answer

Write a job script whose #SBATCH lines ask for a partition, nodes, tasks per node and a walltime, followed by the commands that load and run your program; submit it with sbatch from the folder that holds your input files, then follow it with squeue and check how it ended with sacct.

What is SLURM, and why do I need a job script?

A university cluster is many computers shared by many people. You do not run a calculation on it directly. You write a short job script that says what you need (how many machines, how many processes, for how long, in which queue) and what to run, and you hand it to SLURM, the program that shares the cluster out. SLURM puts your job in the queue and starts it when the machines are free.

What do the words mean?

WordWhat it means
login nodeThe computer you reach with ssh. For editing files and submitting jobs, never for running calculations.
compute node (or node)One of the machines that run jobs. Each has a fixed number of cores and amount of memory.
coreOne processor inside a node. A node commonly has 32 to 128.
partitionA queue with its own rules: which nodes, how long a job may run, sometimes who may use it. Common names are debug, short, standard and bigmem, but every cluster names its own.
task (or rank)One copy of your program. VASP and LAMMPS run as many copies working together through MPI (the standard way parallel programs pass data between processes), usually one per core.
walltimeThe longest your job may run, by the clock on the wall. SLURM stops the job when it is reached.
account (or allocation)Whose time the job is charged to, usually your group's. Some clusters require it.
job idThe number SLURM gives your job when you submit it. Every other command uses it.
moduleA cluster's way of making installed software available: module load vasp adds VASP to your session or job.

Why does getting it right matter?

Every job goes through this, and each mistake costs something different:

  • Walltime too short, and the job is stopped before it finishes, after you have already waited in the queue.
  • More than you need, and your group's allocation pays for idle cores, and the job waits longer to start.
  • More than the partition allows, and the job is refused or never starts.
  • A wrong module or command, and the job fails in its first second: the cheapest way to fail, and the most common on a new cluster.

What goes in a job script?

A minimal script for VASP. The partition, account and module names are placeholders: get the real ones from your cluster's user guide or your research computing team.

Job script
#!/bin/bash
#SBATCH --job-name=TiO2-relax
#SBATCH --partition=standard
#SBATCH --account=mygroup
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=32
#SBATCH --time=04:00:00
#SBATCH --output=slurm-%j.out
#SBATCH --error=slurm-%j.err
module load vasp
srun vasp_std
  • #!/bin/bash says the script is run by the bash shell.
  • Each #SBATCH line is a request to SLURM. Bash treats them as comments; sbatch reads them.
  • --job-name is the name you will see in the queue.
  • --partition picks the queue; --account says who pays.
  • --nodes=1 asks for one whole machine; --ntasks-per-node=32 starts 32 copies of the program on it, one per core of a 32-core node.
  • --time=04:00:00 is the walltime, in hours, minutes and seconds.
  • --output and --error name the log files; %j becomes the job id. Without them, SLURM writes to slurm-<job id>.out.
  • module load vasp makes the cluster's VASP available to the job.
  • srun vasp_std starts VASP on all the tasks you asked for. Some clusters use mpirun instead, which depending on the MPI library may or may not go through SLURM; your cluster's guide says which to use.

The script runs in the folder you submit it from, so that folder must hold the input files: INCAR, POSCAR, POTCAR and KPOINTS for VASP.

How do I submit it?

To have SLURM check the request without submitting it, use sbatch --test-only job.sh; How do I avoid a failed run from bad settings? lists what else to check before a job goes in the queue.

From the run folder on the login node:

Terminal
sbatch job.sh

SLURM answers with the job id, for example Submitted batch job 123456. If it answers with an error instead, the job was not queued; the common errors are in the table near the end.

How do I check the queue?

Terminal
squeue -u $USER

squeue --me does the same. The output looks like this (an example, not a real queue):

Example
  JOBID PARTITION      NAME   USER ST   TIME  NODES NODELIST(REASON)
 123456  standard TiO2-rela  jsmith PD   0:00      1 (Priority)
 123457  standard  Si-static jsmith  R  12:41      1 node042

The ST column is the state: PD is pending (waiting in the queue), R is running, CG is completing (finishing up).

Why is my job still pending?

For a pending job, the last column of squeue gives the reason:

  • (Priority): one or more higher-priority jobs are waiting for the same partition. Yours starts in turn.
  • (Resources): the resources it asks for are in use by other jobs. It starts when they free up.
  • A reason with Limit in its name, such as QOSMaxJobsPerUserLimit: a cap has been reached; for that one, the number of jobs you may run at once. It starts when one of your other jobs ends.
  • (PartitionTimeLimit): the walltime you asked for is longer than the partition allows. It will not start on its own; see the mistakes table.
  • (ReqNodeNotAvail): a node the job needs is not available: in use, reserved, down or drained (taken out of service).

SLURM's job reason codes page lists the rest.

How do I see how a job ended?

squeue only lists jobs that are waiting or running. For a finished job, ask the accounting record:

Terminal
sacct -j 123456 --format=JobID,JobName,State,Elapsed,ExitCode

The State column says how it ended: COMPLETED, FAILED, TIMEOUT (ran out of walltime), CANCELLED or OUT_OF_MEMORY.

COMPLETED only means the job finished with an exit code of zero on all nodes. It does not mean the calculation converged: a relaxation that used up all its ionic steps can still end as COMPLETED. Read the program's own output to know whether the science finished.

How do I cancel a job?

Terminal
scancel 123456

This works whether the job is pending or running. When a job reaches its walltime, SLURM does the same thing for you: each task gets a signal to stop, then a forced kill shortly after.

How many nodes, tasks and hours should I ask for?

Starting points, not rules. Your cluster's limits and your calculation decide.

SettingStart withWhat it depends on
First job on a new clusterA test job: one task, five minutes, the debug or short partition, printing which modules loaded and where the program isCatches a wrong module, command or path before a real calculation waits in the queue.
NodesOne, for a first calculation on a small cell (tens of atoms)More nodes help larger cells and more k-points, up to a point; past it, adding nodes slows the job. The documentation gives no rule for when a second node pays off; time a short run on one node and on two and compare.
Tasks per nodeThe node's core countSome clusters charge for the whole node whether you use it or not; your cluster's documentation says how it charges. Fewer tasks per node can help when a job runs out of memory.
WalltimeYour best estimate plus a margin, within the partition's limitShorter requests can start sooner: Slurm's backfill scheduler, loaded by default, starts a lower-priority job early when doing so does not delay the expected start of any higher-priority job, and it works that out from the time limits jobs ask for. Too short and the job is stopped. If you leave --time out, the partition's default limit applies.
Partitiondebug or short for tests; the standard one for production; a large-memory one only if memory is the limitLarger or longer partitions often wait longer and may cost more.

For a first estimate of walltime, run a short version and look at how long each step takes. For VASP, OUTCAR records the time each step took; grep LOOP+ OUTCAR lists the timing lines for the ionic steps, but the VASP wiki does not document them, so check that your version prints them. Multiply the time per step by the number of steps you expect and add a margin.

How do I know the job ran the way I asked?

  1. sbatch returns a job id. If not, read the error; nothing was queued.
  2. squeue shows it go from PD to R.
  3. The program started with the processes you asked for. VASP prints the number of MPI processes near the top of its output. It should equal nodes × tasks per node: 32 for the script above. In VASP 6 it is the first line of the screen output (your job's output file), for example running 32 mpi-ranks, with 1 threads/rank, on 1 nodes. Older versions such as 5.4 may word it differently; look for the process count near the top of the output.
  4. It ended the way you think. sacct says COMPLETED, and the program's own output agrees. A VASP run that finished normally ends its OUTCAR with a timing summary that begins General timing and accounting informations for this job (VASP's own spelling).
  5. It asked for about the right amount. Compare Elapsed in sacct with the walltime you requested, and add MaxRSS (the most memory any task used) to the --format list. Many clusters also offer seff 123456, which summarizes how well the job used its cores and memory. seff is a contributed script that comes in the contribs folder of Slurm's source, not one of the documented commands, so it is there only if your cluster installed it.

What usually goes wrong?

MistakeWhat you would seeWhat to do
Running the calculation on the login nodeEverything on the login node slows down for everyone; an email from the administrators; the process is killed.Always submit with sbatch.
Walltime too shortsacct says TIMEOUT, terminated on reaching the time limit; the error log has a line such as *** JOB 123456 ON node042 CANCELLED AT 2026-10-24T14:02:11 DUE TO TIME LIMIT *** (the node and time are examples).Continue from where it stopped (for VASP, the CONTCAR) with a longer walltime.
Walltime longer than the partition allowsThe SLURM docs: the job is left pending, possibly indefinitely, with the reason (PartitionTimeLimit).Cancel it and ask for less time, or use a partition with a longer limit.
More tasks per node than the node has coressbatch refuses the job: sbatch: error: Batch job submission failed: Requested node configuration is not available.Lower --ntasks-per-node to the core count.
Missing or wrong accountsbatch refuses the job: sbatch: error: Batch job submission failed: Invalid account or account/partition combination specified.Add --account with your group's allocation name.
Wrong module or program namevasp_std: command not found in the error log, seconds after the job starts.Run module avail on the login node and fix the module line or the command.
Not enough memorysacct says OUT_OF_MEMORY; on clusters that limit memory with cgroups, the error log has a line such as Detected 1 oom_kill event in StepId=123456.batch. Some of the step tasks have been OOM Killed.More nodes, a large-memory partition, fewer tasks per node, or a smaller calculation.
Input files missing from the folderThe job ends at once; VASP's output names the file it could not find.Submit from the folder that holds all four input files.
Half-empty nodesThe job runs, but slowly, and the whole node is charged anyway.Use all of a node's cores unless memory is the limit.

Try it

Try it: find the problem in the job script

Each job script below has one line that will not do what its author meant. Choose the line you think it is. The answers come from the sbatch manual; the job, module and program names are examples.

Script 1.

#!/bin/bash
#SBATCH --job-name=si-relax
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=32
module load vasp
#SBATCH --time=02:00:00
srun vasp_std

The problem is line 6, #SBATCH --time=02:00:00: sbatch stops reading #SBATCH lines at the first line that is not a comment or blank, here module load vasp. The --time line after it is never read, so the job gets the partition's default time limit. Move every #SBATCH line above the first command.

Script 2.

#!/bin/bash
#SBATCH --job-name=si-relax
#SBATCH --output=$HOME/logs/slurm-%j.out
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=32
#SBATCH --time=02:00:00
srun vasp_std

The problem is line 3, #SBATCH --output=$HOME/logs/slurm-%j.out: SLURM reads #SBATCH lines itself, not through the shell, so shell syntax and variable names are read as literal text: $HOME is not replaced by your home directory. Write the path out in full, or leave --output out: by default the output goes to slurm-%j.out, with %j replaced by the job number.

Script 3.

#!/bin/bash
# a six-hour relaxation
#SBATCH --job-name=si-relax
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=32
#SBATCH --time=6
srun vasp_std

The problem is line 6, #SBATCH --time=6: A single number is read as minutes, so --time=6 asks for six minutes. The other formats sbatch accepts are minutes:seconds, hours:minutes:seconds, days-hours, days-hours:minutes and days-hours:minutes:seconds. #SBATCH --time=6:00:00.

Set up → Cluster and resources holds the cluster, partition, nodes, ranks per node and walltime, and pre-flight checks them before you submit. Once a job is in the queue, Monitor follows it for you, with only the standard SLURM commands, and says when it will check again; the practice cluster lets you try the whole flow without a real one.