Repository navigation
Running on the GPU
A job uses the GPU when one with compute capability 7.0 or newer is present and the system has more than 100 atoms (MOPAC_FORCEGPU=1 lowers this to any size). Smaller jobs run on the CPU, where they are fast enough.
| Calculation | On the GPU | On the CPU |
|---|---|---|
| MOZYME | SCF loop, initial orbitals, one-electron matrix, gradient, dispersion and H-bond corrections, COSMO, MM_CHARGES terms |
set-up, one-centre terms |
Conventional SCF, solids with Tv
|
one-electron matrix, two-centre Fock terms, diagonalization, pseudo-diagonalization, gradient | one-centre terms, far periodic images |
| Conventional SCF, molecules ≥ 300 orbitals | Fock matrix; diagonalization from 400 basis functions; gradient | the rest |
| Jobs of 100 atoms or fewer | — (unless MOPAC_FORCEGPU=1) |
everything |
| QM/MM with OpenMM | OpenMM, the long-range QM–MM part (CuPy), MOPAC for QM regions above 20 atoms | MOPAC for QM regions of up to 20 atoms (link atoms included) |
The electronic state (orbitals, density, Fock matrix) stays in device memory between geometry steps of an optimization, a dynamics run or a frequency calculation.
| Keyword or environment variable | Effect |
|---|---|
| (nothing) | Use the GPU when one with compute capability ≥ 7.0 is present and the job has more than 100 atoms |
NOGPU (keyword) |
This job on the CPU code path |
MOPAC_NOGPU=1 |
Every job from this shell on the CPU |
MOPAC_FORCEGPU=1 |
Use the GPU for jobs of 100 atoms or fewer too. It does not bring the MOZYME GPU path back when the input says NOGPU
|
MOPAC_PDIAG=0 |
No pseudo-diagonalization in the conventional SCF (full diagonalization every iteration) |
MOPAC_GPU_DEBUG=1 |
Print the detected GPUs, the settings and the GPU trace lines (see below) in the output |
MOPAC_GPU_PROFILE=1 |
Device timings of the stages |
MOPAC_GPU_GRAD_CHECK=1, MOPAC_GPU_HCORE_CHECK=1, MOPAC_GPU_DISP_CHECK=1
|
Evaluate the GPU and the CPU version of a stage and print the difference (slow; for testing) |
MOPAC_DETERMINISTIC=1 |
cuBLAS without atomics |
MOPAC_HB_SMOOTH_BONDS=0 |
With HB-SMOOTH: smooth only the angular terms of the PM7 / PM6-DH+ H-bond correction, not the bonds of the H-bond and dispersion corrections (those run on the CPU; the angular terms alone also run on the GPU) |
CUDA_VISIBLE_DEVICES=1 |
Pick the GPU (standard CUDA) |
QM/MM has its own switches (where each step's SCF starts, which parts run on the GPU); they are listed in docs/QMMM_OPENMM.md (Details and limits, Speed).
By default a GPU run adds only the messages of fallbacks and aborts to the output. With MOPAC_GPU_DEBUG=1 (or the keyword DEBUG) MOPAC also writes its GPU trace lines, among them, for a MOZYME job:
[MOZYME GPU] resident SCF enabled by default (disable with NOGPU or MOPAC_NOGPU=1)
[MOZYME GPU SCF] status=success reason=backend_complete code=0 iterations=42
status=success: the SCF ran on the GPU. A line with status=fallback_cpu is always written, with or without
MOPAC_GPU_DEBUG: something did not fit or did not converge on the device, and the CPU code finished the SCF from the
current state; the result is correct, at CPU speed. The reason follows on the same line.
The orbital rotations of the MOZYME SCF run in parallel and their order depends on timing, so two GPU runs of the
same input differ at the level of the SCF criterion (typically 0.01 kcal/mol at the default criterion, 5·10⁻⁵ with
SCFCRT=1.D-6). For energy differences that matter at 0.1 kcal/mol, use a tight criterion.
Device memory grows with the system: in the benchmarks 2–4 GiB up to 2 000 atoms, 8.9 GiB for a 6 689-atom protein,
28.6 GiB for a 21 156-atom water cluster (A100, 40 GB). Several MOPAC processes can share one GPU (see the parallel
FORCE example).
Barranquilla MOPAC is an independent derivative of MOPAC (Apache License 2.0), not affiliated with or endorsed by MolSSI or Virginia Tech. Repository · Releases
Examples