Skip to content

ABRIK Wrap-Up#130

Open
mmelnich wants to merge 19 commits into
mainfrom
winter-2025-abrik-clean
Open

ABRIK Wrap-Up#130
mmelnich wants to merge 19 commits into
mainfrom
winter-2025-abrik-clean

Conversation

@mmelnich

Copy link
Copy Markdown
Contributor

WIP

@mmelnich mmelnich force-pushed the winter-2025-abrik-clean branch from 124f1a7 to 5888ab1 Compare May 4, 2026 18:45
mmelnich added 4 commits May 6, 2026 16:18
ABRIK_speed_comparisons.cc and ABRIK_accuracy_analysis.cc both gain a num_runs
positional argument and an outer loop over runs that uses RNGState<RNG>(run) so
each run draws from a distinct seed. CSVs gain a leading 'run' column tagging
each data row with its run index. GESDD (deterministic) runs once and is
reported under run=0 in both benchmarks.

Speed_comparisons CLI: <prec> <outdir> <input> <target_rank> <run_gesdd>
                       <budget> <num_runs> <num_b_sz> <b_sz...> [sub_ratio] [use_cqrrt]
Accuracy_analysis CLI: <prec> <outdir> <input> <m> <n> <b_sz> <num_matmuls> <num_runs>
Previously the accuracy benchmark used RandLAPACK::gen::mat_gen with
custom_input, which only handles whitespace-delimited text files. Feeding
it the .bin matrices produced by gen_mat_alg971_paper crashed at the
dimension query because the binary header was interpreted as ASCII rows.

Switch to BenchIO::load_matrix (the same auto-detecting loader used by
ABRIK_speed_comparisons and ABRIK_runtime_breakdown). It dispatches on
file extension: .bin via read_bin_matrix, .txt via read_txt_matrix,
.mtx via fast_matrix_market. Sparse input is now rejected explicitly
with a clear error since accuracy_analysis runs a full GESDD.

A is now owned by the LoadedMatrix and freed automatically; removed the
matching new T[m*n] and delete[] A. CMakeLists.txt bumps the target's
LINK_LIBS from Benchmark_libs to Benchmark_libs_external because
ext_matrix_io.hh pulls in fast_matrix_market and Eigen headers, matching
the other two ABRIK benchmark targets.
The summary `end_cols = iter * k / 2` truncates when iter*k is odd, which only
happens for odd block size k. For k=1, calling BK::call with max_krylov_iters=1
finishes the prelude + one odd half-step (Y_od[:,0:1] populated, R[0:1,0:1]
populated) but then returns end_cols=0 due to integer floor.

ABRIK::call_with_checkpoints then sees end_cols==0, emits the placeholder row
(total_matvecs=0, err=1), and breaks the entire checkpoint loop. Every
subsequent checkpoint (mv=2, 4, ..., 4096) is skipped, so the speed-comparison
CSVs contain only one sentinel row per run at b_sz=1.

The runtime-breakdown benchmark drives BK::call with fixed max_krylov_iters
>= 2 in every cell, so this path produced valid data — only call_with_checkpoints
at its first b_sz=1 checkpoint exposed the bug.

Fix: ceiling division `(iter * k + 1) / 2`. Bit-identical for even k (all
historical b_sz ∈ {4, 8, 16, 32, 64, 128} cases), and yields the correct
column count for odd k:

  iter | k=1 floor | k=1 ceil | k=2 (no change) | k=4 (no change)
  ---- | --------- | -------- | --------------- | ---------------
   1   | 0 (bug)   | 1        | 1               | 2
   2   | 1         | 1        | 2               | 4
   3   | 1 (bug)   | 2        | 3               | 6
   4   | 2         | 2        | 4               | 8

No new tests added; the b_sz=1 path is now exercised by the existing
ABRIK_speed_comparisons benchmark at the bench level once Bergamo/SPR
campaigns rerun with this fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant