chemparseplot.parse.surrogate.gpr_optim#
Parsers for the artifacts of gpr_optim campaign records.
A record is <record>/<set>/<cell>/ holding result.json,
band/{band.h5,gprn.log,obs-archive/kernel.txt,mlflow.run.json} and, for
dimer cells, saddle/mlflow.run.json. The MLflow file store sits at
<record>/mlruns. h5py is imported on use.
.. versionadded:: 1.10.0
Module Contents#
Functions#
Hex SHA-256 of a file, streamed. |
|
Group the |
|
Read an MLflow file-store run: |
|
Add the dimer stage to a band ledger so that it sums to the search calls. |
|
Build a :class: |
|
Collect every |
|
Project rows of |
|
Path coordinate of the foot point of each row of |
|
Flat Cartesian positions (A) of an eOn |
|
Atomic numbers of the first frame of a geometry file. |
|
Fill |
|
BandHistory from a band and its training set ( |
|
Band from gpridge’s readcon output: |
|
Band from an HDF5 file: older gpridge |
|
Parse one benchmark cell into a :class: |
|
Strong-scaling table from per-repetition wall times. |
|
Distinct |
|
Rows of |
|
Per-layout means of efficiency columns from a fixed-work CSV. |
|
Fixed-work factors and wall per layout as a :class: |
|
Median seconds per component from a tidy CSV as a :class: |
|
Median seconds of each component stage per cell and layout. |
Data#
API#
- chemparseplot.parse.surrogate.gpr_optim._TAG#
‘compile(…)’
- chemparseplot.parse.surrogate.gpr_optim._LEDGER#
‘compile(…)’
- chemparseplot.parse.surrogate.gpr_optim.MATCH_TOLERANCE#
0.02
- chemparseplot.parse.surrogate.gpr_optim.PAIR_WINDOW_MS#
5000
- chemparseplot.parse.surrogate.gpr_optim.SPECTRUM_BATCH_CALLS#
20
- chemparseplot.parse.surrogate.gpr_optim._MIN_TOKENS#
2
- chemparseplot.parse.surrogate.gpr_optim.sha256_file(path: str | pathlib.Path) str[source]#
Hex SHA-256 of a file, streamed.
- chemparseplot.parse.surrogate.gpr_optim.parse_gprn_log(path: str | pathlib.Path) dict[str, list[dict]][source]#
Group the
[tag] key=value ...lines of agprn/gprdlog by tag.Bare words after the keys (
rejected) are kept underflags. Lines of other shapes are skipped.
- chemparseplot.parse.surrogate.gpr_optim.read_mlflow_metrics(run_dir: str | pathlib.Path) dict[str, dict[str, numpy.ndarray]][source]#
Read an MLflow file-store run:
name -> {time_ms, value, step}.
- chemparseplot.parse.surrogate.gpr_optim._locate_run(cell: pathlib.Path, sub: str, mlruns: pathlib.Path | None) pathlib.Path | None[source]#
- chemparseplot.parse.surrogate.gpr_optim._tail(path: pathlib.Path, nbytes: int = 1 << 17) str[source]#
- chemparseplot.parse.surrogate.gpr_optim._add_dimer_calls(rec: chemparseplot.parse.surrogate.model.CellRecord, cell: pathlib.Path) None[source]#
Add the dimer stage to a band ledger so that it sums to the search calls.
- chemparseplot.parse.surrogate.gpr_optim.parse_gpr_optim_result(result_json: str | pathlib.Path) chemparseplot.parse.surrogate.model.CellRecord[source]#
Build a :class:
CellRecordfrom a cell’sresult.json.
- chemparseplot.parse.surrogate.gpr_optim.parse_gpr_optim_campaign(record_dir: str | pathlib.Path, name: str | None = None) chemparseplot.parse.surrogate.model.CampaignTable[source]#
Collect every
<set>/<cell>/result.jsonof a record.
- chemparseplot.parse.surrogate.gpr_optim._kernel(path: pathlib.Path) dict[source]#
- chemparseplot.parse.surrogate.gpr_optim._search_from_log(log: dict[str, list[dict]], tol, converged) chemparseplot.parse.surrogate.model.SearchHistory | None[source]#
- chemparseplot.parse.surrogate.gpr_optim.project_on_path(points: numpy.ndarray, path: numpy.ndarray, coord: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray][source]#
Project rows of
pointsonto the polylinepath.Returns the path coordinate of the foot point and the Cartesian distance (norm over all coordinates, in the unit of
path) to it.
- chemparseplot.parse.surrogate.gpr_optim._projection(points: numpy.ndarray, path: numpy.ndarray, coord: numpy.ndarray) numpy.ndarray[source]#
Path coordinate of the foot point of each row of
points.
- chemparseplot.parse.surrogate.gpr_optim._read_saddle(path: pathlib.Path) numpy.ndarray | None[source]#
Flat Cartesian positions (A) of an eOn
.confile; None when unreadable.
- chemparseplot.parse.surrogate.gpr_optim.read_atom_types(path: str | pathlib.Path, n_atoms: int | None = None) numpy.ndarray[source]#
Atomic numbers of the first frame of a geometry file.
.con/.convelsymbols come from :mod:chemparseplot.parse.eon.con_ioand are mapped withase.data.atomic_numbers. Other suffixes stay onase.io.read.Raises
ValueErrornaming the file when it cannot be read or when its atom count differs fromn_atoms.
- chemparseplot.parse.surrogate.gpr_optim._find_atom_types(cell: pathlib.Path, band: chemparseplot.parse.surrogate.model.BandHistory) None[source]#
Fill
band.numbersfrom the cell’s own geometry files, in order.
- chemparseplot.parse.surrogate.gpr_optim._band_history(band, obs, events) chemparseplot.parse.surrogate.model.BandHistory[source]#
BandHistory from a band and its training set (
band_h5records).A band read from
band.conholds every atom while the training rows hold the moving atoms only (frozen atoms are not GP coordinates); the band is then cut to its moving atoms so both share one coordinate space.
- chemparseplot.parse.surrogate.gpr_optim._band_from_readcon(band_dir: pathlib.Path, events) chemparseplot.parse.surrogate.model.BandHistory[source]#
Band from gpridge’s readcon output:
band.con(or its corpus) and the training set inobs-archive/training.
- chemparseplot.parse.surrogate.gpr_optim._band_from_h5(h5_path: pathlib.Path, events) chemparseplot.parse.surrogate.model.BandHistory[source]#
Band from an HDF5 file: older gpridge
band.h5or--full-h5.
- chemparseplot.parse.surrogate.gpr_optim._dimer_from_mlflow(run: pathlib.Path, tol, converged) chemparseplot.parse.surrogate.model.SingleEndedHistory | None[source]#
- chemparseplot.parse.surrogate.gpr_optim.parse_gpr_optim_cell(cell_dir: str | pathlib.Path, *, mlruns: str | pathlib.Path | None = None) chemparseplot.parse.surrogate.model.SurrogateSearch[source]#
Parse one benchmark cell into a :class:
SurrogateSearch.Parameters
cell_dir
<record>/<set>/<cell>. mlruns MLflow store root; defaults to<record>/mlruns.
- chemparseplot.parse.surrogate.gpr_optim.parse_scaling_csv(wall_csv: str | pathlib.Path, counts_csv: str | pathlib.Path | None = None, *, stage: str = 'pipeline', cells: list[str] | None = None)[source]#
Strong-scaling table from per-repetition wall times.
wall_csvhas columnscell, ranks, threads, repetition, stage, seconds, calls;counts_csv(optional)cell, ranks, threads, repetition, passed. One series per cell, one point perranks x threadslayout (x = cores), time = median over repetitions with min and max kept, calls = median, and a point is capped when any of its repetitions haspassedfalse.
- chemparseplot.parse.surrogate.gpr_optim.pop_csv_cells(path: str | pathlib.Path) list[str] | None[source]#
Distinct
cellvalues of a fixed-work CSV, in file order.Nonewhen the file has nocellcolumn: its rows then belong to whichever cell the caller draws.
- chemparseplot.parse.surrogate.gpr_optim._pop_rows(path, cell)[source]#
Rows of
cell(every row without a cell column), as dicts.A named cell the file does not hold is an error that lists the cells it does hold, so a label that differs from the wall table cannot vanish.
- chemparseplot.parse.surrogate.gpr_optim.parse_pop_csv(path: str | pathlib.Path, metrics: list[str], *, cell: str | None = None) tuple[list[str], dict[str, numpy.ndarray]][source]#
Per-layout means of efficiency columns from a fixed-work CSV.
The file needs
ranksandthreadscolumns; each name inmetricsis a column of fractions. Withcellgiven and acellcolumn present, only that cell’s rows count, and a cell the file lacks is an error naming the cells it has. Rows of one layout are averaged; layouts sort by cores, then threads.
- chemparseplot.parse.surrogate.gpr_optim.parse_pop_factors(path: str | pathlib.Path, metrics: dict[str, str] | list[str], *, time: str = 'elapsed_s', quantity: str = 'process wall', cell: str | None = None)[source]#
Fixed-work factors and wall per layout as a :class:
PopTable.metricsmaps a column of fractions to the label it is drawn with (a list uses the column names as labels);timenames the column of the wall in seconds, from which speedup and fixed-work efficiency follow, andquantitysays what that column measures for the axis label. Rows of one layout are averaged. The cell rule is that of :func:parse_pop_csv.
- chemparseplot.parse.surrogate.gpr_optim.parse_components_csv(path: str | pathlib.Path, *, total: str = 'total', cells: list[str] | None = None)[source]#
Median seconds per component from a tidy CSV as a :class:
ComponentTable.Columns
cell, ranks, threads, repetition, component, seconds; the component namedtotalis the whole wall of that run and every other component a non-nesting part of it. Repetitions of one cell and layout are reduced to their median. A requested cell the file lacks, and a run without atotalrow, are errors.
- chemparseplot.parse.surrogate.gpr_optim.parse_breakdown_csv(wall_csv: str | pathlib.Path, components: list[str], *, total: str | None = 'pipeline', cells: list[str] | None = None) dict[str, tuple[list[str], dict[str, numpy.ndarray], numpy.ndarray | None]][source]#
Median seconds of each component stage per cell and layout.
Returns
{cell: (layouts, {component: seconds}, total_seconds)}with layouts sorted by cores then threads.totalnames the stage holding the whole (Nonefor no total). The components should not nest.