Guide · VASP · SLURM · 17 min read

How do I use my cores well in VASP?

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

Short answer

Fill your nodes with MPI ranks, then split them. Set NCORE to a factor of the cores per node (about 4 for 100 atoms, 12 to 16 above 400 atoms, 1 for a small cell on few cores), raise KPAR toward the number of irreducible k-points while memory allows and it divides the ranks, and leave NPAR unset. Then time a few steps of two or three setups on your own system and cluster, and keep the fastest.

What are ranks, nodes and tasks per node?

VASP runs as many copies of itself working together. Each copy is an MPI rank (MPI, the Message Passing Interface, is how the copies pass data to each other); in SLURM's words, each is a task. You usually start one rank per core, the single processor that runs it. A node is one machine of the cluster, holding a fixed number of cores and a block of memory.

In the job script, two lines set how many ranks you get:

Terminal
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=32

That is 2 × 32 = 64 ranks. The numbers that matter to VASP are the total (64) and how many share a node (32), because ranks on the same node talk to each other far faster than ranks on different nodes. The VASP wiki puts it plainly: communication between nodes is much slower than within one.

How VASP divides those ranks is up to you, through three INCAR tags: NCORE, KPAR and the older NPAR. Their defaults leave a lot of speed unused on a modern cluster, and a bad choice can make a job slower on two nodes than on one.

When does the parallel setup matter?

On large cells. By default (NCORE = 1, KPAR = 1), VASP gives each rank its own bands to work on (a band is one electron orbital VASP solves for). The wiki says that is right only for small cells or slow networks: for large cells it needs a lot of memory, because every rank stores the projector functions in full, and a lot of all-to-all communication to keep the bands orthogonal. Its Performance issues page says a good NCORE can make large cells up to four times faster than the default.

On small cells with many k-points. A k-point is one point in the Brillouin zone where VASP solves for the electrons; a small cell often needs many. Spreading the k-points over groups of ranks (KPAR) costs almost no communication, so it is often the biggest win here.

When you add nodes. More nodes help only while each rank still has enough work and the communication stays cheap. Past that point, adding nodes slows the job and spends more of your allocation.

On every long run. The best setup depends on the system, the algorithm and the machine. The wiki's advice is to test it, briefly, before a long production run or a series of similar runs.

How does VASP split the ranks?

The wiki gives the rule as one product:

total ranks = ranks working on bands × NCORE × KPAR × IMAGES × (algorithm-specific tags)

Read it from the outside in:

  1. IMAGES splits the ranks into separate calculations, for example the images of a nudged-elastic-band run. For one ordinary calculation it is 1.
  2. KPAR splits each image into k-point groups. Each group works on its own share of the k-points, handed out in turn (round robin).
  3. NCORE splits each k-point group into band groups of NCORE ranks. The ranks of one band group share the work on one band at a time, splitting its FFTs (the fast Fourier transforms that move each band between real and reciprocal space). This is where most of the frequent communication happens.

For the example above (64 ranks) with KPAR = 2 and NCORE = 4: two k-point groups of 32 ranks, each made of 8 band groups of 4 ranks.

VASP also adjusts the number of bands to the split: the NBANDS page says it increases NBANDS until it divides evenly over the ranks (or over each group, when NCORE or KPAR is above 1). So the band count in OUTCAR can be higher than the default formula gives.

One more assumption, from the wiki's Parallelization page: VASP expects ranks to fill one node before the next (on two nodes with 20 ranks, ranks 1 to 10 on the first). If your MPI places them differently, every parallel FFT crosses between nodes, and a job can get slower going from one node to two. If that happens, check the job script and the MPI settings with your cluster's administrators.

What does NCORE do, and how does it relate to NPAR?

NCORE is how many ranks work together on one band. The NCORE page describes three regimes:

  • NCORE = 1 (the default): one rank per band. The most bands at once, but every rank stores the projectors in full and the bands need heavy all-to-all communication. Right for small cells and slow networks.
  • NCORE about the square root of the ranks in a k-point group: each band group shares its FFTs. Less memory, cheaper orthogonalisation. The wiki calls this the recommended regime for modern multi-core machines.
  • NCORE equal to all the ranks: every rank on one band, no band parallelism at all. The wiki says this is almost always very slow.

