GPU-Accelerated DFT with GPU4PySCF

by Jonathon Vandezande · Nov 19, 2025

GPUs have revolutionized the field of scientific computing, but electronic-structure methods like DFT have historically performed poorly on GPUs due to the complicated nature of the two-electron repulsion integrals (ERIs). The first reported use of a GPU for DFT was by Yasuda in 2007, who calculated the Coulomb matrix using Gauss-Rys quadrature on an NVIDIA GeForce 8800 GTX with a beta release of CUDA. However, the lack of fast double-precision arithmetic limited the accuracy of these calculations, with errors in the total energy of around 10–7 Hartree. These errors could be mitigated by performing only the initial iterations with the GPU or offloading the calculation of larger Coulomb matrix elements to the CPU, but this significantly limited the speedup.

In 2008, Ufimtsev and Martínez reported large speedups for the calculation of both the Coulomb and exchange s- and p-type ERIs using the GPU as a co-processor. This was followed by a direct-SCF implementation of the Coulomb and exchange matrix build that avoided the bandwidth limiting step of transferring the N4 ERI tensor from memory to the GPU. However, these matrices (both N2) still needed to be transferred to the CPU to complete the Fock build, limiting the potential performance gains of using a GPU.

The lack of d- and f-type functions limited early GPU-based DFT codes to organic molecules, and severely hampered the accuracy of the energies that were calculated. Extension to higher angular momentum basis functions often required meta-programming techniques. However, the complexity involved can limit the benefit of using GPUs, since GPUs are best at highly repetitive tasks with minimal branching. When normalized by the higher cost of running a GPU, early implementations often did not represent a significant economic benefit.

Since 2007 there have been a variety of commercial and academic GPU-DFT releases with varying success, including:

and many more packages have implemented GPU acceleration as an option. While the Rowan platform has offered limited GPU-based DFT in the past with an interface to TeraChem, we are happy to announce that we are offering much broader GPU-based DFT support via the addition of GPU4PySCF!

GPU4PySCF

DFT engine comparison

Figure 1: Time to compute a r2SCAN/def2-TZVP single point energy for a series of linear alkanes. PySCF and Psi4 used a c7a.4xlarge (16 vCPUs, 32 GiB RAM) instance while GPU4PySCF used an NVIDIA H200.

The recently released GPU4PySCF package calculates ERIs based on Rys quadrature, allowing straightforward implementation of high-angular-momentum functions and their derivatives (up to g-functions). This method provides a small memory footprint and high data locality, leading to more effective data caching. All of this makes for incredibly fast DFT calculations. When compared to Rowan’s CPU-based DFT engines (PySCF and Psi4), GPU4PySCF quickly outpaces CPU-based implementations (see appendix for a full list of CPU and GPU specifications).

GPU4PySCF is significantly faster than CPU-based engines, and Psi4 ran out of memory on the c7a.4xlarge node (32 GiB) after only 30 carbons. The acceleration is not limited to the latest GPU architectures; even the 5-year-old A100 GPUs show significant speedup vs CPU.

r2SCAN/def2-TZVP GPU hardware comparison

Figure 2: Time to compute a r2SCAN/def2-TZVP single point energy for a series of linear alkanes on various hardware. CPU calculations (grey dashed line) performed with Psi4 on a c7a.4xlarge node.

Interestingly, while CPU-based calculations are competitive with small GPUs on smaller molecules, the memory efficiency and batching implemented in GPU4PySCF allows small GPUs to calculate significantly larger systems, despite having less RAM (c7a.4xlarge: 32 GiB; A10 and L4: 24GB). The GPU results show two scaling regimes, excess RAM and batching, with a distinct elbow for many GPUs. Small systems do not saturate the RAM, and thus see minimal benefit from adding additional RAM, but there are significant speedups for larger systems when moving to GPUs with larger memory (e.g. A100-40GB → A100-80GB, see appendix for more GPU specs). Sadly, the current version of GPU4PySCF does not support the latest NVIDIA Blackwell architecture.

GPU-based DFT implementations have traditionally struggled with high-angular-momentum basis functions, reducing their usefulness for the large basis sets needed for highly accurate energetics. The double-ζ def2-SVP basis set is useful for initial explorations of the potential energy surfaces (PES), but triple-ζ or higher basis sets are typically recommended for accurate energetics.

Basisζspdfg
sto-3g121
def2-SVP2321
def2-TZVP35321
def2-QZVP474321

Table 1: Contracted Gaussian functions for carbon in basis sets of increasing size.

Unlike many historic GPU-based DFT implementations, GPU4PySCF can easily handle meta-GGA functionals, dispersion corrections, and high-angular-momentum functions, scaling better with basis set size than CPU-based algorithms.

