Skip to content

Report fitting peak memory at 25k and 400k anchors - #367

Closed
anle2024 wants to merge 2 commits into
mainfrom
anle/kumo-pytorch-fitting-memory
Closed

anle2024 wants to merge 2 commits into
mainfrom
anle/kumo-pytorch-fitting-memory

Conversation

@anle2024

@anle2024 anle2024 commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add tests/test_fitting_memory.py. It fits the same data at 25,000 and 400,000 anchors on DiskGraph. It reports the peak RSS of fitting and the part that fitting adds.
  • Both runs use the same data: 25,000 users with 17 events each. Only the anchor count changes. The anchors come from a Parquet AnchorTable, which large runs use.
  • The test process writes the data and builds the index once. Each measurement then runs in a new process that only reopens the index. It resets the peak RSS after prepare and reads VmHWM after materialize. Fitting reuses memory that earlier work in the same process freed. So a process that also built the data or the index hides part of the fitting peak.
  • The test has no pass or fail limit. It only reports. The existing t2b marker keeps it out of PR runs, so run it with --t2b.
  • The nightly T2b job does not run this file yet. Fail kumo-pytorch T2a and T2b checks when an import is missing #361 and Add integrated PyTorch nightly coverage and timing benchmarks #353 edit the same T2b command, so that change waits for them.

Change map

File-by-file change map

Testing Done

  • python -m pytest -q -rP --t2b --require-imports tests/test_fitting_memory.py at 9a95955e, twice: 1 passed in about 29 seconds each time. After Fitting peak RSS on DiskGraph:, the runs printed:
    • 25,000 anchors 321 MiB, fitting adds 46.7 MiB; 400,000 anchors 377 MiB, fitting adds 102.0 MiB
    • 25,000 anchors 321 MiB, fitting adds 45.7 MiB; 400,000 anchors 377 MiB, fitting adds 100.8 MiB
  • The runs used Linux aarch64, Python 3.12 and CPU torch 2.12.0, with a DiskGraph wheel built locally from main at eb474553.
  • The first commit measured in a process that also built the data and the index. For the same data, it reported only 27.2 and 40.7 MiB.
  • Without --t2b, pytest deselects the test.
  • uvx [email protected] check and uvx [email protected] format --check pass on the new file.

Checklist

  • I listed all the breaking changes introduced by the PR: none.
  • I made sure to update examples and documentation with my changes (if necessary)
  • I added and modified the unit tests required to cover the changes in this PR.

🤖 Generated with Claude Code

Add a t2b-tier test that fits the same data at 25,000 and 400,000
anchors on DiskGraph, each in a new process. It reports the peak RSS of
fitting and the part that fitting adds. It has no pass or fail limit.
Run it with --t2b.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@anle2024

anle2024 commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

Change map

File Function / scope What changed Why
packages/experimental/kumo-pytorch/tests/test_fitting_memory.py CONTRACT, _engine, _fit, test_record_fitting_memory_at_25k_and_400k_anchors New test file. It writes the data and builds the DiskGraph index once. It then fits 25,000 and 400,000 anchors, each in a new process that only reopens the index. It prints the peak RSS of fitting. No test reports how fitting memory changes with the anchor count.
  • Requirement: the kumo-pytorch 1.2 test plan asks for fitting memory at 25k and 400k anchors. It sets no limit, so the test only reports.
  • Existing behavior: no test or benchmark reports fitting memory by anchor count.
  • Smallest change: one new test file under the existing t2b marker, with no workflow change. It reuses the anchor-table schema and the Parquet helper.
  • Verification: 2 runs with --t2b passed in about 29 seconds each, and their numbers stayed within 1.2 MiB of each other. Without --t2b, pytest deselects it.
  • Stopping condition: a run with --t2b prints one line with the peak RSS at both anchor counts.

@copy-pr-bot

copy-pr-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@anle2024
anle2024 temporarily deployed to gha-kumo-workflow-tests November 17, 2026 00:53 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds a non-gating test that measures peak RSS and its increase while materializing a DiskGraph plan with 25,000 and 400,000 anchors. Each measurement runs in a spawned process. The test creates synthetic Parquet data and an index, then prints the measurements. It skips when required system support or dependencies are unavailable. It does not assert a memory limit.

Merge Risk: Minimal · up to 9a959

This adds an informational memory-measurement test that does not run by default and does not change library behavior. Merge risk is minimal.

Security architecture risk: Minimal · up to 9a959

The change exercises existing fitting APIs with synthetic data in temporary directories and separate measurement processes. No introduced or worsened risk materially affecting security, failure containment, rollback, or ownership was established.

Pre-merge checks: Passed 3

Check name Status Explanation
Change Map Design Review Passed Summary: The change map (conversation comment 6934261163, marker <!-- kumo-pr-change-map -->) is a sound design record for one report-only test. Its design, scope, verification and stopping cond…
Pr Size Passed The PR size check fails only when the changed-file count exceeds 40. The reviewed range refs/coderabbit/pre-merge-check/base..head changes exactly one file: `packages/experimental/kumo-pytorch/tests…
Public Resource Access Passed The pull request changes one file, packages/experimental/kumo-pytorch/tests/test_fitting_memory.py (new, +113 lines). A search of the added diff lines for URLs, git/pip/uv install sources, package i…
Full details: Change Map Design Review

Explanation

Summary: The change map (conversation comment 6934261163, marker &lt;!-- kumo-pr-change-map --&gt;) is a sound design record for one report-only test. Its design, scope, verification and stopping condition match the code and the PR description. Some explanations are incomplete. They do not make the proposed design wrong, so this check passes. Corrections are listed below as refinements. Evidence checked - The map's single row covers packages/experimental/kumo-pytorch/tests/test_fitting_memory.py, the only file in the reviewed range (A, +113 lines). The symbols it names (CONTRACT, _engine, _fit, the test) exist in the file. - The code matches the map's mechanism. prepare builds the index in the parent process (line 95–96). Each anchor count runs _fit in a separate spawned process that only reopens the index (lines 104–106). _fit resets the peak RSS with clear_refs and reads VmHWM after materialize (lines 68–70). - The map's "smallest change" holds. No production code changed. The test sits under the existing t2b marker (lines 74–75), and conftest.py defines that marker as run only with --t2b. - The verification numbers match the PR description. The two runs differed by 1.0 and 1.2 MiB, so "within 1.2 MiB" is accurate. - The "no test or benchmark reports fitting memory by anchor count" claim is not contradicted. Searches found other RSS and tracemalloc measurements in packages/diskgraph benchmarks, packages/kumo-engine/test, and test/train. None measures fitting by anchor count. A 400k or 400,000 search found no such test in kumo-pytorch. - The "kumo-pytorch 1.2 test plan" requirement cannot be verified. No test plan document is in the checkout. I treat it as a stated requirement, not as proven. Omitted or incomplete explanations (refinements, not design defects) 1. No CI job runs the test. The map says "under the existing t2b marker, with no workflow change." A reader could assume the nightly T2b job covers it. In .github/workflows/kumo-pytorch-t2b.yml, the pytest step runs only tests/e2e/test_lifecycle.py. The description states this. The map should state it too. Suggested text: "No CI job runs this test. The stopping condition is met by a manual --t2b run until the T2b workflow is changed (deferred; see #361 and #353)." 2. Skip paths are not in the stopping condition. The test skips when /proc/self/clear_refs is missing, diskgraph is missing, or pyarrow is missing. A skipped run does not print the line. The map should say that a skipped run does not meet the stopping condition. 3. Cross-test import is not disclosed. The test imports SCHEMA from tests.test_anchor_tables and the private helper _write_parquet from tests.test_diskgraph_backend. The map says it "reuses the Parquet helper." It should name the private import and the coupling. Moving the helper to a shared module is an optional refinement. 4. Scope of the "no test" claim. The map should limit the claim to kumo-pytorch tests, since other repository areas do measure memory. Uncertain design question (not a defect) - A report-only test in tests/ with no CI job is a weak home for a recurring memory measurement. A benchmark script or a CI job that records the output may fit better. This is a judgment call. The author chose the smallest change and states the deferral. No proven defect or wrong design was found. The verdict is PASS.

Full details: Pr Size

Explanation

The PR size check fails only when the changed-file count exceeds 40. The reviewed range refs/coderabbit/pre-merge-check/base..head changes exactly one file: packages/experimental/kumo-pytorch/tests/test_fitting_memory.py, which is added (A). The count is 1, which is well under the threshold of 40. Line counts are ignored by the check, so no split recommendation applies.

Full details: Public Resource Access

Explanation

The pull request changes one file, packages/experimental/kumo-pytorch/tests/test_fitting_memory.py (new, +113 lines). A search of the added diff lines for URLs, git/pip/uv install sources, package indexes, registries, bucket paths, and wheel or tarball references found no matches. The file's imports (kumo.pytorch.api, tests.test_anchor_tables, tests.test_diskgraph_backend) and its pytest.importorskip calls refer to local packages or the test environment, not to external URLs or package source locations. The only links in the PR are in the PR description (a change-map comment on the same PR, plus issue references #361 and #353). These are not added to the repository and are not required to understand, build, or run the changed code, so they fall outside this check's scope. No added or modified external resource reference requires an access test, so the check passes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 72bbcbd and 9a95955.

Files selected for processing: 1

  • packages/experimental/kumo-pytorch/tests/test_fitting_memory.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@anle2024
anle2024 marked this pull request as ready for review November 17, 2026 00:55
The child process used to generate the data and build the index before
it reset the peak RSS. Fitting reused the memory that this work freed,
so the reported numbers were 2 to 2.5 times too low. The test process
now writes the data and builds the index once, and each child only
reopens the index and fits. The job-summary write is gone, because no
workflow runs this test yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@anle2024
anle2024 temporarily deployed to gha-kumo-workflow-tests November 17, 2026 01:03 — with GitHub Actions Inactive
@anle2024

Copy link
Copy Markdown
Collaborator Author

Closing in favor of #353. Its commit c9bf93e adds the same 25k/400k fitting-memory runs on real AML data to the nightly job.

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — 9a95955e Deployed Nov 17, 2026 by anle2024 via import #2465
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