Benchmarks and checks

The benchmark and check-suite modules. Most are run as python -m zvdvc.bench.<name>; see Benchmarks and Testing zvDVC on your own machines.

zvdvc.bench.check

Local check suite: zvdvc check {quick,gpu,full}.

zvDVC’s GPU code cannot be tested on hosted CI, so this runs on your own machine. Each tier includes the one before:

tier

runs

time

quick

the test suite without GPU and slow tests (the CUDA emulator included)

~3 min

gpu

-m gpu tests and zvdvc selftest

~5 min

full

-m slow tests; the kernel benchmark and, with case A data, the central grid (4 680 points) on fused and cpu, again on fused with a 1-voxel prefilter, and an 86 k point 3D grid on fused

~5 min

Results go to runs/check/<UTC time>-<commit>[-dirty]/check.json (and runs/check/latest) and are compared with this machine’s baseline, docs/benchmarks/baselines/<machine>.json ($ZVDVC_MACHINE, default the host name), which is committed. Its reference result arrays live in runs/check/baseline/. --update-baseline --reason "..." records a new one.

Rules:

  • Accuracy fails the check. Tests and selftest must pass; kernel sums must be within 1e-4 of float64; case A results must agree with the baseline arrays (status on >= 99.9 % of points, |du| <= 1e-3 voxel) and with CCPi no worse than the baseline (median and p95 +0.005 voxel, status agreement -0.2 %). Bit-identical results are expected but only warned about, and only when the software fingerprint matches the baseline’s.

  • Speed is compared on the same hardware only, and not while other processes use the GPU. Kernel timings warn at 20 % slower and fail at 40 %, end-to-end timings at 25 % and 50 %, each widened to 3x the timing’s coefficient of variation at baseline. Back-to-back runs differ by up to ~18 % on a workstation GPU (clocks, temperature), so the limits catch real regressions (the ones this suite exists for were 2-20x), not drift. More than 20 % faster is reported.

Case A data comes from --case-a DIR or $ZVDVC_CASE_A. Without it the case A steps are skipped (result PASS (partial); --require-case-a makes that a failure) and the kernel benchmark uses a synthetic volume, which has its own baseline entries.

class zvdvc.bench.check.Step(name: 'str', status: 'str' = 'pass', seconds: 'float' = 0.0, detail: 'str' = '', metrics: 'dict[str, dict[str, float]]' = <factory>, arrays: 'dict[str, str]' = <factory>)[source]

Bases: object

Parameters:
name: str
status: str = 'pass'
seconds: float = 0.0
detail: str = ''
metrics: dict[str, dict[str, float]]
arrays: dict[str, str]
class zvdvc.bench.check.Finding(metric: 'str', status: 'str', detail: 'str')[source]

Bases: object

Parameters:
metric: str
status: str
detail: str
zvdvc.bench.check.repo_root()[source]

The source tree whose tests run: the git checkout, else $ZVDVC_SRC, the container’s copy, or cwd.

Return type:

Path

zvdvc.bench.check.out_root(src)[source]

Where runs/check goes: $ZVDVC_CHECK_OUT, else the source tree if writable (a checkout), else cwd.

Parameters:

src (Path)

Return type:

Path

zvdvc.bench.check.baseline_dir(src)[source]

$ZVDVC_BASELINE_DIR (e.g. shared storage on a cluster), else the checkout’s docs/benchmarks/baselines.

Parameters:

src (Path)

Return type:

Path

zvdvc.bench.check.git_info(root)[source]
Parameters:

root (Path)

Return type:

dict[str, Any]

zvdvc.bench.check.fingerprint()[source]

Hardware (decides whether timings compare) and software (decides whether results should be bit-identical).

Return type:

dict[str, Any]

zvdvc.bench.check.gpu_state()[source]

Other processes on the GPU (they make timings meaningless), and clocks/temperature for the record.

Return type:

dict[str, Any]

zvdvc.bench.check.cuda_headers_finding(cupy)[source]

CuPy’s CUDA headers must be the same CUDA version as its NVRTC, or its CUB reductions fail to compile.

With a conda cupy used without activating the environment, CuPy falls back to a system CUDA whose headers are older than the environment’s NVRTC (incomplete type "__nv_fp8_e8m0").

Parameters:

cupy (Any)

Return type:

Finding

zvdvc.bench.check.nvrtc_cuda_include(cupy)[source]

The CUDA include directory CuPy actually passes to NVRTC, observed by compiling a throwaway kernel.

(CuPy decides it in compiled code, and it can differ from cupy.cuda.get_cuda_path().)

Parameters:

cupy (Any)

Return type:

str | None

zvdvc.bench.check.preflight(tier)[source]
Parameters:

tier (str)

Return type:

tuple[list[Finding], dict[str, Any]]

zvdvc.bench.check.pytest_step(name, marker, run_dir, root)[source]
Parameters:
Return type:

Step

zvdvc.bench.check.junit_counts(path)[source]
Parameters:

path (Path)

Return type:

dict[str, int]

zvdvc.bench.check.selftest_step(run_dir)[source]
Parameters:

run_dir (Path)

Return type:

Step

zvdvc.bench.check.kernel_step(case_a, cache, run_dir)[source]
Parameters:
Return type:

Step

zvdvc.bench.check.casea_step(case_a, cache, run_dir, baseline, ccpi_disp=None, *, prefilter_sigma=0.0)[source]

The central grid (CCPi’s 4 680 points, wavefront, in memory) on fused and cpu; fused only when prefiltered.

Parameters:
Return type:

Step

zvdvc.bench.check.compare_with_baseline_arrays(path, base_path)[source]
Parameters:
Return type:

Finding

zvdvc.bench.check.e2e_step(case_a, cache)[source]
Parameters:
Return type:

Step

zvdvc.bench.check.perf_group(metric)[source]
Parameters:

metric (str)

Return type:

str | None

zvdvc.bench.check.compare(metrics, baseline, *, same_hardware, gpu_busy, cpu_busy=False)[source]

Findings for every metric against the baseline (pure: unit-tested in tests/test_check.py).

Parameters:
Return type:

list[Finding]

zvdvc.bench.check.overall(steps, findings, *, require_case_a)[source]
Parameters:
Return type:

str

zvdvc.bench.check.sha256(path)[source]
Parameters:

