Native ABIs, Rust crates and data formats¶
This page lists the native libraries GPRidge calls through C interfaces,
the C interfaces it exposes for plugins, the one Rust crate in the tree, and
the file formats it reads and writes. The stamp checks and their messages
are on Native library ABI checks. The C
API of libgpridge itself is on the C API page.
What a build links¶
gprn and gprd print one [startup] abi line per library when a run
starts. gprn --dump-cli-args prints the same lines without running a
search:
gprn --dump-cli-args | grep '^\[startup\] abi '
GPRidge accepts rgmin C ABI major 1, minor 43 or later. The in-tree rgmin wrap currently pins a revision that declares ABI 1.52 with layout revision
That minor’s changelog does not include
rgmin_bfgs_hessian_updateor
rgmin_sr1_hessian_update. The build accepts each symbol when the header
declares it. Once Saddle tags the minor that adds the export, the minor
floor has to require it. A skipped update returns
RGMIN_HESSIAN_UPDATE_SKIPPED. Callers compare that name. Upstream
reserves 7 for RGMIN_NOT_CONVERGED, so the carried name is 8. BFGS skips
when y·s or |sᵀ B s| is at most 1e-12. SR1 skips when an entry of s
or y is non-finite, when δ·s is non-finite, when |δᵀs| is at most
1e-12, or when |δᵀs| is below 1e-8 ‖δ‖ ‖s‖. δ·s is the ndarray dot.
A build with that wrap, readcon-core
and readcon-db and without the Rust core of rgpot prints the stamps below.
rgmin is required, so every build lists it; a missing rgmin is a configure
error.
gprn --dump-cli-args | grep '^\[startup\] abi '
[startup] abi library=rgmin header=1.77/7 loaded=1.77/7 status=verified
[startup] abi library=readcon-core header=1.1/1 loaded=1.1/1 status=verified
[startup] abi library=readcon-db header=1.3/1 loaded=1.3/1 status=verified
[startup] abi library=rgpot-core header=no_rgpot.h_(rgpot_built_without_the_Rust_core) loaded=no_stamp status=UNVERIFIED
[startup] abi library=gpridge header=2/920/1064 loaded=2/920/1064 status=verified
The stamps depend on the revisions pinned in subprojects/*.wrap and on the
build options, so another build prints other numbers. A library that is not
part of the build is listed as not built, never left out. UNVERIFIED does
not stop a run; a mismatch does. gprd was run on a build that prints the
UNVERIFIED line above and went on to read its input.
From Python, abi_report() returns the same lines and check_abi() raises
gpridge.ABIError, a RuntimeError, that names both stamps when a loaded
library disagrees with its header:
import gpridge
lines = gpridge.abi_report()
assert any(line.startswith("[startup] abi library=gpridge ") for line in lines)
gpridge.check_abi()
Reference¶
Native libraries called through C ABIs¶
Library |
Used for |
Checked |
|---|---|---|
rgmin |
minimisers behind the hyperparameter fit, lowest eigenpair |
major 1, minor 43 or later at compile time; header and loaded stamps at start |
readcon-core |
|
header and loaded stamps at start |
readcon-db |
observation archive (LMDB-backed CON frames), dimer trace corpus |
header and loaded stamps at start |
rgpot-core |
potentials |
header and loaded stamps at start, when the build has |
rgsaddle |
band and saddle sessions, the index-1 test of a converged saddle |
major 1, minor 71 or later; the library is linked at build time |
anneal, minimage |
box-ensemble stage, minimum-image distances |
through their C headers ( |
The libraries are Meson subprojects pinned in subprojects/*.wrap. rgsaddle
is linked (ABI major 1, minor 71 or later). RgsaddleClient::load checks
that stamp. gprn --rgsaddle-library and RGSADDLE_LIBRARY store the
index-test selection. The linked library runs the test.
Rust crate¶
rust/gpridge-sys is a -sys crate: bindgen generates the declarations
from gpr/capi/gpridge_c.h and the crate links the installed
libgpridge. It does not build the C++ core and does not call
gpr_abi_check itself, so a program that uses it calls that function once
at start. The crate is described on the Rust page. A CI job
runs its test; no job publishes it.
Plugin ABIs gpridge implements¶
ABI |
Symbols |
Version |
Errors |
|---|---|---|---|
rgpot engine ( |
|
|
0 success, positive recoverable, negative fatal; |
Training product |
|
|
status plus caller-supplied message buffer |
stdpar environment kernels |
|
|
status plus caller-supplied message buffer |
libgpr_engine puts the learning GP behind the generic rgpot engine C ABI,
so that eOn and ASE can hold the surrogate as an ordinary potential
(comment at the target in meson.build). It checks an AOTInductor model
package against the host CPU when it is created. The units are Angstrom for
positions, eV for energy and eV/Angstrom for forces (rgpot_engine_c_abi.h).
The base symbols are rgpot_engine_abi_version, _available, _create,
_destroy and _force. eOn’s loader resolves four of them
(rgpot_engine_abi_version, _create, _destroy, _force). The library
also exports rgpot_engine_abi_stamp, which returns ABI 1.11, layout
revision 1, the stamp of the header copy (RgpotEngineAbiStamp.cc). The
engine loader of the pinned rgpot reads that fifth symbol. It accepts major 1
and layout revision 1 when the plugin minor is at most the host minor (11). A
library without the symbol is served as 1.0, layout revision 1, without the
later optional symbols. A newer minor, for example “engine ABI stamp 1.12
(layout 1) cannot serve host stamp 1.11 (layout 1)”, or a different major or
layout, is refused. gpr/potentials/EnginePotential.cpp reads that stamp with
the same rule. Minor 7 adds rgpot_engine_unload_policy. Minor 11 adds
rgpot_engine_set_cache, rgpot_engine_cache_counts,
rgpot_engine_taylor_jet, RgpotEngineDerivativeReport and the trailing
RgpotEngineCaps.jet_order field. The host reads jet_order only when the
plugin’s caps size covers it, calls rgpot_engine_hvp only when
analytic_hvp is set, and honours the unload policy only from minor 7.
GprEngineLoaderContractTest.cpp fails when the library drops one of the
five symbols or reports another stamp.
_force_batch, _model_state, _set_callbacks, _hint and
_neighbor_options are optional; a host finds them with dlsym.
A training-product library is what --training-product-library PATH
loads; libgpr_scheme2_product is the in-tree implementation over the CPU
Scheme II engines. Symbols outside these sets are hidden. See
Training matrix products for the
products and Use an rgpot engine plugin for the
engine plugins that gprn and gprd load.
Data formats¶
Format |
Written by |
Read back by |
Test |
|---|---|---|---|
|
|
readcon-core |
|
Observation archive |
every oracle call, with |
readcon-db, per-image model selection |
the archive cases in |
HDF5 band file |
|
HDF5, h5py, |
|
The observation archive needs a readcon-db build; without one, gprn exits
with status 2 unless the option is off (help text of the option). The
dimer’s trajectory corpus (gprd --gp-dimer-trace) is also a readcon-db
corpus.
The band itself is readcon output: gprn --write-con frames with energies
and forces, the run summary on the first frame under neb_summary, the same
frames in the .corpus beside it, and the training set in the observation
archive. gprn --output holds the per-outer GP trace by default (root
attribute schema = gprn-gp-trace/2, /trace/<outer>/ with band energies,
measured mask, NEB force norms, acquisition variance, hyperparameters and
oracle calls; global_gp/ only with --trace-band-history true), no file
with --gp-trace false, and --full-h5 true writes the whole band in the
shared NEB band layout instead (schema = neb-band/1): /path/{images, gradients} as (n_images, 3N), /path/{energies,f_para,rxn_coord},
/metadata/{atomic_numbers,cell,converged,oracle_calls,max_energy_image},
2-D /training/, /summary/ and /trace/, every row a whole structure.
Files of older runs carry /converged/<image>/ instead; only readers read
that layout.
test_h5_dump writes nested 1-D and 2-D datasets, an integer dataset and
the schema attribute, reads them back through the HDF5 C API bit for bit,
and checks that a rewrite replaces one dataset and keeps the others.
The command line as an interface¶
gprn takes every option on the command line, and --dump-cli-args prints
the resolved values. gprd has no --dump-cli-args; it exits with
“unrecognized option”. The CLI reference is
generated from the option tables. gprn --config reads options from TOML or
a Cap’n Proto message (schema page).