GPU4PySCF DFT Acceleration across basis sets

Figure 3: Time to compute a r2SCAN single point energy with various basis sets for a series of linear alkanes on various hardware. CPU calculations (grey dashed line) performed with Psi4 on a c7a.4xlarge node.

The speedup trends for different size basis sets mirror the def2-TZVP results, with the Psi4 CPU timings being similar to 4-year-old A10 GPUs. def2-QZVP quickly saturates the RAM of smaller GPUs and there is significant benefit to moving to GPUs with more memory.

Modern range-separated hybrids like ωB97M-V are needed for the highest accuracy calculations, but have more complicated ERIs than pure functionals like the r2SCAN meta-GGA and global-hybrid functionals like B3LYP. (This is due to the adjustment of the Coulomb kernel (1r12\frac{1}{r_{12}}) in the exchange ERIs to smoothly interpolate from DFT exchange at short distances to HF exchange at larger distances.) Across basis sets and molecular systems, ωB97M-V is ≈1.5x slower than r2SCAN.

DFT functional timings with GPU4PySCF

Figure 4: Time to compute a r2SCAN single point energy with various basis sets for a series of linear alkanes on an H200 GPU.

GPU calculations are often on unfair footing, as modern GPUs are often significantly more expensive per hour. Indeed, Modal’s NVIDIA H200 instances are currently $4.54/hour compared to $0.82/hour for a c7a.4xlarge CPU node on AWS. Thus the total cost should also be considered, not just the acceleration, especially if a large number of jobs are intended to be run in an embarrassingly parallel manner.

Total cost of r2SCAN/def2-TZVP on various hardwares

Figure 5: Cost to compute a r2SCAN/def2-TZVP single point energy for a series of linear alkanes on various hardware. CPU calculations (grey dashed line) performed with Psi4 on a c7a.4xlarge node.

The increased computational power of A100 and H100/200 GPUs more than makes up for the increased cost. A100-80GB instances are the most economical for smaller systems, while H200s dominate for large systems due to A100-80GB saturating its memory. The benefits of H200 GPUs (141 GB of RAM) are even more pronounced when dealing with large basis sets, where memory saturation comes at smaller molecule sizes. The cost of c7a nodes is proportional to their memory (see appendix), and thus increasing the memory size to deal with larger systems or basis sets is particularly uneconomical.

Of course, there is no benefit to switching to GPU if the energies are incorrect. While early GPU implementations struggled with single-precision calculations, modern GPU implementations can achieve the same accuracy thanks to advances in 64-bit math support. The observed energy differences are less than the error typically seen from density fitting.

GPU vs CPU energy differences

Figure 6: Energy difference between CPU (PySCF) and GPU (GPU4PySCF) implementations. Note: def2-QZVP and def2-QZVPPD are almost perfectly overlapping in their errors.

Real-World Examples

So what does all of this mean for everyday calculations? For a small reaction like ethyl isocyanate + water, GPU4PySCF optimized the transition state with r2SCAN/def2-TZVP in 43 steps while taking 160 seconds, while Psi4 took 7x as long (GPU4PySCF was 15x faster when comparing wB97M-V/def2-QZVP timings).

For larger molecules, the speedup is even greater. The 78-atom HIV drug Maraviroc sees a speedup of 13x for a single point energy with r2SCAN/def2-SVP; larger basis sets could not be run with Psi4 without running out of memory (GPU4PySCF calculations with def2-TZVP were just 1.4x longer than for def2-SVP). These speedups also hold for organometallic species. A single-point energy of a 95-atom hydrocupration transition state (previously found with our double-ended-TS-search workflow) runs in 1 minute with ωB97M-D3BJ/vDZP on an H200 GPU, while Psi4 takes >50x longer. Beyond this size of system CPU-based methods consistently run out of RAM on the provided hardware; since the cost of AWS c7a nodes scales with the provided RAM, CPU-based DFT becomes especially unfavorable for larger systems.

Valinomycin (168 atoms) single point run with r2SCAN/def2-TZVP on an H200 GPU in <5 minutes.

The addition of GPU4PySCF to the Rowan platform significantly improves the speed of our DFT, unlocking new possibilities for large-scale and highly-accurate modeling. While we currently support only a fraction of the many features in GPU4PySCF, we look forward to adding more, such as support for excited states, advanced property prediction, and more. If you are interested in any specific properties, please reach out to us.

Appendix

Notes on Calculations

Linear alkanes were constructed as straight chains and optimized with GFN2-xTB.

All calculations were run using the Rowan Scientific platform. Psi4 and PySCF calculations were run using a c7a.4xlarge AWS instance with 16 vCPUs and 32 GiB of RAM.