path (Path)

Return type:

str

zvdvc.bench.check.bitwise_findings(steps, baseline, same_software)[source]
Parameters:
Return type:

list[Finding]

zvdvc.bench.check.baseline_path(root, machine)[source]
Parameters:
Return type:

Path

zvdvc.bench.check.write_baseline(root, machine, report, steps, reason, ccpi_disp, out=None)[source]

Baseline JSON in baseline_dir(); its arrays under out/runs/check/baseline, paths relative to out.

Parameters:
Return type:

Path

zvdvc.bench.check.load_baseline(root, machine, out=None)[source]
Parameters:
Return type:

dict[str, Any] | None

zvdvc.bench.check.run(tier, *, case_a=None, cache=None, machine=None, update_baseline=False, reason='', require_case_a=False, ccpi_disp=None)[source]
Parameters:
  • tier (str)

  • case_a (str | None)

  • cache (str | None)

  • machine (str | None)

  • update_baseline (bool)

  • reason (str)

  • require_case_a (bool)

  • ccpi_disp (str | None)

Return type:

tuple[str, dict[str, Any]]

zvdvc.bench.check.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

int

zvdvc.bench.check.add_arguments(p)[source]
Parameters:

p (ArgumentParser)

Return type:

None

zvdvc.bench.check.cmd(args)[source]
Parameters:

args (Namespace)

Return type:

int

zvdvc.bench.smoke

zvdvc selftest: check an installation end to end on a small synthetic case.

  1. Reports the environment: package versions, numba, cupy and GPUs, the CCPi dvc.

  2. Writes a 96^3 affine phantom (about 30 s).

  3. For every backend available here (cpu with numba, fused and cupy with a GPU, else numpy), runs plan -> seed -> run -> finalize through the pipeline and checks accuracy against ground truth (>= 99 % GOOD, RMSE <= 0.02 voxel).

  4. With a GPU, checks that the GPU backends agree with the CPU engine (<= 1e-3 voxel, >= 99.9 % status agreement: the M2 parity criterion).

  5. With CCPi dvc available ($ZVDVC_CCPI_DVC or on PATH), runs the head-to-head comparison on the same case.

Exit code 0 when every check passes. The summary ends with a PASS/FAIL table; --out keeps the case, stores and reports for inspection.

zvdvc.bench.smoke.environment()[source]
Return type:

dict[str, Any]

zvdvc.bench.smoke.available_backends(env)[source]
Parameters:

env (dict[str, Any])

Return type:

list[str]

zvdvc.bench.smoke.run(out, *, backends=None, ccpi=True)[source]
Parameters:
Return type:

tuple[bool, dict[str, Any]]

zvdvc.bench.smoke.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

int

zvdvc.bench.case_a

Case A: the iDVC example dataset against CCPi, as iDVC runs it (docs/MVP_PLAN.md, Q1 and Q5).

Data

Zenodo record 7363345 (“Dynamic X-ray CT of Synthetic magma for Digital Volume Correlation analysis”, P. Lee, Y. Lavallée, B. Bay), whose two .npy volumes (1520 x 1257 x 1260 u8) are presumed to be CCPi’s frame_000 / frame_010. CCPi’s own test files for them (dvc_test/dvc_input.txt, central_grid.roi, and a reference completed_central_grid.disp, which holds only 5 of the 4 680 points) come from TomographicImaging/DigitalVolumeCorrelation.

Steps:

python -m zvdvc.bench.case_a fetch --data data/magma
python -m zvdvc.bench.case_a run --data data/magma --out runs/case_A \
    --ccpi-exe ~/miniforge/envs/ccpi/bin/dvc --backends fused cpu

run builds the zvDVC config from CCPi’s dvc_input.txt (same subvolume, search and start point), checks the volumes’ layout, and hands over to zvdvc.bench.compare_ccpi.compare(), which times CCPi as iDVC launches it and zvDVC, and writes report.md / report.json.

Use ccpi-dvc 22.0.0 as the reference (docs/benchmarks, M0: the 25.0.0 conda build’s tricubic path is broken). Pass the 25.0.0 binary as a second --ccpi-exe to time what a fresh iDVC install runs today.

zvdvc.bench.case_a.grid_points(spacing, box=((50.0, 212.0, 150.0), (1474.0, 1028.0, 1110.0)))[source]

(point_id, xyz) of a regular 3D grid over box; the point nearest the centre comes first.

CCPi and the wavefront start from the first point, so a central start keeps shells compact.

Parameters:
Return type:

tuple[ndarray, ndarray]

zvdvc.bench.case_a.data_dir(arg=None)[source]

The case A data directory: arg, else $ZVDVC_CASE_A; None if neither holds the volumes.

Parameters:

arg (str | Path | None)

Return type:

Path | None

zvdvc.bench.case_a.cache_dir(arg=None)[source]

Where C-ordered .raw copies of the volumes are kept: arg, $ZVDVC_CASE_A_CACHE or runs/case_A.

Parameters:

arg (str | Path | None)

Return type:

Path

zvdvc.bench.case_a.fetch(data, *, all_files=False)[source]

Download the Zenodo volumes (.npy only unless all_files) and CCPi’s test files into data.

Parameters:
Return type:

dict[str, str]

zvdvc.bench.case_a.case_config(data, out)[source]

CCPi’s dvc_input.txt, with the Zenodo volumes and zvDVC’s output locations.

Parameters:
Return type:

RunConfig

zvdvc.bench.case_a.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.ccpi_baseline

Run the CCPi dvc executable (conda package ccpi-dvc) on a zvDVC case.

Writes dvc_in + .roi equivalent to the zvDVC config (zvdvc.io.ccpi.write_dvc_input()), converts volumes to .raw if needed, runs dvc with OMP_NUM_THREADS set, and measures points per second from wall-clock time (the .stat figure is kept alongside). For clouds too large for CCPi’s O(N^2) neighbour sort, it runs a random sample of points and extrapolates, recording that it did so.

It also sweeps OMP_NUM_THREADS (1, 2, 4, …, cores) to record CCPi’s intra-point scaling, and runs P concurrent processes on disjoint point subsets to get the best throughput achievable from one CPU node without code changes. That is the fair “CCPi as shipped” baseline.