Its concrete guidance, for clusters with a fast network (InfiniBand or similar):

  • set NCORE between 2 and the number of cores per node, and make it a factor of the cores per node, so each band group's FFTs stay inside one node;
  • NCORE = 4 works well for about 100 atoms; 12 to 16 is often better above 400 atoms;
  • setting it to the cores in one NUMA domain (a group of cores that share their own block of memory; below) is often a particularly good choice.

On up to about 8 cores, or on a slow (Gbit Ethernet) network, the wiki says use NCORE = 1.

NPAR is the same setting seen from the other side. It is the number of band groups, where NCORE is their size, so for the ranks in one k-point group:

NPAR × NCORE = ranks in the k-point group (the total ranks divided by KPAR)

The wiki calls NPAR a legacy tag and strongly encourages NCORE instead. Do not set both: if both are in the INCAR, NPAR wins. NPAR = 1 is the "every rank on one band" case above, and almost always very slow.

What does KPAR do?

KPAR is how many k-points VASP works on at the same time: the ranks split into KPAR groups, and each group takes its share of the k-points. What the wiki says about it:

  • Choose it as a divisor of the total ranks, so every group has the same number.
  • Raise it toward the number of irreducible k-points, memory allowing. The irreducible k-points are the ones left after symmetry. When VASP builds the mesh itself, it writes the k-points it uses, with their weights, to the IBZKPT file. More groups than k-points leaves groups with nothing to do.
  • It should also divide the number of k-points, so the groups are evenly loaded. If the count is prime or factorises badly, the wiki suggests copying IBZKPT to KPOINTS and adding k-points with zero weight.
  • It saves communication. Most of the communication in the electronic steps happens between ranks working on the same k-point, so separate k-point groups talk much less. This matters most for the default Davidson algorithm (ALGO = Normal), less for ALGO = Fast or VeryFast.
  • It costs memory. The orbitals are not distributed over the k-point groups, so each group holds its own copy of the data: KPAR = 1 has the smallest memory per core.

For a bulk system with a small cell (few bands, many k-points), the wiki's Optimizing the parallelization page says NCORE = 1 with KPAR equal to the number of k-points is optimal.

What about NSIM?

NSIM (default 4) is how many bands the RMM-DIIS algorithm optimizes together, and in places how many the blocked-Davidson algorithm and the force calculation work on at once; it lets VASP use faster matrix-matrix operations. The wiki says it should change only the speed, not the energy or the convergence. On GPUs, the wiki says the default of 4 is far too small, and values up to 32 may help.

What should I start with?

These are starting points from the VASP wiki's guidance, not settings to keep without testing. First fill your nodes: --ntasks-per-node equal to the cores per node (see How do I submit a job on SLURM?).

Your systemNCOREKPARWhy
Small bulk cell, many k-points1The number of irreducible k-points, if it divides the ranksThe wiki's optimum for few bands and many k-points.
About 100 atoms, a fast network4 (a factor of the cores per node)Up to the irreducible k-points, as memory allows, dividing the ranksNCORE = 4 is the wiki's rule of thumb for about 100 atoms.
More than about 400 atoms12 to 16 (a factor of the cores per node)As memory allows, dividing the ranks; start at 1The wiki's range for large cells; KPAR multiplies memory.
Up to about 8 cores, or a slow Gbit network1Up to the irreducible k-pointsFFT groups do not pay off without a fast network.
VASP with OpenMP threads or on GPUsIgnored (VASP sets 1)GPUs: the number of GPUs, if memory allowsThreads or the GPU split the FFTs instead (below).

Choose yours:

Your systemStart withWhy
Small bulk cell, many k-pointsNCORE = 1, KPAR = the irreducible k-pointsThe wiki's optimum for a bulk system with a small cell: few bands, many k-points. Pick a KPAR that divides both the k-points (from IBZKPT) and the ranks. The 8 below is an example.
About 100 atomsNCORE = 4, KPAR as memory allowsThe wiki's rule of thumb for about 100 atoms on a cluster with a fast network. NCORE must be a factor of the cores per node; raise KPAR toward the irreducible k-points while the memory fits and it divides the ranks. The 2 below is an example.
More than 400 atomsNCORE = 12 to 16, KPAR = 1The wiki says 12 to 16 is often better above 400 atoms. Choose the value in that range that divides the cores per node (16 on a 32- or 64-core node, 12 on a 48-core node). Keep KPAR low unless the memory allows more: it multiplies the memory.
Up to 8 cores or a slow networkNCORE = 1On up to about 8 cores or a Gbit Ethernet network, the wiki says FFT groups are inefficient. KPAR still helps if there are several k-points; it adds almost no communication. The 2 below is an example.

