-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a benchmark for take #1519
base: main
Are you sure you want to change the base?
Add a benchmark for take #1519
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,6 +5,7 @@ | |||||||||||||||
import dask.array as da | ||||||||||||||||
import numpy as np | ||||||||||||||||
import pytest | ||||||||||||||||
from dask.core import flatten | ||||||||||||||||
from dask.utils import parse_bytes | ||||||||||||||||
|
||||||||||||||||
from ..utils_test import ( | ||||||||||||||||
|
@@ -257,3 +258,29 @@ def test_map_overlap_sample(small_client, new_array): | |||||||||||||||
x = new_array((10000, 10000), chunks=(50, 50)) # 40_000 19.5 kiB chunks | ||||||||||||||||
y = x.map_overlap(lambda x: x, depth=1) | ||||||||||||||||
y[5000:5010, 5000:5010].compute() | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
def _create_indexer(n, chunk_n): | ||||||||||||||||
idx = np.arange(0, n) | ||||||||||||||||
np.random.shuffle(idx[: n // 10]) | ||||||||||||||||
|
||||||||||||||||
indexer = [] | ||||||||||||||||
for i in range(0, n, chunk_n): | ||||||||||||||||
indexer.append(idx[i : i + chunk_n].tolist()) | ||||||||||||||||
return indexer | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
def test_take(small_client, new_array): | ||||||||||||||||
n = 2000 | ||||||||||||||||
chunk_n = 250 | ||||||||||||||||
x = new_array((n, n, n), chunks=(chunk_n, chunk_n, chunk_n)) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Annotating some data sizes would be interesting. |
||||||||||||||||
indexer = list(flatten(_create_indexer(n, chunk_n))) | ||||||||||||||||
x[:, indexer, :].sum().compute() | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
# def test_shuffle(small_client, new_array): | ||||||||||||||||
# n = 2000 | ||||||||||||||||
# chunk_n = 250 | ||||||||||||||||
# x = new_array((n, n, n), chunks=(chunk_n, chunk_n, chunk_n)) | ||||||||||||||||
# indexer = _create_indexer(n, chunk_n) | ||||||||||||||||
# x.shuffle(indexer, axis=1).sum().compute() | ||||||||||||||||
Comment on lines
+280
to
+286
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should have converted to draft, I don't want to merge this before shuffle is available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this test based on some real-world use case? If so, some context would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the smallest thing that the current implementation can still handle in reasonable time... everything bigger blows up