Where the time goes¶
A GP-accelerated search trades oracle calls for GP work, so it pays only if the GP work costs less than the calls it removes. The split of wall time between the oracle, the GP hyperparameter fits and the control code decides where effort is worth spending. This page gives one measured split, describes the code path that dominates the GP side, and states how the distributed kernels keep their arithmetic fixed.
Status: explanation. Every timing on this page comes from a file under
bench/ that is named next to it. The numbers describe one system on one
host with one MPI rank. They are not a statement about other systems, oracles
or rank counts. To measure your own run, see
Find where a search spends its time.
One measured split¶
The benchmark fixture map_lbfgs_hssvd_rrr_preemd of the d016 campaign runs
gprd on the system d016. The campaign records are kept with the project’s
benchmark archive, not in this source tree. The input bench_data/petmad/d016_pos.con holds 5 carbon and 9
hydrogen atoms, and the oracle is the PET-MAD-S 1.5.0 potential named in the
campaign configuration. The run uses one MPI rank, the MAP
uncertainty mode, the map_lbfgs hyperparameter mode and these flags:
--gp-hssvd true --gp-no-output-norm true --gp-hssvd-dual-lapack-rrr true --dimer-imspe-history-size 0 --dimer-pre-oracle-emd-near-skip true --profile-dimer-times true. The three trials ran on one workstation. All
three reached the endpoint -7.18349 eV after 12 outer iterations.
The table gives the mean of the three trials. The values are the columns
accurate_wall_s, gp_optimize_wall_s, gp_predict_wall_s,
other_control_wall_s and wall_internal_s of the
campaign’s summary.csv. The same means appear in the benchmark ledger row
for suite examples:d016_hssvd_maplbfgs. Shares are fractions of the internal wall time
and are rounded to 0.1 %.
Component |
Calls |
Mean wall (s) |
Share |
|---|---|---|---|
Accurate oracle calls |
26 |
2.691 |
54.7 % |
GP hyperparameter optimisation |
13 |
2.183 |
44.4 % |
GP prediction |
341 |
0.007 |
0.1 % |
GP fixed-theta refresh |
0 |
0.000 |
0.0 % |
Search control and geometry |
0.036 |
0.7 % |
|
Internal wall time |
4.916 |
The internal wall time varies by 0.013 s (standard deviation over the three
trials, as in summary.md). The oracle and the hyperparameter optimisation
together take 99.1 % of it. One accurate call costs 0.103 s on average and one
hyperparameter optimisation costs 0.168 s; both ratios are computed from the
table.
The split has these limits.
It holds for one 14-atom system and one oracle. A cheaper oracle moves the split towards the GP, and a more expensive one moves it towards the oracle. The ratio belongs to the pair of oracle and surrogate.
The external wall time, measured around the process, is 7.119 s on average (
wall_external_s). The CSV does not break down the difference to the internal time.The ledger marks this arm as
current-recordwithin a parity-screened set of arms. Arms that needed a thirteenth outer iteration were screened out and have no timings.
What the timers cost¶
The arm map_lbfgs_hssvd_rrr_preemd_profile of the same fixture adds
--profile-energy-split true --profile-gradient-split true. Its internal wall
time is 5.677 s (standard deviation 0.059 s) against 4.916 s, and its GP
optimisation takes 2.922 s against 2.183 s
(the campaign’s summary.md). The fine-grained
timers add work to every objective evaluation. They serve attribution, not
wall-time comparison.
The path of one hyperparameter evaluation¶
The hyperparameter fit calls evaluateEnergyAndGradient once per optimizer
iteration. On the dense path the call assembles the training covariance,
factorises it and then builds the gradient with respect to each
hyperparameter:
evaluateEnergyAndGradient(w, x, x_ind, y) gpr/ml/gp/EnergyGradient.cpp
setParameters(w)
evaluateEnergy(x, x_ind, y)
decomposeCovarianceMatrix(x, x_ind) gpr/ml/gp/Decompose.cpp
evaluateTrainingCovarianceMatrix assemble K (SexpatCF, ConstantCF, noise)
Cholesky factorisation
calculateMeanPrediction(y) solve for the weights
half log determinant and prior terms
evaluateGradient(x, x_ind, y, gradient)
calculateGradientWithCovFunc one derivative matrix per hyperparameter
With \(n\) observations and \(D\) moving coordinates the joint covariance has \((D+1)\,n\) rows, one energy row and \(D\) gradient rows per observation. The Cholesky factorisation costs \(O\big(((D+1)\,n)^3\big)\) operations. For \(n=40\) and two moving atoms (\(D=6\)) the matrix has 280 rows. The assembly and the derivative matrices of the gradient add distance computations over observation pairs and atom pairs.
Two other routes skip this chain.
With
--gp-hssvdand the HS-SVD objective contractions on, the evaluation uses aTrainingKernelGeometrybuilt once per fit and reused by every evaluation of that fit, because the block geometry does not depend on the hyperparameters (GaussianProcessRegression::fitGeometryFor).The local-LOO objective mode evaluates each held-out geometry with its own small dense solve and bypasses the full-training geometry.
The covariance and gradient kernels are described in Joint energy-force Gaussian process.
Choosing the objective solver¶
The training covariance is accessed through
gpr::linalg::linop::CovarianceSolver. The dense implementation answers
four questions with the Cholesky factor: the solve against the observations,
the log determinant, the quadratic form and the diagonal of the posterior
variance term. It caches the inverse and returns it only when the new factor
equals the stored factor entry for entry, so a hit returns the bits that a
recomputation would give (gpr/linalg/linop/CovarianceSolver.h).
The hyperparameter objective uses the dense solver by default. A C++ caller selects another backend on a configured GP instance. No command-line option or parameter field exposes the choice.
using Backend = gpr::GaussianProcessRegression::ObjectiveBackend;
gp.setObjectiveBackend(Backend::Auto);
Auto takes the Krylov backend when its planned operation count, derived from
the pivot residual of the last dense factor, the noise floor and the fit
tolerances, is lower than the dense factorisation. Krylov requests the
approximate backend with a given preconditioner rank, and Dense restores
exact evaluation. A negative rank throws std::invalid_argument. Both
approximate choices need a dense training covariance
(GaussianProcessRegression.h).
The Krylov backend answers the same four questions with preconditioned
batched conjugate gradients, stochastic Lanczos quadrature for the log
determinant and Gaussian probes for Hutchinson traces
(gpr/linalg/linop/Krylov.h). The objective value then carries stochastic
error. Judge the choice by the search outcome and the oracle count as well as
by the objective timing.
GP inference and GPU execution¶
A GP trained on energies and all free Cartesian gradients has
n_train * (1 + 3 * n_free_atoms) observation channels before constraints
or compression. Matrix order, conditioning and the number of prediction
right-hand sides determine the useful GPU workload. The number of
geometries alone does not describe its cost.
Method |
GPRidge interface |
Numerical question |
|---|---|---|
Dense Cholesky |
|
Factor and solve residuals, likelihood gradients, force predictions and variance |
Krylov objective |
C++ |
Iteration residuals and the stochastic objective/trace error budgets |
Random Fourier features |
|
Held-out force and posterior errors of the finite feature representation |
Atomic inducing posterior |
Error from restricting the inducing span, including derivative uncertainty |
|
Computational uncertainty |
C++ |
Uncertainty from unexplored linear-solve directions |
The dense backend controls factorization and related linear algebra.
--training-product-library separately selects supported matrix
contractions. --device cuda selects the oracle’s device. These controls
affect different parts of a search, so an accelerated potential does not
establish accelerated GP inference. The GPU guide gives the allocation,
product diagnostics and kernel-tuning commands.
The Krylov objective uses a dense Eigen covariance operator. IterGP also accepts a dense Eigen matrix. Selecting cuSOLVER for the dense backend does not move those operator applications and their iteration state onto the device. GPU inference measurements must identify covariance assembly, operator application, preconditioning, factorization, solves, variance and host/device transfers separately.
Blackbox Matrix-Matrix inference (BBMM) batches iterative solves and likelihood calculations around kernel matrix products. Its usefulness depends on iteration count and preconditioning. Derivative-aware structured kernel interpolation and inducing directional derivatives address the growth in derivative channels with approximations to the covariance or posterior. Their assumptions require checking against GPRidge’s inverse-distance kernel and its Cartesian pullback. A Cartesian RBF gradient example uses different input coordinates and derivatives.
A comparison starts from identical observations, hyperparameters, noise and prediction geometries. Report matrix order, retained rank, precision, memory, iteration/probe counts, residuals, force error and predictive variance error with fit and prediction timings. Repeat the complete dimer or NEB search with the same oracle and stopping settings. The oracle call count, measured force and independent Hessian check remain part of the result. An approximate objective, an approximate kernel and a truncated linear solve have distinct error sources; a faster matrix product alone does not quantify them.
Reproducible distributed kernels¶
The default --linalg-mode reproducible of gprn and gprd runs the
distributed Cholesky factorisation, triangular solves and inverse with fixed
tile dimensions and a fixed arithmetic order. The help text of the option
states that these operations return the same bits at every rank and thread
count. --linalg-mode library calls the ScaLAPACK or SLATE routines with
threaded BLAS, and its rounding can depend on the process grid and on the BLAS
implementation.
In reproducible mode the canonical products, Gram products, factors and solves
call a private Eigen instantiation in libgpr_canonical_tiles that does not
depend on the BLAS configuration of the caller. On x86-64 hosts that report
AVX-512F and FMA, in builds that use neither an AVX-512 baseline nor
EIGEN_USE_BLAS, full 64-by-64 tile updates use wider vector lanes over
independent output columns and keep the ascending inner index of the compiled
kernel. Partial tiles and other processors use the compiled Eigen kernels
(gpr/linalg/TileProduct.h). The tests in
tests/gpr/linalg/TileProductTest.cpp compare every bit of products, factors
and solves, including partial tiles and strided results.
Symmetric eigenpairs are reduced to a canonical basis so that OpenBLAS and the
reference LAPACK give the same one: eigenvalues inside the backward error of
zero are set to zero, each vector’s first largest-magnitude entry is made
positive, and a cluster that the backward error cannot separate is ordered
lexicographically (gpr/linalg/CanonicalEigen.h).
The build option deterministic_reductions governs the separate helper
ordered_sum_bcast. Its default gathers the rounded partial sums, adds them in
rank order in long double and broadcasts the result. A different rank count
can change the partial sums and so the rounded result. The value false
uses MPI_Allreduce. Where a result is a sum of products, exact_sum_bcast
reduces ExactSum accumulators (a Kulisch long accumulator) across ranks and
rounds once, so the result does not depend on how the addends are partitioned
over ranks and threads, provided each addend is itself a deterministic
double (gpr/linalg/ExactSum.h). The settings and the check for repeatable runs are
in Check run-to-run determinism.
Measuring scaling¶
Rounding differences between rank counts can change the optimizer trajectory and with it the amount of work. A strong-scaling comparison therefore holds the inputs, the optimizer work and the stopping rules fixed, and reports a changed iteration or oracle count separately from parallel efficiency. Compare complete fits or searches, record their evaluation counts and report repeated wall measurements with their spread. Agreement across ranks on one CPU family tests the partition dependence. Agreement across CPU families tests portability.