Cap’n Proto configuration schema¶
gpridge has two Cap’n Proto schemas. schema/params.capnp is the unified
schema that gprn --config reads, as a TOML file or as a binary message.
schema/gprd_params.capnp is the older dimer schema that gprd reads
through loadParametersFromCapnp; the
serialization how-to covers it. This page covers
the unified schema: how gprn loads it, the version and evolution rules,
and the checks that guard them.
Both encodings need a build with -Duse_capnp=true. The option defaults to
false. Without it, gprn --config FILE prints
--config requires a build with use_capnp=true and exits with status 1.
Choose an encoding¶
gprn picks the encoding from the file name. A path ending in .toml
(any case) is read as TOML. Any other path is read as a binary Cap’n Proto
message of params.capnp. The TOML loader fills the same message, so both
encodings pass through one reader, but the two do not combine with the
command line in the same way.
Encoding |
What the file supplies |
Precedence |
|---|---|---|
TOML ( |
Any key of the tables below. A key that is absent takes the schema default. |
The file is applied first and the command line is parsed after it, so an explicit flag replaces the file value. |
Binary ( |
The |
The covered fields overwrite the command-line flags. The endpoints, the potential name, the model and device, |
The TOML file may hold the top-level tables [band], [gp],
[uncertainty], [acquisition], [trust], [oracle], [run] and
[linalg]. The loader rejects any other table and any key that its table
does not list, with a message such as Unknown configuration key: band.foo.
TOML configuration keys lists every key, its
type, the flag that mirrors it and its default, and
Configuration files says how to write a file.
Two limits of the TOML encoding follow from the loader:
[band] modeacceptsstandard,aie,oie,gp_aieandgp_oie. It does not acceptgp_local; pass--nebmode gp_localon the command line.A value of the wrong type, a fraction for an integer key, and an integer outside the range of its key are errors.
Example: a TOML run with the linear-algebra options¶
The file sets the endpoints, a band of 8 intermediate images in the default
GP mode, and the three [linalg] keys. Each key mirrors a gprn flag, given
in the comments.
[run]
reactant = "reactant.con"
product = "product.con"
[band]
nimages = 8
mode = "gp_oie"
[linalg]
mode = "library" # --linalg-mode
threads = 4 # --linalg-threads
training_product = "scheme2:fp64" # --training-product-library
Check what the run will use before you start it. --dump-cli-args prints
every parsed option and exits with status 0:
gprn --config run.toml --potential lj --dump-cli-args | grep -E '^(linalg_|training_product)|^\[startup\] linalg'
linalg_mode=library
linalg_threads=4
training_product_library=scheme2:fp64
[startup] linalg mode=library threads=4
Without --dump-cli-args the same command runs the search.
[linalg] mode accepts reproducible (the default) and library. An unknown
mode, or threads below 1, is refused when the file loads, with
Unknown linalg.mode: NAME or linalg.threads must be at least 1.
Check run-to-run determinism says what
the two modes change.
Versions¶
InputParameters.schemaVersion names the schema revision the writer used.
The TOML loader stamps currentSchemaVersion. A message written before the
field existed reads as 1. A reader refuses a message whose version is newer
than its own, with both versions in the error, instead of dropping the new
fields.
Version |
Change |
|---|---|
1 |
The schema before |
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
Evolution rules¶
A field keeps its ordinal and its type for good.
A new field takes the next ordinal of its struct and a default that reproduces the behaviour without it;
currentSchemaVersionrises by one.A field is never renumbered, retyped or removed. A field that loses its meaning stays, documented as ignored.
schema/params.capnp.ordinals and schema/gprd_params.capnp.ordinals
record every field and enumerant. The tests test_capnp_evolution_params
and test_capnp_evolution_gprd_params run
scripts/check_capnp_evolution.py, which fails on a renumbered, retyped or
removed member and on a new member that the record lacks. Run the check on
the unified schema:
cd "$GPRIDGE_ROOT"
python3 scripts/check_capnp_evolution.py schema/params.capnp schema/params.capnp.ordinals
To record an addition, run the script with --write and inspect the diff.
It must hold only added lines:
python3 scripts/check_capnp_evolution.py --write schema/params.capnp schema/params.capnp.ordinals
git diff schema/params.capnp.ordinals
Potentials over RPC¶
The potential protocol (Potentials.capnp and the potserv server) belongs
to rgpot. gpridge uses the protocol’s PotentialConfig schema, which is why
a build with use_capnp=true also builds rgpot with with_rpc=true. The
serialization how-to describes what gpridge does with potentials.