Skip to content

Preserve chunksizes in vindex - #11330

Merged
hendrikmakait merged 2 commits into
dask:mainfrom
phofl:vindex-chunks
Aug 21, 2024
Merged

hendrikmakait merged 2 commits into
dask:mainfrom
phofl:vindex-chunks

Conversation

@phofl

@phofl phofl commented Aug 19, 2024 •

Copy link
Copy Markdown
Collaborator
  • Closes #xxxx
  • Tests added / passed
  • Passes pre-commit run --all-files

This was pretty bad, it just squashed the whole indexer into a single chunk, no matter how large / small the chunks along these dimensions were previously.

cc @dcherian this seems to be a common path in xarray with sel / isel if I am not missing something

Before:

Screenshot 2024-08-19 at 20 23 51

After:

Screenshot 2024-08-19 at 20 27 20
arr = xr.DataArray(np.random.rand(10_000 * 100).reshape(100, 100, 100), dims=['a', "b", "c"]).chunk(a=5, b=5, c=50)
indices_2d = xr.Variable(('x', 'y'), np.random.choice(np.arange(100), size=(50000, 2)))
arr.isel(a=indices_2d[:, 0], b=indices_2d[:, 0])

@github-actions

Copy link
Copy Markdown
Contributor

Unit Test Results

See test report for an extended history of previous test failures. This is useful for diagnosing flaky tests.

     13 files  ± 0       13 suites  ±0   2h 59m 27s ⏱️ - 2m 12s
 13 161 tests + 2   12 093 ✅ + 2   1 068 💤 ±0  0 ❌ ±0 
137 140 runs  +22  117 921 ✅ +24  19 219 💤  - 2  0 ❌ ±0 

Results for commit 6dcaf6a. ± Comparison against base commit 1ffe097.

@hendrikmakait hendrikmakait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @phofl! The code is a bit hard to decipher, but that's already been the case.

@hendrikmakait
hendrikmakait merged commit cda582c into dask:main Aug 21, 2024
@phofl
phofl deleted the vindex-chunks branch August 21, 2024 08:43
@phofl

phofl commented Aug 21, 2024

Copy link
Copy Markdown
Collaborator Author

Thanks, @phofl! The code is a bit hard to decipher, but that's already been the case.

Yeah, I hope that I only made it a little bit worse, the algorithm could use a rewrite at some point

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