Skip to content

Add benchmarking and automatic core-count heuristics for af()/vis()/bglmnet() #20

Description

@garthtarr

Part of the parallelization improvement plan tracked in PARALLELIZATION.md (Priority 4, optional/advanced).

Split out of #16 so it can be scoped and closed independently of progress bars (#18) and backend selection (#19).

Background

Real benchmarking done while investigating #15 showed that for af() at n.c = 24, B = 30, actual future::multisession wall-clock time ran 250-370% over the naive ideal (total sequential work ÷ cores) at cores = 8/10, purely from worker-startup and per-future dispatch overhead — i.e. parallelizing was a net loss at that problem size. PARALLELIZATION.md's "Performance Considerations" section already flags this qualitatively (n < 200, p < 50 as a rough threshold) but it's currently just documentation; the functions themselves don't act on it.

Tasks

  • Benchmark af(), vis(), and bglmnet() across a grid of problem sizes (n, p, B/n.c/nlambda) and core counts using bench::mark(), to establish where parallel overhead outweighs benefit for each function (their cost profiles likely differ)
  • Based on the benchmarks, add an automatic heuristic (or at minimum a message()/warning()) that falls back to cores = 1 (or suggests it) when the estimated problem size is too small to benefit from multisession overhead
  • Document the memory tradeoff: each worker holds its own copy of large objects (X, Xy, fitted models) — with N workers, expect roughly Nx memory footprint for large datasets. Add this to the relevant cores parameter documentation in af(), vis(), and bglmnet()
  • Consider exposing the benchmarking script/results (e.g. as a vignette or inst/benchmarks/ script) so the heuristic thresholds are reproducible and can be re-validated as the package evolves

See PARALLELIZATION.md section "Performance Considerations" for existing (currently qualitative) guidance, and the af() benchmark discussion in #15 for methodology.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions