Skip to content

ngmix: each chunk holds only its own rows' tile stamps - #940

Merged
cailmdaley merged 1 commit into
developfrom
perf/ngmix-chunk-rows
Oct 6, 2026
Merged

cailmdaley merged 1 commit into
developfrom
perf/ngmix-chunk-rows

Conversation

@cailmdaley

@cailmdaley cailmdaley commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Each ngmix chunk now loads only its own rows' postage stamps, not the whole tile's.

Snakemake splits each tile into 16 ngmix chunks, but every chunk read all ~36K stamps (~360 MiB) into memory and kept them for the whole fit. Now Tile_cat memory-maps the catalogue and copies just the chunk's rows (VIGNET, and seg vignets when present). Stamps stay indexed by tile row, so the rest of the code is unchanged; reaching outside the chunk raises IndexError. Without ID_OBJ_MIN/ID_OBJ_MAX the whole catalogue loads as before.

Result (tile 202.301, Nibi):

  • outputs byte-identical to develop, on three small chunks and on a full 2,132-object chunk;
  • memory held per chunk: 360 MiB → 21 MiB, about 5 GiB less per tile across 16 chunks.

New unit tests in tests/module/test_ngmix_tile_cat_chunk.py; full suite passes.

Conflicts with #925 in Tile_cat; the fix is mechanical (keep the row range, read SEG_VIGNET through ChunkStamps).

🤖 Generated with Claude Code

https://claude.ai/code/session_012yfkBvkzPv33iJxXZ6jAxd

Tile_cat memory-maps the tile catalogue (and the segmentation vignet
catalogue) and copies the stamps of the chunk's rows only, into a
ChunkStamps indexed by tile-catalogue row; rows outside the chunk raise
IndexError. The per-object columns (obj_id, ra, dec, flux) stay full
length. Ngmix.process passes its ID_OBJ_MIN/ID_OBJ_MAX bounds to
Tile_cat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017JQtu8oaZQEAqzbxZbPpWs
cailmdaley added a commit that referenced this pull request Oct 5, 2026
Tile_cat takes no seg_cat_path: it reads row_min/row_max and holds both
stamp columns of the tile catalogue, VIGNET and SEG_VIGNET, for the
chunk's rows as ChunkStamps. test_tile_cat_reads_seg_vignet compares row
by row; test_tile_cat_holds_the_stamp_columns_once gives way to
test_ngmix_tile_cat_chunk.py, which now writes SEG_VIGNET into the tile
catalogue (its separate-seg-catalogue alignment test goes with the
separate catalogue).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012yfkBvkzPv33iJxXZ6jAxd
@cailmdaley
cailmdaley merged commit 755f06f into develop Oct 6, 2026
3 checks passed
@cailmdaley
cailmdaley deleted the perf/ngmix-chunk-rows branch October 6, 2026 07:47
cailmdaley added a commit that referenced this pull request Oct 6, 2026
#886 landed as a squash whose tree equals feat/wire-external-masks@baa6430c,
already merged here; the three conflicts (params_pin.json, universes/committed.yaml,
workflow/README.md) take this branch's side, which extends #886's. The merge
adds exactly #940's ngmix change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Nfmxobnf8yQJoqdk6kUAx
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.

2 participants