The executable is found from $ZVDVC_CCPI_DVC or dvc on PATH. Use ccpi-dvc 22.0.0 (conda install -c ccpi ccpi-dvc=22.0.0). The 25.0.0 conda build (h2bc3f7f_0) has a broken tricubic path: seeded at the exact fractional displacement of a pure translation it walks 1-2 voxels away, while trilinear, and tricubic in 22.0.0 and 21.2.0, stay within 0.002 voxel (docs/benchmarks/2026-09-25-M0-M1-case-S.md). Command line:

python -m zvdvc.bench.ccpi_baseline CONFIG --workdir DIR [--threads 1 2 4] [--processes 1 2] [--max-points N]
class zvdvc.bench.ccpi_baseline.BaselineResult(points: 'int', seconds: 'float', points_per_second: 'float', omp_threads: 'int', processes: 'int', sampled: 'bool', disp_path: 'Path', stat_points_per_second: 'float | None' = None)[source]

Bases: object

Parameters:
  • points (int)

  • seconds (float)

  • points_per_second (float)

  • omp_threads (int)

  • processes (int)

  • sampled (bool)

  • disp_path (Path)

  • stat_points_per_second (float | None)

points: int
seconds: float
points_per_second: float
omp_threads: int
processes: int
sampled: bool
disp_path: Path
stat_points_per_second: float | None = None
zvdvc.bench.ccpi_baseline.find_dvc(exe=None)[source]
Parameters:

exe (str | Path | None)

Return type:

Path

zvdvc.bench.ccpi_baseline.ccpi_ready_config(cfg, workdir)[source]

cfg with volumes CCPi can read: OME-Zarr is exported once to workdir/{ref,def}.raw.

Parameters:
Return type:

RunConfig

zvdvc.bench.ccpi_baseline.run_ccpi(cfg, *, workdir, omp_threads, processes=1, max_points=None, seed=0, exe=None)[source]
Parameters:
Return type:

BaselineResult

zvdvc.bench.ccpi_baseline.thread_counts(cores=None)[source]
Parameters:

cores (int | None)

Return type:

list[int]

zvdvc.bench.ccpi_baseline.thread_sweep(cfg, *, workdir, max_points=200)[source]
Parameters:
Return type:

list[BaselineResult]

zvdvc.bench.ccpi_baseline.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.compare_ccpi

Head-to-head against CCPi dvc (the engine iDVC runs) on one case: speed and agreement.

Timed runs, each on the same machine, points and settings:

ccpi <v> iDVC

dvc as iDVC launches it: one process, OpenMP on every core.

ccpi <v> xP

P concurrent dvc processes on disjoint point subsets (1 thread each): the best a node gets from CCPi without code changes.

zvdvc <b> parity

whole volumes in memory, CCPi point order (wavefront), in this process: read + solve, the like-for-like number.

zvdvc <b> cli

zvdvc plan / seed / run / finalize as separate processes: what a user waits for, start-up (imports, kernel compilation) included.

Agreement: zvDVC against each CCPi result point by point (the Q1 criteria: median |du| <= 0.05, p95 <= 0.2, status agreement >= 98 %), against a reference .disp if given, and against ground truth for synthetic cases.

Command line:

python -m zvdvc.bench.compare_ccpi CONFIG --out runs/compare [--ccpi-exe DVC [DVC ...]]
    [--ccpi-processes 4] [--backends cpu fused] [--reference-disp REF.disp] [--truth truth.npz]
class zvdvc.bench.compare_ccpi.TimedRun(name: 'str', points: 'int', seconds: 'float', detail: 'dict[str, Any]' = <factory>, results: 'str | None' = None)[source]

Bases: object

Parameters:
name: str
points: int
seconds: float
detail: dict[str, Any]
results: str | None = None
property points_per_second: float
zvdvc.bench.compare_ccpi.dvc_version(exe)[source]

The version dvc reports in its manual (e.g. v22.0.0-19-gb0e2642), else the conda package folder.

Parameters:

exe (str | Path)

Return type:

str

zvdvc.bench.compare_ccpi.run_ccpi_variants(cfg, out, exe, *, processes, max_points, reuse=False, idvc_launch=True)[source]

CCPi as iDVC launches it (one process, every core) and as processes one-thread processes.

idvc_launch=False skips the first: CCPi’s results do not depend on its thread count (bit-identical with cube subvolumes), and one thread is faster for small clouds, so a campaign can run several cases side by side on one thread each.

Parameters:
Return type:

list[TimedRun]

zvdvc.bench.compare_ccpi.run_zvdvc_parity(cfg, out, backend, *, alt_seed=False)[source]

The in-memory wavefront solve in CCPi’s point order, timed.

With alt_seed, a second, untimed solve uses the next template seed (other sample points in every subvolume): the spread between the two is zvDVC’s own sample-set spread, which the revised Q1 criterion compares the CCPi difference against.

Parameters:
Return type:

TimedRun

zvdvc.bench.compare_ccpi.run_zvdvc_cli(cfg, out, backend)[source]

plan / seed / run / finalize as separate processes, each timed, start-up included.

Parameters:
Return type:

TimedRun

zvdvc.bench.compare_ccpi.agreement(ours, theirs, *, shape_xyz=None, reach=None, ours_alt=None)[source]

Point-by-point agreement of our results with a CCPi .disp, overall and split into interior and edge.

With shape_xyz and reach (template extent + stencil), points whose subvolume leaves the volume at CCPi’s displacement are “edge” (zvdvc.bench.metrics.edge_mask()): CCPi reads wrapped or unset data there instead of failing, so Q1 is judged on the interior.

Parameters:
Return type:

dict[str, Any]

zvdvc.bench.compare_ccpi.revised_q1(a, b, alt, ia, ib, sel)[source]

Q1 as revised on 2026-09-27 (docs/MVP_PLAN.md): no bias, and a spread no larger than zvDVC’s own.

Two correct solvers that sample each subvolume at different random points disagree by their sample-set spread (docs/benchmarks/2026-09-26-error-floor-case-A.md), so the difference to CCPi is judged against zvDVC’s difference to itself with another template seed, on points GOOD in all three.

Parameters:
Return type:

dict[str, Any]

zvdvc.bench.compare_ccpi.compare(cfg, out, *, ccpi_exes, ccpi_processes=4, backends, cli=True, reference_disp=None, truth=None, max_ccpi_points=None, title='CCPi vs zvDVC', reuse_ccpi=False, idvc_launch=True)[source]
Parameters:
Return type:

dict[str, Any]

zvdvc.bench.compare_ccpi.markdown(report)[source]
Parameters:

report (dict[str, Any])

Return type:

str

zvdvc.bench.compare_ccpi.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.error_floor

Error floor on real data: known sub-voxel shifts of a crop of the iDVC case A reference.

There are no repeat scans of an unloaded sample for case A, so the floor is measured by displacing a real image by a known amount and correlating it against itself:

  • A crop inside the sample (chosen by foreground fraction) is shifted by a fractional translation s along x and along the (1, 1, 1) diagonal, 0 to 1 voxel in steps of 0.1, with scipy.ndimage.shift (quintic B-spline, mirror boundaries). zvDVC interpolates with Catmull-Rom cubics, a different interpolant, so the test does not grade the solver with its own model (“inverse crime”).

  • one-sided: ref = I, def = shift(I, s), so only the deformed image is resampled; symmetric: ref = shift(I, -s/2), def = shift(I, +s/2), so both are smoothed alike and the systematic (interpolation) error separates from the resampling’s smoothing.

  • Independent Gaussian noise is added to ref and def at 0, 0.5, 1 and 2 times the scan’s own noise, estimated from the crop (Immerkær’s Laplacian estimator, slice by slice). The scan’s own noise is common to ref and def (it moves with the image), so the zero-added-noise rows measure interpolation and model error only.

  • Subvolume size (40, 60, 80) and sample count (1000 to 8000) are swept, with CCPi’s case A settings otherwise (6-DOF, ZNSSD, tricubic). Points lie on a grid whose spacing is the subvolume size, so their errors are independent.

For each case: bias (mean error per axis), random error (standard deviation per axis), RMSE, fraction GOOD, and iterations. A sanity check correlates the crop with itself (displacement must be 0).

Shifted copies of one image have no deformation inside a subvolume and share the scan’s noise, so they bound only part of the error. The seed repeatability test solves the real pair (CCPi’s central grid) several times, changing only the template’s random seed, and reports the spread: the uncertainty that comes from which sample points each subvolume uses.

Command line (about 20-40 min on a GPU):

python -m zvdvc.bench.error_floor --case-a runs/case_A_data --out runs/error_floor
python -m zvdvc.bench.error_floor --quick ...      # a few cases, for a smoke test
class zvdvc.bench.error_floor.Case(shift: 'float', direction: 'str', variant: 'str', noise_factor: 'float', size: 'float', n_samples: 'int')[source]

Bases: object

Parameters:
shift: float
direction: str
variant: str
noise_factor: float
size: float
n_samples: int
zvdvc.bench.error_floor.estimate_noise(vol, n_slices=16)[source]

Gaussian noise sigma by Immerkær’s method (fast noise variance estimation, 1996), averaged over z slices.

Parameters:
Return type:

float

zvdvc.bench.error_floor.choose_crop(volume, shape_zyx, size, stride=8)[source]

Origin (z, y, x) of the cubic crop of side size with the most foreground (Otsu threshold on a subsample).

Parameters:
Return type:

tuple[int, int, int]

zvdvc.bench.error_floor.case_a_crop(case_a, cache, size)[source]
Parameters:
Return type:

tuple[ndarray, dict[str, Any]]

zvdvc.bench.error_floor.shifted(coeffs, shift_xyz)[source]

The image moved by shift_xyz (content at c appears at c + shift), from quintic B-spline coefficients.

Parameters:
Return type:

ndarray

zvdvc.bench.error_floor.grid_points(shape_zyx, size, margin)[source]

Points (x, y, z) spaced by the subvolume size, whose subvolumes stay margin inside the crop.

Parameters:
Return type:

ndarray

zvdvc.bench.error_floor.solve(ref, deformed, points, subvolume, engine)[source]
Parameters:
Return type:

Any

zvdvc.bench.error_floor.stats(status, disp, truth, n_iter)[source]
Parameters:
Return type:

dict[str, Any]

zvdvc.bench.error_floor.run(image, *, out, backend, shifts=(0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0), directions=('x', 'diagonal'), variants=('one-sided', 'symmetric'), noise_factors=(0.0, 0.5, 1.0, 2.0), sizes=(40.0, 60.0, 80.0), n_samples=(1000, 2000, 4000, 8000), workers=8, seed=0, progress=<built-in function print>)[source]
Parameters:
Return type:

dict[str, Any]

zvdvc.bench.error_floor.seed_repeatability(cfg, point_id, xyz, *, seeds=(0, 1, 2), backend='fused', progress=<built-in function print>)[source]

Spread between solves of the real pair that differ only in the template’s random seed.

Each seed draws a different set of sample points in every subvolume. On real data, with deformation that is not rigid within a subvolume and two independent acquisitions, the result depends on that set; this is the uncertainty the shifted-image cases above cannot see. It is also the disagreement to expect with CCPi, which draws its own sample set.

Parameters:
Return type:

dict[str, Any]

zvdvc.bench.error_floor.summary(report)[source]

The report’s headline tables: bias against shift, random error against settings, and noise scaling.

Parameters:

report (dict[str, Any])

Return type:

dict[str, Any]

zvdvc.bench.error_floor.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.public_datasets

zvDVC and iDVC’s engine on public validation datasets (docs/validation/datasets.md).

Datasets

DVC Challenge 1.0 (Croom et al., Exp. Mech. 61:395, 2021; UVA Dataverse doi:10.18130/V3/1UOVKO, CC0), system XCT1: a syntactic-foam cylinder, 350 x 300 x 504 u16 at 17.86 um, scanned twice more in place (Repeat1/2: the noise floor), after a 1 mm stage move along the rotation axis (Axial1/2) and one across it (Radial1/2). No field is imposed, so there is no ground truth: the repeats should give zero displacement, the moves a near-uniform one.

