Fix bump OOM: int32 coords, count cap, per-chunk dask partitioning (#1206)#1208
Merged
brendancol merged 1 commit intomasterfrom Apr 16, 2026
Merged
Fix bump OOM: int32 coords, count cap, per-chunk dask partitioning (#1206)#1208brendancol merged 1 commit intomasterfrom
brendancol merged 1 commit intomasterfrom
Conversation
…oning (#1206) - Change locs dtype from uint16 to int32 to fix silent coordinate wrap-around for rasters with dimensions > 65535 - Cap default count (w*h//10) at 10M bumps to prevent unbounded eager allocation on large rasters - Add memory guard that raises MemoryError when bump arrays would exceed 50% of available RAM - Replace closure-based dask paths with per-chunk partitioning via dask.delayed + da.block, so each task only serializes its own bump subset instead of the entire locs/heights arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1206. Three issues in
bump()that cause wrong results and OOM on large rasters:locsuseddtype=np.uint16, so coordinates > 65,535 wrapped silently. Now usesint32.countdefaulted tow * h // 10with no ceiling. Now capped at 10M bumps, plus a memory guard that raisesMemoryErrorwhen the arrays would exceed 50% of available RAM._bump_dask_numpyand_bump_dask_cupycaptured the fulllocsandheightsarrays in every chunk closure. At 2048x2048 default count with 128x128 chunks, that was 5 MB/chunk across 256 chunks = 1.29 GB of graph payload. Now pre-partitions bumps by chunk usingdask.delayed+da.block, so each task only serializes its own subset. Graph serialization reduced ~250x.Test plan