Skip to content

Implement a streaming executor with prefetch and a memory budget #39

Description

@fishidaho

This is the single largest gap between the current repository and the project's actual thesis. There is no out-of-core execution model anywhere in src/vsparse/ today. load_and_normalize fully decodes the entire index stream into RAM before doing anything with it, so its peak memory scales with total dataset size rather than a bounded working set. On a large cohort this can run to tens of GiB.

Proposed scope

  • A chunked execution model with prefetch: src/vsparse/ gains a real streaming path, built and tested as library code (not a one-off script).
  • A user-settable memory budget that bounds the working set regardless of dataset size.
  • Double-buffered prefetch so chunk decode overlaps with kernel execution.
  • Every terminal reduction (sum, mean, variance, per-cell/per-gene statistics) reimplemented as a streaming accumulator over chunks, rather than requiring the full decoded array.

Acceptance criteria

  • Peak RSS is flat as dataset size grows across at least two orders of magnitude, enforced in CI a benchmarking memory-ceiling infrastructure.
  • Numerical agreement with the in-memory reference path matches a tight relative-error tolerance on X @ Omega, B @ X, and norm computations.
  • The memory budget parameter is documented and actually enforced, not advisory.

References

  • src/vsparse/_rapid_load.py (load_and_normalize).

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions