Guide · SLURM · VASP · LAMMPS · 12 min read
How do I estimate how long and how much memory a job will need?
Checked against the docs · SLURM documentation 26.05 and VASP wiki and LAMMPS stable release 30 Sep 2026 update1 · Last checked 12 November 2026 · Spot a mistake? Tell us
Short answer
Run a short version of the same calculation on the same kind of node, then scale up: in VASP, time a few steps with the LOOP+ timer and read the memory line in OUTCAR; in LAMMPS, read the Performance line and the memory per processor in the log. Ask sacct for Elapsed and MaxRSS of the test, request --time and memory with a margin, and compare with the partition's limits.
What am I estimating, and from what?
Every SLURM job asks for two budgets: a walltime (--time, the longest it may run by the clock) and an amount of memory (--mem per node or --mem-per-cpu per core, or the site's default if you ask for nothing). A good request is the job's real need plus a margin.
You cannot read the need off the input files with confidence. What the official documentation offers instead is measurement: run a short version of the same calculation, on the same kind of node, and scale up. The VASP wiki puts it this way for repetitive tasks: "a few iterations estimate the performance of the full calculation very well."
Why not just ask for the maximum?
Both directions cost something, and the sbatch page says what:
- Too much walltime: if the request is longer than the partition's limit, the job is left pending, possibly indefinitely. Within the limit, whether a shorter request starts sooner depends on how your cluster's scheduler is set up, which is site policy;
squeue --startshows when SLURM expects a pending job to start, so you can see the effect for yourself. - Too little walltime: when the limit is reached, each task is sent
SIGTERMand thenSIGKILL; the job ends asTIMEOUT, and whatever was not saved is lost. - Too little memory: the job can be stopped as
OUT_OF_MEMORY, wherever it was. If you ask for nothing, your site's default (DefMemPerNode, whichscontrol show configshows when it is set) applies, and it may be less than the node has. The page also notes that memory requests are only strictly enforced where the site has configured it. - Too much memory: if the memory a job asks for can't be satisfied by any node in the partition, the job is rejected.
How do I fix a job that ran out of memory or walltime? covers what to do after the fact; this page is about getting it right first.
What does SLURM tell me about a job that has run?
The accounting record, from the login node:
sacct -j 123456 --format=JobID,JobName,State,Elapsed,Timelimit,NCPUS,CPUTime,TotalCPU,ReqMem,MaxRSS(The job id is an example.) What each field means, from the sacct page:
| Field | What it is |
|---|---|
Elapsed | How long the job ran, by the clock. |
Timelimit | The walltime it was given. |
NCPUS | How many CPUs were allocated. |
CPUTime | Elapsed times the CPU count: what the allocation used up. |
TotalCPU | The CPU time the processes actually spent working (user plus system). Far below CPUTime means cores sat idle. |
ReqMem | The memory the job asked for, from the allocation (not per step). |
MaxRSS | The largest resident set size (memory actually held in RAM) of all tasks in the job. |
Two details: sacct shows one line per step (each srun, plus the batch step), so read the step that ran your program; and without -j, sacct only lists jobs since midnight. Some systems report incomplete numbers, which sacct shows as 0; the page points to the system's own getrusage documentation for what is gathered.
While a job is still running, sstat gives the same kind of numbers for its steps:
sstat -j 123456 --format=JobID,MaxRSS,AveRSSThe sstat page notes it needs the cluster's job accounting gathering to be working, and shows only the lowest-numbered normal step unless you add --allsteps.
How do I estimate a VASP job?
1. A dry run, for the size of the problem. The wiki's Optimizing the parallelization page suggests running VASP with ALGO = None in the INCAR, or with the command-line argument --dry-run: the setup is done without the electronic minimization, and the default number of bands (NBANDS) and the total number of plane waves are written to OUTCAR "while using barely any computational time". The wiki does not say whether the dry run also reports the memory line below, or from which version --dry-run exists; if your VASP does not accept it, use ALGO = None.
2. A short test, for the time. Run the real calculation for a few ionic steps (lower NSW, the maximum number of ionic steps), on the same partition and the same number of nodes and ranks you plan to use. The wiki asks for the same or a very similar system and the target hardware, or the result may not transfer. Then read the timers: The same short test also shows whether the input is read and the first steps behave; How do I avoid a failed run from bad settings? says what it can and cannot tell you.
grep LOOP+ OUTCARThe wiki: LOOP times each electronic minimization step, and LOOP+ times a whole ionic step, all its electronic steps plus the work after them, such as the forces.
3. Scale up the time. Time per ionic step × the number of ionic steps:
- Molecular dynamics: the NSW page says
NSWis the number of steps in an MD run, so the count is known. - Relaxation:
NSWis only the maximum; the real count depends on how fast it converges. Estimate from a similar earlier relaxation, or plan forNSWsteps and split the run if that is longer than the partition allows (How do I chain SLURM jobs?).
Ionic steps are not all equal: within each, at most NELM electronic steps run, fewer once EDIFF is met, so the first steps of a run, starting from scratch, can take longer than the later ones. The wiki does not say which steps to time from; grep LOOP+ OUTCAR lists every step, so you can see how much they differ before you scale up.
4. Read the memory. The wiki's Not enough memory page points to the line in OUTCAR where VASP reports the memory one rank uses:
grep "total amount of memory used by VASP MPI-rank0" OUTCARThat figure is for rank 0, in kilobytes. Times the ranks per node, it is a guide to the memory per node. The wiki does not say how far other ranks can differ from rank 0, so leave room above it. The Memory requirements page explains what grows it: the wavefunctions take NKDIM × NBANDS × NRPLWV × 16 bytes (k-points, bands, plane waves per band, 16 bytes each), so a larger cell, a higher ENCUT or a denser k-point mesh all raise it. KPAR raises the memory per rank; a larger NCORE lowers it (How do I use my cores well in VASP?).
How do I estimate a LAMMPS job?
1. A short run of the same system. Run a few thousand steps with the same potential, the same atoms and the same number of MPI tasks. At the end, LAMMPS prints a timing summary; the manual's example:
Loop time of 0.942801 on 4 procs for 300 steps with 2004 atoms
Performance: 54.985 ns/day, 0.436 hours/ns, 318.201 timesteps/s, 637.674 katom-step/sThe manual says the Performance line is there "to help predict how long it will take to run a desired physical simulation". The loop time counts only the MD steps, not the setup.
2. Scale up the time. Steps you need ÷ timesteps per second. With the manual's example numbers, a million steps at 318 timesteps per second is about 3,100 seconds, a little under an hour (an example, not a benchmark). hours/ns does the same for simulated time.
3. Bigger system, same kind. The manual's Measuring performance page says katom-step/s is fairly independent of the system size, so for the same potential on the same hardware it scales a test to a larger cell. On more MPI tasks, communication changes the picture; time a short run at the size you will use.
4. Check the test was clean. The CPU use line under the Performance line should be close to 100% times the number of OpenMP threads (100% without threads). Lower numbers mean time lost to file output or other work on the same cores, and the test underestimates speed.
5. Read the memory. Before a run starts, LAMMPS prints how much memory the simulation needs, in MBytes per processor. info memory in the input script reports rank 0's current allocation and, where the system supports it, the most physical memory used so far.
How much should I ask for?
Starting points, not rules:
| Request | Start with | What it depends on |
|---|---|---|
--time | The scaled-up estimate plus a margin, within the partition's limit | How steady the time per step was in the test. None of the documents gives a margin: the more the time per step varied in the test (grep LOOP+ OUTCAR, or the Performance lines of two short LAMMPS runs), the more to add. |
| Memory | The test's memory per rank × ranks per node, plus a margin, as --mem per node or --mem-per-cpu per core | Your cluster's memory model and default; the parallel setup, which changes memory per rank. |
| Partition | The shortest one whose limits fit both | Its longest walltime and its memory per node: sinfo -o "%P %l %m". |
Two sbatch options help around the edges:
--time-mingives a lower limit SLURM may shorten the job to, if that lets it start sooner through backfill scheduling. Use it only if the program can stop and continue cleanly.--test-onlychecks the script and returns an estimate of when the job would start, without submitting it. It says nothing about how long the job will run.squeue --startdoes the same for jobs already pending, where the site uses the backfill scheduler.
What it depends on:
- The code's own work per step: cell size,
ENCUT, k-points and bands for VASP; atoms, potential and cutoff for LAMMPS. - The number of steps: fixed for MD, unknown in advance for a relaxation.
- The parallel setup: nodes, ranks per node, and in VASP
KPARandNCORE. - The hardware: a test on another partition or another cluster does not transfer.
How do I know my estimate was right?
After the real job, compare the request with what it used:
Elapsedwell underTimelimit, and the jobCOMPLETED.MaxRSSwell underReqMem. Mind the units:MaxRSSis per task, andReqMemmay be per node or per CPU.TotalCPUclose toCPUTime. A large gap means cores were idle; the job asked for more than it used.- The program agrees. VASP's
LOOP+times look like the test's; LAMMPS's Performance line matches the test's.
Keep these numbers with the run. The next estimate for a similar system starts from them.
What do people mix up?
| The mix-up | What is true |
|---|---|
--test-only tells me how long the job will take | It estimates when the job would start; the run time comes from your test. |
MaxRSS and ReqMem are in the same terms | MaxRSS is the largest of any task; ReqMem is the request, per node or per CPU. |
CPUTime is the time the job ran | That is Elapsed. CPUTime is Elapsed × the CPUs allocated. |
| LAMMPS's loop time is the whole job | It covers the MD steps only, not reading the input and setup. |
NSW steps is how long a relaxation takes | NSW is the maximum for a relaxation; MD runs all of them. |
| A test on my laptop gives the cluster's speed | The VASP wiki says to test on the target hardware; the LAMMPS manual lists the CPU, memory and network among what sets the speed. |
| Asking for no memory gives the whole node | You get your site's default; --mem=0 is the request for all of each node's memory. |
What goes wrong?
| Mistake | What you would see | What to do |
|---|---|---|
| Timing only the first ionic step | The full job runs longer or shorter than planned. | Time several steps and look at how they vary. |
| A test on one node, the real job on four | The real job is not four times faster, or uses memory differently. | Test with the node and rank counts you will use. |
| No margin | TIMEOUT near the end, or OUT_OF_MEMORY at a peak. | Add a margin to both, within the partition's limits. |
| A walltime over the partition's limit | The job waits with (PartitionTimeLimit). | Stay within the limit, or split the run. |
| Not asking for memory | OUT_OF_MEMORY soon after the start, though the node has plenty. | Ask explicitly with --mem or --mem-per-cpu. |
| A LAMMPS test with low CPU use | The test runs slower than the real job will, or the real job is slower than planned. | Make sure nothing else runs on the test's cores; check the CPU use line. |
In Set up, Cluster and resources lists each partition with its cores, memory per node and longest walltime, and pre-flight checks your request before you submit. Once a job has ended, Monitor shows how long it ran, the number to start your next estimate from. Everything above works without it.