GPU4PySCF calculations were run on Modal GPUs. GPUs were provisioned with a single vCPU and 4 GB RAM. All GPUs were initialized with an untimed r2SCAN/sto-3g energy calculation on methane to ensure the startup time was not included in calculations (for more, see the Modal documentation on cold starts). Obvious outliers were rerun in an ad hoc manner, and accounted for <5% of all jobs (outliers can occur due to the need to cloud providers changing GPUs and due to Modal occasionally upgrading GPUs).

CPU pricing for on on-demand node was obtained from Amazon's EC2 estimator on 2025-11-19.

GPU pricing was obtained from Modal's pricing page on 2025-11-19.

Node Specifications

GPUArchitectureRelease dateVRAM (GB)CUDA CoresFP64 (TFLOPS)FP32 (TFLOPS)Cost ($/hour)
T4Turing2018-091625600.2548.140.59
A10Ampere2021-042492160.97631.240.80
L4Ada2023-032474240.47330.291.10
L40SAda2023-0848181761.43191.611.95
A100-40GBAmpere2020-054069129.74619.492.10
A100-80GBAmpere2020-118069129.74619.492.50
H100Hopper2023-03801459225.61051.223.95
H200Hopper2023-111411689630.16060.324.54
CPU NodevCPUsRAM (GB)Cost ($/hour)
c7a.4xlarge16320.82112
c7a.8xlarge16641.64224
c7a.16xlarge161283.28448
c7a.32xlarge162566.56896
Banner background image

What to Read Next

GPU-Accelerated DFT

GPU-Accelerated DFT

the power of modern GPU hardware; GPU4PySCF on Rowan; pricing changes coming in 2026; an interview with Navvye Anand from Bindwell; using Rowan to develop antibacterial PROTACs
Nov 19, 2025 · Jonathon Vandezande, Ari Wagen, Corin Wagen, and Spencer Schneider
Rowan Research Spotlight: Emilia Taylor

Rowan Research Spotlight: Emilia Taylor

Emilia's work on BacPROTACs and how virtual screening through Rowan can help.
Nov 19, 2025 · Corin Wagen
GPU-Accelerated DFT with GPU4PySCF

GPU-Accelerated DFT with GPU4PySCF

A brief history of GPU-accelerated DFT and a performance analysis of GPU4PySCF, Rowan's newest DFT engine.
Nov 19, 2025 · Jonathon Vandezande
A Conversation With Navvye Anand (Bindwell)

A Conversation With Navvye Anand (Bindwell)

Corin interviews Navvye about pesticide discovery, the advantages that ML gives them, and what areas of research he's most excited about.
Nov 18, 2025 · Corin Wagen
Ion Mobility, Batch Docking, Strain, Flow-Matching Conformer Generation, and MSA

Ion Mobility, Batch Docking, Strain, Flow-Matching Conformer Generation, and MSA

a diverse litany of new features: ion-mobility mass spectrometry; high-throughput docking with QVina; a standalone strain workflow; Lyrebird, a new conformer-generation model; and standalone MSAs
Nov 5, 2025 · Corin Wagen, Ari Wagen, Eli Mann, and Spencer Schneider
Using Securely Generated MSAs to Run Boltz-2 and Chai-1

Using Securely Generated MSAs to Run Boltz-2 and Chai-1

Example scripts showing how Boltz-2 and Chai-1 can be run using MSA data from Rowan's MSA workflow.
Nov 5, 2025 · Spencer Schneider and Ari Wagen
Lyrebird: Molecular Conformer Ensemble Generation

Lyrebird: Molecular Conformer Ensemble Generation

Rowan's new flow-matching conformer-generation model, with benchmarks.
Nov 5, 2025 · Eli Mann
Predicting Ion-Mobility Mass Spectra Through Rowan

Predicting Ion-Mobility Mass Spectra Through Rowan

An introduction to the field, how Rowan's approach works, and where it might be useful.
Nov 5, 2025 · Corin Wagen
BREAKING: BoltzGen Now Live on Rowan

BREAKING: BoltzGen Now Live on Rowan

a new foray into generative protein-binder design; what makes BoltzGen different; experimental validation; democratizing tools; running BoltzGen on Rowan
Oct 27, 2025 · Corin Wagen, Ari Wagen, and Spencer Schneider
The "Charlotte's Web" of Density-Functional Theory

The "Charlotte's Web" of Density-Functional Theory

A layman's guide to cutting your way through the web of DFT functionals, explaining GGAs, mGGAs, hybrids, range-separated hybrids, double hybrids, and dispersion corrections.
Oct 27, 2025 · Jonathon Vandezande