Skip to content

feat(write): index-aware max_mem accounting#163

Merged
d-laub merged 6 commits into
mainfrom
feat/max-mem-index-aware
May 20, 2026
Merged

feat(write): index-aware max_mem accounting#163
d-laub merged 6 commits into
mainfrom
feat/max-mem-index-aware

Conversation

@d-laub
Copy link
Copy Markdown
Collaborator

@d-laub d-laub commented May 20, 2026

Summary

  • Subtracts variants.nbytes (new in genoray 2.4.0) from max_mem before passing the remainder to genoray chunking in _write_from_vcf / _write_from_pgen. Makes max_mem a true total cap rather than a budget that excludes the already-resident variant index (CHROM/POS/REF/ALT/ILEN), which for large cohorts can be GBs.
  • Emits a UserWarning when the resident genoray index exceeds 50% of max_mem, so users know to increase the budget.
  • Bumps genoray dependency to >=2.4.0 (the release introducing .nbytes).
  • Updates gvl.write docstring to document the new accounting.

See `docs/superpowers/specs/2026-05-19-max-mem-index-aware-design.md` for the design and `docs/superpowers/plans/2026-05-19-max-mem-index-aware.md` for the implementation plan.

Test plan

  • `pytest tests/dataset/test_write.py::test_write_warns_when_index_dominates_max_mem` — new warning test
  • Full `pixi run -e dev test` — 430 passed, 5 skipped, 2 xfailed
  • `ruff check python/` — clean

🤖 Generated with Claude Code

d-laub and others added 6 commits May 19, 2026 15:15
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…minates

Compute effective_max_mem by subtracting the variant reader's resident
index size (variants.nbytes) from the user-supplied max_mem budget, then
pass effective_max_mem to the VCF/PGEN chunking helpers. Emit a
UserWarning when the index exceeds 50% of max_mem so users know to
increase the budget.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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