Skip to content

bump: uint16 overflow, unbounded default count, and closure serialization OOM #1206

Description

@brendancol

Describe the bug

bump() has three problems that produce wrong results or OOM on large rasters.

uint16 coordinate overflow (bump.py:295): locs uses dtype=np.uint16, so any dimension over 65,535 wraps silently. A coordinate of 70,000 becomes 4,464. Bumps land in the wrong place with no warning.

Unbounded default count (bump.py:289): When count is omitted it defaults to w * h // 10. That's 419,430 bumps at 2048x2048. For a 30TB raster (~174k x 174k) it's roughly 3 billion -- about 30 GB just for locs and heights before any work starts.

Full locs/heights arrays in every dask chunk closure (bump.py:48-99): _bump_dask_numpy and _bump_dask_cupy close over the full locs and heights. Each chunk in the task graph gets its own serialized copy. At 2048x2048 default count with 128x128 chunks that's 5 MB per chunk across 256 chunks = 1.29 GB of graph payload.

Expected behavior

  • Coordinates should work for rasters wider/taller than 65,535 px without silent truncation.
  • Default count should cap at a reasonable ceiling for large inputs.
  • Dask closures should only carry bumps that fall within each chunk's spatial extent (plus spread padding).

Benchmark (512x512, count=100)

Backend Wall time (ms) Peak traced (MB)
numpy 0.52 23.01
dask+numpy 22.0 17.96

Closure serialization (2048x2048, default count=419,430)

  • Per-chunk payload: 5.03 MB
  • 256 chunks: 1.29 GB total
  • At 30TB scale the graph serialization alone blows past available memory

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingoomOut-of-memory risk with large datasetsperformancePR touches performance-sensitive code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions