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 |
|
~5 min |
full |
|
~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:
- 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:
- zvdvc.bench.check.out_root(src)[source]¶
Where runs/check goes:
$ZVDVC_CHECK_OUT, else the source tree if writable (a checkout), else cwd.
- zvdvc.bench.check.baseline_dir(src)[source]¶
$ZVDVC_BASELINE_DIR(e.g. shared storage on a cluster), else the checkout’s docs/benchmarks/baselines.
- zvdvc.bench.check.fingerprint()[source]¶
Hardware (decides whether timings compare) and software (decides whether results should be bit-identical).
- zvdvc.bench.check.gpu_state()[source]¶
Other processes on the GPU (they make timings meaningless), and clocks/temperature for the record.
- 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").
- 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().)
- 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.
- 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).
- zvdvc.bench.check.write_baseline(root, machine, report, steps, reason, ccpi_disp, out=None)[source]¶
Baseline JSON in
baseline_dir(); its arrays underout/runs/check/baseline, paths relative toout.
- zvdvc.bench.check.run(tier, *, case_a=None, cache=None, machine=None, update_baseline=False, reason='', require_case_a=False, ccpi_disp=None)[source]¶
- zvdvc.bench.check.add_arguments(p)[source]¶
- Parameters:
p (ArgumentParser)
- Return type:
None
zvdvc.bench.smoke¶
zvdvc selftest: check an installation end to end on a small synthetic case.
Reports the environment: package versions, numba, cupy and GPUs, the CCPi
dvc.Writes a 96^3 affine phantom (about 30 s).
For every backend available here (
cpuwith numba,fusedandcupywith a GPU, elsenumpy), runsplan -> seed -> run -> finalizethrough the pipeline and checks accuracy against ground truth (>= 99 % GOOD, RMSE <= 0.02 voxel).With a GPU, checks that the GPU backends agree with the CPU engine (<= 1e-3 voxel, >= 99.9 % status agreement: the M2 parity criterion).
With CCPi
dvcavailable ($ZVDVC_CCPI_DVCor 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.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
.npyvolumes (1520 x 1257 x 1260 u8) are presumed to be CCPi’sframe_000/frame_010. CCPi’s own test files for them (dvc_test/dvc_input.txt,central_grid.roi, and a referencecompleted_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 overbox; the point nearest the centre comes first.CCPi and the wavefront start from the first point, so a central start keeps shells compact.
- 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.
- zvdvc.bench.case_a.cache_dir(arg=None)[source]¶
Where C-ordered
.rawcopies of the volumes are kept:arg,$ZVDVC_CASE_A_CACHEorruns/case_A.
- zvdvc.bench.case_a.fetch(data, *, all_files=False)[source]¶
Download the Zenodo volumes (
.npyonly unlessall_files) and CCPi’s test files intodata.
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:
- zvdvc.bench.ccpi_baseline.ccpi_ready_config(cfg, workdir)[source]¶
cfgwith volumes CCPi can read: OME-Zarr is exported once toworkdir/{ref,def}.raw.
- zvdvc.bench.ccpi_baseline.run_ccpi(cfg, *, workdir, omp_threads, processes=1, max_points=None, seed=0, exe=None)[source]¶
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> iDVCdvcas iDVC launches it: one process, OpenMP on every core.ccpi <v> xPPconcurrentdvcprocesses on disjoint point subsets (1 thread each): the best a node gets from CCPi without code changes.zvdvc <b> paritywhole volumes in memory, CCPi point order (wavefront), in this process: read + solve, the like-for-like number.
zvdvc <b> clizvdvc plan / seed / run / finalizeas 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
- zvdvc.bench.compare_ccpi.dvc_version(exe)[source]¶
The version
dvcreports in its manual (e.g.v22.0.0-19-gb0e2642), else the conda package folder.
- 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
processesone-thread processes.idvc_launch=Falseskips 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.
- 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.
- zvdvc.bench.compare_ccpi.run_zvdvc_cli(cfg, out, backend)[source]¶
plan / seed / run / finalize as separate processes, each timed, start-up included.
- 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_xyzandreach(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.
- 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.
- 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]¶
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
salong x and along the (1, 1, 1) diagonal, 0 to 1 voxel in steps of 0.1, withscipy.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:
- 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.
- zvdvc.bench.error_floor.choose_crop(volume, shape_zyx, size, stride=8)[source]¶
Origin (z, y, x) of the cubic crop of side
sizewith the most foreground (Otsu threshold on a subsample).
- 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.
- zvdvc.bench.error_floor.grid_points(shape_zyx, size, margin)[source]¶
Points (x, y, z) spaced by the subvolume size, whose subvolumes stay
margininside the crop.
- 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]¶
- 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.
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), andYang_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 arev = 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:
- 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).
- 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.
- 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.
- 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)dvc22.0.0 crashed with a segmentation fault in 7 of 11 translation runs.- Return type:
- zvdvc.bench.public_datasets.centre_first(xyz, centre)[source]¶
(point_id, xyz)with the point nearestcentrefirst: CCPi and the wavefront start there.
- zvdvc.bench.public_datasets.build_case(out, case)[source]¶
Write the case’s points (.roi), config and (if known) truth; return the config.
- 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.
- 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.
- zvdvc.bench.public_datasets.affine_fit(xyz, u)[source]¶
Least-squares
u = t + G (x - centre); returns (coefficients (4, 3), prediction).
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
- zvdvc.bench.metrics.load_results(path)[source]¶
point_id,xyz,status,objmin,displacementfromresults.npzor a.disp.
- zvdvc.bench.metrics.compare_arrays(a, b, status=None, *, ref_status=None)[source]¶
Error of displacements
a(N, 3) againstb(N, 3).statusisa’s PointStatus (default: all GOOD). Withref_status(another code’s statuses, CCPi codes) errors are taken over points GOOD in both, and the status agreement is reported.
- zvdvc.bench.metrics.edge_mask(xyz, displacement, shape_xyz, reach)[source]¶
Points whose reference or displaced subvolume, grown by
reach, leaves the volume.reachis 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.
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.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_sumson 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)
- subvolume: SubvolumeSpec¶
- search: SearchSpec¶
- 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.
- zvdvc.bench.kernel.measure(case, backend, repeats=5)[source]¶
Time
sampleandsumson one engine; check its sums against the float64 engine.
- 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).
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:
- 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)forJ^T J,6 doffor the three vector sums, 12 for the scalars).
- 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.
batchpoints, uniformly spread where their subvolume fits, are solved from a seed 0.6 voxel off a pure translation; the best ofrepeatstimed runs (after one warm-up that also compiles) is reported.
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.fit(rows, backend)[source]¶
t0,tau,c(seconds) and the largest relative misfit for one backend.
zvdvc.bench.scaling¶
Q3: 1 -> N device scaling on one node, and the storage bandwidth that bounds it.
scalingRuns the tile loop on 1, 2, …, N devices against fresh results stores (plan once, then
runper device count) and reports pt/s and the efficiencyt1 / (n tn). Q3 passes at >= 85 % on a compute-bound case.read_bandwidthReads every tile’s bricks (both volumes) with
readersthreads and no compute, through the same path the workers use: zvDVC’s own I/O ceiling on this node and file system. A run whosebytes_read / secondsreaches >= 70 % of it is I/O-bound in the Q3 sense.scripts/slurm/storage_baseline.shmeasures 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 planfirst) withreadersthreads, host decode only.
- 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; efficiencyt1 / (n tn).weak:tiles_per_device x ntiles on n devices, the fullest tiles first so every device gets similar work; efficiencyt1 / tn(ideal: constant time). Seeding must berigid(or seeds must already exist): no seed pass runs here.
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 ( |
check |
|
kernel |
per-GPU kernel speed ( |
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 ( |
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 |
|
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:
- 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.
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.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.EventLogappends 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.timelineturns them into utilisation, stall and load-balance figures.GpuTelemetrysamples every GPU (utilisation, memory, SM clock, power, temperature) once a second withnvidia-smifor the duration of a run, intogpu_telemetry.csvnext 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:
- zvdvc.profiling.nvtx_range(name)[source]¶
An NVTX range around the block, visible in Nsight Systems; free when not profiled.
- class zvdvc.profiling.EventLog(path)[source]¶
Bases:
objectThread-safe JSON-lines log of one worker’s events.
- Parameters:
path (str | Path)