mfsig.com
gpugpu4pyscfdensity-fittingperformance5 min read

GPU DFT for σ-profiles, what changes and what does not

A GPU changes wall time, memory limits and libraries. It does not change the functional, the basis, the cavity or the σ-profile beyond the last digits.

Updated November 28, 2026

Moving a DFT calculation from a CPU to a GPU changes how fast it runs, how much memory it can use and which software executes it. It does not change the functional, the basis set, the solvation model or the σ-profile, beyond differences in the last floating-point digits that come from summing numbers in a different order. A sigma profile computed on a GPU under a pinned recipe is the same scientific object as one computed on a CPU under the same recipe. What the GPU buys is the ability to apply an expensive recipe to many molecules.

What a GPU is good at, and why DFT fits

A GPU runs thousands of simple arithmetic units in lockstep. It excels at dense linear algebra, where the same multiply-add is applied to large blocks of numbers, and at numerical integration over regular grids.

Most of a hybrid DFT calculation can be written as the first kind of work. The exchange-correlation energy is a sum over grid points of a function of the density and its derivatives, which parallelises trivially. The Coulomb and exchange matrices, once density fitting is applied, are contractions of three-index tensors with the density matrix. The continuum model's surface charge is the solution of a dense linear system whose size is the number of segments. All of these map onto a GPU with little change in the mathematics.

The one piece that does not fit well is the conventional four-centre integral, with its irregular shell structure and heavy branching. That is why density fitting is not optional on a GPU. The guide on density fitting explained describes the approximation and its small, systematic error.

What changes

Wall time is the obvious change. For a hybrid functional with density fitting and a few hundred basis functions, the exchange build and the VV10 kernel dominate on a CPU, and both move almost entirely onto the GPU.

Memory is the second change, and it works against you. A GPU has far less memory than a server's main memory, and three-index tensors for density fitting grow with the square of the basis size times the auxiliary size. Codes work around this by batching over auxiliary functions or by recomputation. A molecule that fits comfortably in CPU memory can require careful batching on a GPU.

Numerical precision deserves attention. DFT for an SCF converged to 1e-6 Eh needs double precision throughout the Fock build. Some GPU codes offer mixed precision, with single-precision integrals in early iterations and double precision near convergence. That is a legitimate strategy when the final iterations are in full precision, and a recipe should say whether it is used.

The software stack changes too. The open-source gpu4pyscf project extends PySCF with GPU implementations of density-fitted SCF, hybrid and meta-GGA functionals including VV10, and continuum solvation. A calculation set up in PySCF moves to the GPU with a small change in the code.

from pyscf import gto
from gpu4pyscf import dft

mol = gto.M(atom=geometry, basis="def2-svp")
mf = dft.RKS(mol, xc="wb97m-v").density_fit(auxbasis="def2-svp-jkfit")
mf.conv_tol = 1e-6
mf.kernel()
mf_cpu = mf.to_cpu()

The last line converts the result back to the CPU implementation for post-processing.

What does not change

The recipe is unchanged. ωB97M-V on a GPU is the same functional, with the same VV10 kernel and the same range-separation parameter. def2-SVP with def2-svp-jkfit is the same basis and auxiliary basis. C-PCM with ε = 80 on a cavity of modified Bondi radii scaled by 1.2 with 302 Lebedev points per atom is the same cavity. The MFsig production recipe on the recipes page is defined by those choices and not by the hardware.

The results agree to many decimal places. A GPU sums the contributions to each integral and each matrix element in a different order from a CPU, and floating-point addition is not associative, so the last digits differ. For an SCF converged to 1e-6 Eh, those differences are orders of magnitude below the threshold. For a σ-profile they are invisible in the histogram, the σ-moments and the recorded energies.

What a reader should check is not whether the hardware changed the chemistry, but whether the recipe stayed pinned when the hardware changed. The temptation when porting a pipeline to a GPU is to adjust the auxiliary basis, loosen a threshold or switch to a cheaper grid to fit memory. Each of those is a recipe change and deserves a new recipe version, as the guide on what a DFT recipe is and why it must be pinned argues.

Provenance for a GPU run

A reproducibility record names the software that actually executed the calculation. For a GPU run that means the GPU library and its version in addition to the quantum-chemistry package, all read at run time rather than copied from a plan. A .mfsig file records package versions read at run time for this reason. Device model and driver version help when they are available.

The guide on pinned software versions in science explains why "latest" is not a method, and the guide on a reproducibility checklist for computational chemistry lists what else the record must hold.

A worked example with caffeine

Take caffeine, SMILES Cn1cnc2c1c(=O)n(C)c(=O)n2C. It has 24 atoms and, in def2-SVP, a few hundred basis functions. Run the production recipe once with PySCF on a CPU and once with gpu4pyscf on a GPU, starting from the same ETKDG geometry.

The total energies agree to well beyond the sixth decimal in hartree. The HOMO and LUMO energies in solvent agree to the same degree. The screening charges on corresponding segments agree to many digits, and the σ-profile histograms are indistinguishable. The content hash of the two output files would differ only if the files recorded the package versions, which they should, and the chemistry would be identical. The hardware is part of the provenance, not part of the result.

Key points

  • A GPU changes wall time, memory limits and software, not the functional, basis, cavity or σ-profile.
  • Density fitting is what makes hybrid DFT run well on a GPU, by turning integrals into dense contractions.
  • CPU and GPU results differ in the last floating-point digits, far below the SCF threshold and the σ bin width.
  • Porting a pipeline must not silently change the recipe. Any adjustment to fit the hardware is a new recipe version.
  • Provenance for a GPU run names the GPU library and its version, read at run time.

Questions people ask

Does running DFT on a GPU change the result?
Not in any way that matters for a σ-profile. The equations, the functional, the basis and the solvation model are the same. Floating-point sums are evaluated in a different order on a GPU, so energies agree with a CPU run to many decimal places rather than to the last bit. That difference is far below the SCF convergence threshold and the σ bin width.
Why does density fitting matter so much on a GPU?
Because density fitting turns the electron-repulsion problem into dense matrix contractions, which is what a GPU does best. Conventional four-centre integrals are irregular and branch heavily, which suits a GPU poorly. Nearly every GPU DFT code for hybrid functionals is therefore built around density-fitted Coulomb and exchange.
What should a provenance record contain for a GPU calculation?
The same items as for a CPU calculation plus the GPU library and its version, read at run time. The recipe is unchanged, but the software that executed it is different, and a reproducibility record must name the software that actually ran. Device model and driver version are useful additions when they are available.

Further reading

In practice: The production recipe on mfsig.com (ωB97M-V, def2-SVP, C-PCM at ε = 80, modified Bondi radii scaled by 1.2) is published in full on the recipes page, so each choice discussed here can be checked against what actually runs.

Generate a σ-profile from your SMILES

Free converter for a profile you already have, a reference-grade DFT run with its provenance record when it has to be defensible.