How many ranks in all? The wiki's rule of thumb for electronic minimization: aim for a rank count that is the default NBANDS divided by a small whole number, so the bands spread evenly without VASP adding many extra ones.

What it depends on:

  • The cores per node, which NCORE must divide (sinfo -o "%P %c" lists them per partition).
  • The number of irreducible k-points, which caps KPAR.
  • The memory per node, which KPAR multiplies and NCORE reduces (see How do I fix a job that ran out of memory?).
  • The network and the hardware: a fast interconnect, and how the cores are grouped into NUMA domains.

How do I test which setup is fastest?

The wiki's Optimizing the parallelization page gives a recipe. In short:

  1. List the tags that matter for your calculation (NCORE and KPAR, for most) and read their limits.
  2. Do a dry run. Run VASP with ALGO = None in the INCAR, or with the command-line argument --dry-run. VASP sets up the calculation without solving it (it plans the FFTs and builds the irreducible k-points) and writes the default NBANDS and the number of plane waves to OUTCAR, at almost no cost.
  3. Time a few candidates. Run each candidate for only a few electronic or ionic steps, not to convergence: on repetitive work, a few steps predict the whole run well. Use the same system (atoms, cell, cutoff) and the same hardware (CPU type, network, number of nodes) as the production run, or the result may not carry over.
  4. Keep the fastest for the production run, and for the similar runs that follow.

Read the timings from OUTCAR. The wiki points at the LOOP timer (each electronic step) and LOOP+ (each ionic step, including the forces):

Terminal
grep "LOOP+" OUTCAR

A small test for a 64-rank job might compare, at the same nodes and ranks:

TestNCOREKPAR
a41
b81
c42
d82

(A plan to fill in, not results.) Then, with the best of these, compare one node with two. Two numbers make the comparison concrete: the speed-up, the time on one node divided by the time on two; and the parallel efficiency, the speed-up divided by 2. A speed-up of 1.8 is an efficiency of 90%: almost all of the second node is doing useful work. A speed-up near 1 means the second node is mostly paying for communication. How much efficiency is worth your allocation is a question for you and your group.

Should I use OpenMP threads?

VASP can also be built to run several OpenMP threads per rank (threads share their rank's memory and work inside one node). The wiki's Combining MPI and OpenMP page names two cases where it helps:

  • Nodes with many cores, 64 or more, where the memory bandwidth and cache per core can limit the speed;
  • the GPU ports of VASP, which run best with one rank per GPU, so threads use the CPU cores left over.

With one thread per rank, the wiki says an OpenMP build runs no differently from an MPI-only one.

When you do use threads, three rules from the wiki:

  • NCORE is switched off. With more than one thread per rank, VASP sets NCORE = 1 whatever the INCAR says; the threads share the FFT work instead.
  • Do not oversubscribe. Ranks × threads must not exceed the node's physical cores (hyperthreading can show twice as many logical ones).
  • Pin the threads. Ranks and their threads should stay on fixed cores, close together. The wiki sets OMP_NUM_THREADS, OMP_PLACES=cores, OMP_PROC_BIND=close, and raises OMP_STACKSIZE (to 256 or 512 MB) to avoid crashes.

In a SLURM job, the threads per rank are --cpus-per-task, which sbatch and srun both know, and SLURM puts the value in SLURM_CPUS_PER_TASK:

Terminal
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=16
#SBATCH --cpus-per-task=4
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
export OMP_PLACES=cores
export OMP_PROC_BIND=close
export OMP_STACKSIZE=512m
srun --cpu-bind=cores vasp_std

This fills a 64-core node with 16 ranks of 4 threads. The wiki's own examples use mpirun with OpenMPI or Intel MPI; it names --cpu-bind=cores as SLURM's way to bind, and says to follow your computing center's own recommendations for binding ranks and threads. Treat this script as a starting point and check it against your cluster's documentation for hybrid MPI and OpenMP jobs before a long run.

Going further: NUMA domains, GPUs and a known issue

NUMA domains. A modern processor is several groups of cores, each with its own memory and cache; reaching another group's memory is slower. These groups are NUMA domains (non-uniform memory access). The wiki's example is a 32-core processor in four domains of 8 cores, where NCORE = 8 and KPAR = 4 (per node) is the place to start benchmarking. To see your node's layout, run lstopo or numactl --hardware on a compute node (inside a short job, not on the login node).

GPUs. The wiki's rules of thumb: one MPI rank per GPU, KPAR equal to the number of GPUs if memory allows, a larger NSIM (up to 32), and OpenMP threads for the parts still on the CPU. Small systems can run poorly on GPUs in standard DFT; GPUs pay off with many bands or atoms.

A rare hang with KPAR. The wiki's Known issues page lists a rare deadlock when KPAR is above 1 (entry dated 20 February 2026; first noticed in VASP 6.1.0, partly fixed in 6.6.0, with a patch for 6.5.x and 6.6.x): different k-point groups can, very rarely, make different decisions about stopping the electronic loop, and the job hangs. The page links a patch. If a KPAR job stops making progress without an error, this is one cause to rule out with whoever maintains VASP on your cluster.

What goes wrong?

MistakeWhat you would seeWhat to do
Leaving NCORE = 1 on a large cellSlow steps; high memory per rank.NCORE 4 for about 100 atoms, 12 to 16 above 400, a factor of the cores per node.
An NCORE that does not divide the cores per nodeBand groups that straddle nodes; FFT traffic over the network.Pick a factor of the cores per node (and of the ranks per node).
Both NCORE and NPAR in the INCARNPAR wins and your NCORE is ignored.Remove NPAR.
NPAR = 1Every rank on one band; the wiki says almost always very slow.Remove it and set NCORE.
KPAR above the irreducible k-pointsGroups with no k-points; wasted cores.At most the number of irreducible k-points (the entries in IBZKPT), ideally a divisor of it.
KPAR that does not divide the ranksUneven k-point groups.A divisor of nodes × tasks per node.
A large KPAR on a big cellOUT_OF_MEMORY (see How do I fix a job that ran out of memory?).Lower KPAR; the memory line in OUTCAR shows the difference.
Setting NCORE with OpenMP threadsNo effect: VASP sets NCORE = 1.Set the threads per rank instead.
Most of a node's cores left idleA slow job, with cores you asked for doing nothing.Fill the node with ranks unless memory per rank is the limit.
Two nodes slower than oneRanks placed across nodes, or too little work per rank.Check rank placement with your administrators; test again with fewer ranks.
Testing on a smaller system or other hardwareA setup that is fast in the test and slow in production.Test on the real system, cutoff and nodes, for a few steps.

Try it

Try it: find the parallel setting that does not fit

Each INCAR below goes with the same job: 2 nodes with 32 cores each and 32 tasks per node, so 64 MPI ranks. Each has one parallel setting that goes against the VASP wiki's advice. Choose the line you think it is.

Script 1.

# job: 2 nodes, 32 cores each, 32 tasks per node
KPAR  = 2
NCORE = 6

The problem is line 3, NCORE = 6: NCORE is the number of ranks that work together on one band. The wiki says it should be a factor of the number of cores per node, so the FFT communication inside each group stays within one node. 6 does not divide 32. A factor of 32, such as 4 or 8. The wiki recommends timing a few values on a short test before a production run.

Script 2.

# job: 2 nodes, 32 cores each, 32 tasks per node
KPAR  = 3
NCORE = 8

The problem is line 2, KPAR = 3: KPAR splits the ranks into groups that each work on their own k-points. The wiki says to choose it as an integer divisor of the total number of cores, and 64 ranks do not split into 3 equal groups. KPAR = 2 or KPAR = 4, which divide 64. The wiki also advises that KPAR should factorize the number of k-points.

Script 3.

# job: 2 nodes, 32 cores each, 32 tasks per node
KPAR  = 2
NCORE = 8
NPAR  = 4

The problem is line 4, NPAR = 4: For a given number of ranks, NCORE and NPAR are strict inverses of one another. The wiki says not to set both: if both are in the INCAR, NPAR takes precedence for legacy reasons, and it strongly encourages NCORE for all modern VASP versions. Delete the NPAR line.

Set up shows NCORE, KPAR and NPAR with their explanations beside the real tags, and Cluster and resources holds the nodes and ranks per node. Before you submit, pre-flight checks your parallel settings.