DVC Challenge 2.0 (Tong et al., 2026; NIST doi:10.18434/mds2-4129), the synthetic bead volumes of J. Yang (512 x 512 x 192 u8): Yang_Beads_S2, a uniform translation along y of 0.0, 0.1, …, 1.0 voxel (files 1001-1011 against 1000), and Yang_Beads_S3, six uniaxial stretches along y (1002-1007 against 1001). The archive ships the volumes but not the fields’ values. They were recovered independently of either code: the translations are the nominal steps (both codes’ mean error is below 3e-4 voxel), and the stretches are v = eps (y - 255) with eps = 0.05, 0.10, …, 0.30, found by registering the stretched reference to each deformed volume (stretch_registration(); normalised correlation 0.95-0.97, eps within 1e-5 of the steps).

Settings are iDVC’s defaults (cube subvolumes, 12-DOF, ZNSSD, tricubic) with 8 000 samples per subvolume (a 20^3 grid, as iDVC’s example). A cube samples the same grid in both codes, so the codes see identical data and any difference is the solver’s (docs/benchmarks/2026-09-29-idvc-comparison.md). Each code is run by zvdvc.bench.compare_ccpi.compare(): CCPi dvc 22.0.0 as iDVC launches it (one process, every core), zvDVC in its CCPi-parity mode.

Steps:

python -m zvdvc.bench.public_datasets fetch   --data /path/to/downloads
python -m zvdvc.bench.public_datasets prepare --data /path/to/downloads --out runs/public_validation
python -m zvdvc.bench.public_datasets run     --out runs/public_validation [--cases dvc1_repeat1_32 ...]
python -m zvdvc.bench.public_datasets prefilter --out runs/public_validation
python -m zvdvc.bench.public_datasets basin   --out runs/public_validation
python -m zvdvc.bench.public_datasets report  --out runs/public_validation
class zvdvc.bench.public_datasets.Case(name: 'str', dataset: 'str', reference: 'str', deformed: 'str', size: 'float', offset_xyz: 'tuple[float, float, float]' = (0.0, 0.0, 0.0), truth_xyz: 'tuple[float, float, float] | None' = None, group: 'str' = '', strain_y: 'float | None' = None)[source]

Bases: object

Parameters:
name: str
dataset: str
reference: str
deformed: str
size: float
offset_xyz: tuple[float, float, float] = (0.0, 0.0, 0.0)
truth_xyz: tuple[float, float, float] | None = None
group: str = ''
strain_y: float | None = None
truth(xyz)[source]

The true displacement at points xyz (N, 3), where it is known.

Parameters:

xyz (ndarray)

Return type:

ndarray | None

zvdvc.bench.public_datasets.cases()[source]
Return type:

list[Case]

zvdvc.bench.public_datasets.fetch(data)[source]

Download XCT1 (7 x 100 MB) and the two Yang bead sets (0.6 + 1.1 GB); existing files are kept.

Parameters:

data (Path)

Return type:

None

zvdvc.bench.public_datasets.prepare(data, out)[source]

Unzip, stack each volume into a C-ordered little-endian .raw (what CCPi reads).

Parameters:
Return type:

None

zvdvc.bench.public_datasets.sample_mask(path)[source]

The foam cylinder of an XCT1 scan: smoothed image above the midpoint of air and foam, holes filled.

Parameters:

path (Path)

Return type:

ndarray

zvdvc.bench.public_datasets.dvc1_points(out, case, *, erode_size)[source]

Grid points whose whole cube (erode_size + stencil) lies in the foam in the reference and, moved by the case’s offset, in the deformed scan.

Parameters:
Return type:

ndarray

zvdvc.bench.public_datasets.beads_points()[source]

A regular grid over the bead volume, half a subvolume + disp_max + stencil in from each face.

CCPi reads beyond the subvolume by up to disp_max: with points 20 voxels from the x and y faces (half a subvolume + 4) dvc 22.0.0 crashed with a segmentation fault in 7 of 11 translation runs.

Return type:

ndarray

zvdvc.bench.public_datasets.centre_first(xyz, centre)[source]

(point_id, xyz) with the point nearest centre first: CCPi and the wavefront start there.

Parameters:
Return type:

tuple[ndarray, ndarray]

zvdvc.bench.public_datasets.build_case(out, case)[source]

Write the case’s points (.roi), config and (if known) truth; return the config.

Parameters:
Return type:

RunConfig

zvdvc.bench.public_datasets.run(out, names, *, backend, ccpi_exe, reuse, idvc_launch=True)[source]
Parameters:
Return type:

None

zvdvc.bench.public_datasets.run_basin(out, names, *, backend, ccpi_exe)[source]

Both codes on the stretches with CCPi’s translation grid search on (basin_radius = 4; iDVC fixes it at 0): at 15 % strain and more, neighbouring points 32 voxels apart differ by 5 voxels or more, beyond where a seed from the neighbour’s translation converges.

Parameters:
Return type:

None

zvdvc.bench.public_datasets.run_prefilter(out, *, backend)[source]

zvDVC alone with volumes.prefilter_sigma = 1 (no iDVC equivalent) on the translations and repeats: how much of each code’s error is tricubic interpolation bias.

Parameters:
Return type:

None

zvdvc.bench.public_datasets.affine_fit(xyz, u)[source]

Least-squares u = t + G (x - centre); returns (coefficients (4, 3), prediction).

Parameters:
Return type:

tuple[ndarray, ndarray]

zvdvc.bench.public_datasets.score(out, case)[source]
Parameters:
Return type:

dict[str, Any] | None

zvdvc.bench.public_datasets.report(out)[source]
Parameters:

out (Path)

Return type:

dict[str, Any]

zvdvc.bench.public_datasets.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.metrics

Accuracy metrics against ground truth and against CCPi output.

Results can be read from a zarr-vectors results store, the in-memory runner’s results.npz (zvdvc.pipeline.inmemory) or a CCPi .disp. Points are matched on point_id. Errors are over points that are GOOD in the results (and, against CCPi, GOOD in both).

class zvdvc.bench.metrics.Accuracy(n_good: 'int', frac_good: 'float', bias: 'tuple[float, float, float]', rmse: 'tuple[float, float, float]', p99_abs: 'float', status_counts: 'dict[int, int]', n_points: 'int' = 0, median_abs: 'float' = nan, p95_abs: 'float' = nan, status_agreement: 'float | None' = None, n_good_both: 'int | None' = None, n_good_ref: 'int | None' = None, status_confusion: 'dict[str, int] | None' = None)[source]

Bases: object

Parameters:
n_good: int
frac_good: float
bias: tuple[float, float, float]
rmse: tuple[float, float, float]
p99_abs: float
status_counts: dict[int, int]
n_points: int = 0
median_abs: float = nan
p95_abs: float = nan
status_agreement: float | None = None
n_good_both: int | None = None
n_good_ref: int | None = None
status_confusion: dict[str, int] | None = None
summary()[source]
Return type:

str

zvdvc.bench.metrics.load_results(path)[source]

point_id, xyz, status, objmin, displacement from results.npz or a .disp.

Parameters:

path (str | Path)

Return type:

dict[str, ndarray]

zvdvc.bench.metrics.compare_arrays(a, b, status=None, *, ref_status=None)[source]

Error of displacements a (N, 3) against b (N, 3).

status is a’s PointStatus (default: all GOOD). With ref_status (another code’s statuses, CCPi codes) errors are taken over points GOOD in both, and the status agreement is reported.

Parameters:
Return type:

Accuracy

zvdvc.bench.metrics.edge_mask(xyz, displacement, shape_xyz, reach)[source]

Points whose reference or displaced subvolume, grown by reach, leaves the volume.

reach is the template extent plus the interpolation stencil (2 voxels for tricubic). CCPi does not test samples against the image (it reads a box around each point from the file, wrapping into the next row or past the end), so its results for these points are not comparable; zvDVC marks them RANGE_FAIL.

Parameters:
Return type:

ndarray

zvdvc.bench.metrics.against_truth(results_path, truth_path)[source]
Parameters:
Return type:

Accuracy

zvdvc.bench.metrics.against_disp(results_path, disp_path)[source]

Point-by-point agreement with a CCPi .disp (matched on point_id), including status agreement.

Parameters:
Return type:

Accuracy

zvdvc.bench.gds

Brick reads on the host path against the kvikio (GPUDirect Storage) path: speed and identity.

Reads the same random bricks of one volume through each read path of zvdvc.io.gds and reports throughput, after checking that both paths deliver identical bricks. --cold drops the files from the page cache before every read, so the bytes come from the drive rather than RAM: the case GPUDirect Storage is for.

The report records what the machine offered (zvdvc.io.gds.status()): without GPUDirect Storage the kvikio path still runs, through cuFile’s or kvikio’s POSIX fallback, and its numbers measure that fallback, not GPUDirect Storage. The gds_available field says which.

Usage:

python -m zvdvc.bench.gds --config runs/case_A/config.yaml --brick 256 --bricks 8 --cold
python -m zvdvc.bench.gds --volume data/ref.ome.zarr --json runs/gds/ref.json
zvdvc.bench.gds.drop_page_cache(paths)[source]
Parameters:

paths (list[str])

Return type:

None

zvdvc.bench.gds.random_boxes(shape, edge, n, seed=0)[source]
Parameters:
Return type:

list[Box]

zvdvc.bench.gds.bench_volume(make, boxes, modes, *, cold, repeat=1)[source]

make(mode) opens the volume with that read path; every brick is read repeat times per mode.

Parameters:
Return type:

dict[str, Any]

zvdvc.bench.gds.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.kernel

Kernel benchmark: one Gauss-Newton iteration on real data, per engine.

Times the two kernels a solve spends its time in, on a fixed point set, with volumes already prepared (no upload, no I/O):

  • sums: value, gradient and normal-equation sums at every template sample (gn_sums on the GPU), reported in µs per point-iteration;

  • sample: values only (sample_values), reported in µs per point.

The data is the iDVC case A pair (--case-a DIR or $ZVDVC_CASE_A) with CCPi’s settings and 2 048 points drawn from a 3D grid through the sample. Without it, a synthetic u8 speckle volume stands in; results carry a data label so the two are never compared. The small synthetic volumes of zvdvc.bench.throughput fit in cache and overstate GPU speed.

Every run checks each engine’s sums against the float64 numpy engine on the first 64 points. rel_err is the largest |error| over all sums, each divided by that sum’s largest |reference| value, floored at 1e-6 of the largest sum: some sums cancel to ~0 by construction (sum q under ZNSSD), and dividing by them would measure rounding noise, not error.

Command line:

python -m zvdvc.bench.kernel --backends fused cpu --json runs/kernel.json
class zvdvc.bench.kernel.Case(data: 'str', ref: 'Any', deformed: 'Any', centres: 'np.ndarray', params: 'np.ndarray', subvolume: 'SubvolumeSpec', search: 'SearchSpec')[source]

Bases: object

Parameters:
data: str
ref: Any
deformed: Any
centres: ndarray
params: ndarray
subvolume: SubvolumeSpec
search: SearchSpec
zvdvc.bench.kernel.case_a(data, cache, n_points, seed=0)[source]
Parameters:
Return type:

Case

zvdvc.bench.kernel.synthetic(n_points, seed=0, shape=(256, 256, 256), subvolume=None, dtype='uint8')[source]

A speckle volume (u8 or u16) large enough not to fit in cache; the deformed volume is the same data.

Parameters:
Return type:

Case

zvdvc.bench.kernel.measure(case, backend, repeats=5)[source]

Time sample and sums on one engine; check its sums against the float64 engine.

Parameters:
Return type:

dict[str, Any]

zvdvc.bench.kernel.rel_err(got, want)[source]

Largest per-sum relative error; the scale of each sum is floored at 1e-6 of the largest (see module doc).

Parameters:
Return type:

float

zvdvc.bench.kernel.run(backends, *, case_a_dir=None, cache=None, n_points=2048, repeats=5, synthetic_dtype=None)[source]

Case A if available (unless synthetic_dtype asks for a synthetic volume), else synthetic u8.

Parameters:
  • backends (list[str])

  • case_a_dir (str | None)

  • cache (str | None)

  • n_points (int)

  • repeats (int)

  • synthetic_dtype (str | None)

Return type:

dict[str, Any]

zvdvc.bench.kernel.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.throughput

Throughput and utilisation measurements.

Records points/s per stage (read, seed, solve, write), GPU time split by NVTX range, achieved FLOP/s and L2 hit rate for the fused kernel (Nsight Compute metrics, when available), and compute-stream idle time spent waiting on I/O. These are the numbers that replace the model in docs/PERFORMANCE.md.

kernel_microbench times the solve alone on a synthetic speckle brick held in memory (I/O excluded) on any backend. Achieved FLOP/s uses the operation count of flops_per_sample_iteration(), a model of the fused kernel’s arithmetic, so it is an estimate; Nsight Compute gives the measured figure:

ncu --set full --kernel-name regex:gn_sums python -m zvdvc.bench.throughput --backend fused

Command line:

python -m zvdvc.bench.throughput --backend cpu numpy --samples 2000 --dof 6 12 --batch 2048 --json out.json

The default 160³ volume is small: with a small subvolume the working set stays in cache, so GPU numbers here are optimistic. Use --shape for a larger volume, or zvdvc.bench.kernel for the same kernels on real data.

class zvdvc.bench.throughput.Throughput(backend: 'str', hardware: 'str', points: 'int', seconds_total: 'float', seconds_by_stage: 'dict[str, float]' = <factory>, points_per_second: 'float' = 0.0, achieved_tflops: 'float | None' = None, io_wait_fraction: 'float | None' = None, mean_iterations: 'float | None' = None, us_per_point_iteration: 'float | None' = None, settings: 'dict[str, Any]' = <factory>)[source]

Bases: object

Parameters:
backend: str
hardware: str
points: int
seconds_total: float
seconds_by_stage: dict[str, float]
points_per_second: float = 0.0
achieved_tflops: float | None = None
io_wait_fraction: float | None = None
mean_iterations: float | None = None
us_per_point_iteration: float | None = None
settings: dict[str, Any]
zvdvc.bench.throughput.flops_per_sample_iteration(dof, interpolation)[source]

Floating-point operations per template sample per Gauss-Newton iteration in gn_sums.

Interpolation with gradient (tricubic: 12 weight/derivative-weight polynomials, 16 rows of 4 taps each for value and x-derivative, the y and z contractions), the warp (F d: 18), the Jacobian rows beyond translation ((dof - 3) dot products of 15), and the sums (dof (dof + 1) for J^T J, 6 dof for the three vector sums, 12 for the scalars).

Parameters:
  • dof (int)

  • interpolation (str)

Return type:

int

zvdvc.bench.throughput.hardware_name(backend)[source]
Parameters:

backend (str)

Return type:

str

zvdvc.bench.throughput.kernel_microbench(*, n_samples, dof, interpolation, objective, batch, backend='fused', size=32.0, shape=(160, 160, 160), repeats=3, seed=0)[source]

Fused GN step on a synthetic brick: points/s and FLOP/s with I/O excluded.

batch points, uniformly spread where their subvolume fits, are solved from a seed 0.6 voxel off a pure translation; the best of repeats timed runs (after one warm-up that also compiles) is reported.

Parameters:
Return type:

Throughput

zvdvc.bench.throughput.end_to_end(cfg, *, backend)[source]

prepare -> seed -> run -> finalize on one process, timed per stage.

Parameters:
Return type:

Throughput

zvdvc.bench.throughput.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.density

Wall time against point-cloud density on the iDVC case A pair, and a cost model fitted to it.

Grids of decreasing spacing fill a fixed block of the sample (zvdvc.bench.case_a.GRID_BOX) and are solved in memory with CCPi’s settings and wavefront seeding. For each backend the model

t(N) = t0 + tau * S(N) + c * N, S(N) ~ k N^(1/3) wavefront shells

is fitted in relative error with non-negative coefficients: t0 is fixed cost per run, tau per shell (launches and host syncs, which dominate small grids on a GPU) and c per point. The GPU’s speed-up over the CPU tends to c_cpu / c_gpu for dense grids.

Command line (the CPU arm takes tens of minutes at the finest spacings):

python -m zvdvc.bench.density --backends fused cpu --json runs/density.json
zvdvc.bench.density.sweep(cfg, spacings, backends, progress=<built-in function print>)[source]
Parameters:
Return type:

list[dict[str, Any]]

zvdvc.bench.density.fit(rows, backend)[source]

t0, tau, c (seconds) and the largest relative misfit for one backend.

Parameters:
Return type:

dict[str, float]

zvdvc.bench.density.model(rows, backends)[source]
Parameters:
Return type:

dict[str, Any]

zvdvc.bench.density.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.scaling

Q3: 1 -> N device scaling on one node, and the storage bandwidth that bounds it.

scaling

Runs the tile loop on 1, 2, …, N devices against fresh results stores (plan once, then run per device count) and reports pt/s and the efficiency t1 / (n tn). Q3 passes at >= 85 % on a compute-bound case.

read_bandwidth

Reads every tile’s bricks (both volumes) with readers threads and no compute, through the same path the workers use: zvDVC’s own I/O ceiling on this node and file system. A run whose bytes_read / seconds reaches >= 70 % of it is I/O-bound in the Q3 sense. scripts/slurm/storage_baseline.sh measures the raw file system with fio for comparison.

Command line:

python -m zvdvc.bench.scaling CONFIG --devices 1 2 4 8 [--mode strong|weak] [--backend fused] [--out runs/scaling]
python -m zvdvc.bench.scaling CONFIG --read-bandwidth --readers 8
zvdvc.bench.scaling.read_bandwidth(cfg, *, readers=8, max_tiles=None)[source]

GB/s reading the planned bricks (zvdvc plan first) with readers threads, host decode only.

Parameters:
Return type:

dict[str, Any]

zvdvc.bench.scaling.scaling(cfg, device_counts, *, backend, out_dir, devices=None, mode='strong', tiles_per_device=4, progress=<built-in function print>)[source]

Fresh store per device count: pt/s and efficiency, with a timeline summary of each run.

strong: the whole plan on each device count; efficiency t1 / (n tn). weak: tiles_per_device x n tiles on n devices, the fullest tiles first so every device gets similar work; efficiency t1 / tn (ideal: constant time). Seeding must be rigid (or seeds must already exist): no seed pass runs here.

Parameters:
Return type:

dict[str, Any]

zvdvc.bench.scaling.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.bench.campaign

The cluster benchmark campaign: one command that measures how zvDVC scales on a GPU node.

Steps, in order (each writes <out>/<step>.json; a finished step is skipped when the job is resubmitted, so a job that hits its walltime just continues):

env

environment, GPUs (nvidia-smi -q), CPU and memory

check

zvdvc check gpu: the test suite and selftest on this node

kernel

per-GPU kernel speed (bench.kernel): case A if given, synthetic u8, u16

data

case L: a synthetic u16 pair with a known inclusion field (generated once, reused), tiled so every GPU count gets >= 4 tiles per GPU

storage

file-system bandwidth (fio, if present) and zvDVC’s brick-read ceiling

strong

strong scaling over the device counts, with per-run timelines

weak

weak scaling (4 tiles per device, the fullest tiles)

profile

Nsight Systems on a short run over all devices (zvdvc run --max-tiles)

ncu

Nsight Compute counters for gn_sums on one GPU (skipped if not permitted)

e2e

plan, run and finalize on all devices, and accuracy against the truth

report

campaign.md: the tables above in one page

Command line (inside the container, or any environment with zvDVC):

python -m zvdvc.bench.campaign --out RESULTS_DIR --data-dir DATA_DIR [--size 2048] [--devices 1 2 4 8]
python -m zvdvc.bench.campaign ... --steps strong weak     # a subset
python -m zvdvc.bench.campaign ... --redo strong           # run a finished step again
class zvdvc.bench.campaign.Campaign(out: 'Path', data_dir: 'Path', size: 'int' = 2048, devices: 'tuple[int, ...]' = (1, 2, 4, 8), case_a: 'Path | None' = None, tile: 'int | None' = None, profile_tiles: 'int' = 16, fio_gb: 'int' = 4, log: 'Callable[[str], None]' = <built-in function print>)[source]

Bases: object

Parameters:
out: Path
data_dir: Path
size: int = 2048
devices: tuple[int, ...] = (1, 2, 4, 8)
case_a: Path | None = None
tile: int | None = None
profile_tiles: int = 16
fio_gb: int = 4
log(*args, sep=' ', end='\n', file=None, flush=False)

Prints the values to a stream, or to sys.stdout by default.

sep

string inserted between values, default a space.

end

string appended after the last value, default a newline.

file

a file-like object (stream); defaults to the current sys.stdout.

flush

whether to forcibly flush the stream.

property case_l: Path
property config: Path
tile_edge()[source]

The largest power-of-two tile giving >= 4 tiles per GPU at the largest device count.

Return type:

int

zvdvc.bench.campaign.step_env(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_check(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_kernel(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_data(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_storage(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_strong(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_weak(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_profile(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_ncu(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_e2e(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.step_report(c)[source]
Parameters:

c (Campaign)

Return type:

dict[str, Any]

zvdvc.bench.campaign.report_markdown(out)[source]
Parameters:

out (Path)

Return type:

str

zvdvc.bench.campaign.run(c, steps=None, redo=None)[source]
Parameters:
Return type:

dict[str, str]

zvdvc.bench.campaign.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

int

zvdvc.bench.timeline

Where a run’s time went, from its event logs (zvdvc.profiling).

For each worker (one per GPU): wall time, the share spent solving (utilisation), start-up before the first tile arrived, stalls waiting for reads and for the writer, and idle time at the end while other workers finished (the tail). Across workers: load imbalance (slowest worker’s solve time over the mean), the spread of tile solve times, and throughput. With gpu_telemetry.csv: mean utilisation, peak memory and mean power per GPU while the run was active.

Command line:

python -m zvdvc.bench.timeline WORKDIR/events/<run id> [--json out.json]
zvdvc.bench.timeline.load_events(path)[source]

Events per worker file (stem -> list of records).

Parameters:

path (str | Path)

Return type:

dict[str, list[dict[str, Any]]]

zvdvc.bench.timeline.summarise(path)[source]
Parameters:

path (str | Path)

Return type:

dict[str, Any]

zvdvc.bench.timeline.telemetry(path)[source]

Mean GPU and memory-controller utilisation, peak memory, mean SM clock and power, per GPU index.

Parameters:

path (str | Path)

Return type:

dict[str, dict[str, float]]

zvdvc.bench.timeline.markdown(s)[source]
Parameters:

s (dict[str, Any])

Return type:

str

zvdvc.bench.timeline.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

None

zvdvc.profiling

Run instrumentation: NVTX ranges, per-worker event logs and GPU telemetry.

  • nvtx_range() labels a stage on the Nsight Systems timeline (no-op without cupy). Workers mark read / solve / write per tile, and the solver marks the reference sampling, each Gauss-Newton iteration and the final objective.

  • EventLog appends one JSON line per event to <workdir>/events/<run id>/worker-<host>-d<device>-p<pid>.jsonl: each tile’s read, solve and write intervals and the compute loop’s waits, with wall-clock times (time.time()) so the workers of a run line up. zvdvc.bench.timeline turns them into utilisation, stall and load-balance figures.

  • GpuTelemetry samples every GPU (utilisation, memory, SM clock, power, temperature) once a second with nvidia-smi for the duration of a run, into gpu_telemetry.csv next to the event logs.

The run id comes from $ZVDVC_RUN_ID (set by coordinator.run, and inherited by the spawned workers), so every file of one run shares a folder.

zvdvc.profiling.new_run_id()[source]

A run id (UTC time, then pid), exported so worker processes inherit it.

Return type:

str

zvdvc.profiling.events_dir(workdir, run_id=None)[source]
Parameters:
Return type:

Path

zvdvc.profiling.nvtx_range(name)[source]

An NVTX range around the block, visible in Nsight Systems; free when not profiled.

Parameters:

name (str)

Return type:

Iterator[None]

class zvdvc.profiling.EventLog(path)[source]

Bases: object

Thread-safe JSON-lines log of one worker’s events.

Parameters:

path (str | Path)

classmethod for_worker(workdir, device)[source]
Parameters:
Return type:

EventLog

record(ev, **fields)[source]
Parameters:
Return type:

None

close()[source]
Return type:

None

class zvdvc.profiling.GpuTelemetry(path, interval_ms=1000)[source]

Bases: object

nvidia-smi sampling every GPU at interval_ms into path while the context is open.

Parameters:
  • path (str | Path)

  • interval_ms (int)

FIELDS = 'index,timestamp,utilization.gpu,utilization.memory,memory.used,clocks.sm,power.draw,temperature.gpu'