-
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
[WIP] Add rechunking workflow #752
Open
jrbourbeau
wants to merge
7
commits into
main
Choose a base branch
from
zarr-rechunk-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f49b06a
Add rechunking workflow
jrbourbeau b31a3d6
Public dataset
jrbourbeau 9ea6332
Update
jrbourbeau 4078210
Bump zarr version
jrbourbeau d003b16
Add full shuffle example
jrbourbeau 1a91f3b
Smaller cluster to stress rechunking
jrbourbeau a842065
Merge branch 'main' of https://github.com/coiled/coiled-runtime into …
jrbourbeau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import uuid | ||
|
||
import coiled | ||
import dask.array as da | ||
import pytest | ||
from dask.distributed import Client | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def rechunk_cluster( | ||
dask_env_variables, | ||
cluster_kwargs, | ||
github_cluster_tags, | ||
): | ||
with coiled.Cluster( | ||
f"test-rechunk-{uuid.uuid4().hex[:8]}", | ||
environ=dask_env_variables, | ||
tags=github_cluster_tags, | ||
**cluster_kwargs["rechunk_cluster"], | ||
) as cluster: | ||
yield cluster | ||
|
||
|
||
@pytest.fixture | ||
def rechunk_client( | ||
rechunk_cluster, | ||
cluster_kwargs, | ||
upload_cluster_dump, | ||
benchmark_all, | ||
): | ||
n_workers = cluster_kwargs["rechunk_cluster"]["n_workers"] | ||
with Client(rechunk_cluster) as client: | ||
rechunk_cluster.scale(n_workers) | ||
client.wait_for_workers(n_workers) | ||
client.restart() | ||
with upload_cluster_dump(client), benchmark_all(client): | ||
yield client | ||
|
||
|
||
def test_rechunk_simple(rechunk_client, s3_url): | ||
# Dataset is 3.80 TiB (https://registry.opendata.aws/mur) | ||
x = da.from_zarr( | ||
"s3://mur-sst/zarr", | ||
component="sea_ice_fraction", | ||
storage_options={"anon": True, "client_kwargs": {"region_name": "us-west-2"}}, | ||
) | ||
assert x.chunksize == (6443, 100, 100) # 61.45 MiB (dtype = int8) | ||
y = x.rechunk((6443, 100, 200)) # 122.89 MiB | ||
y.to_zarr(s3_url) | ||
|
||
|
||
def test_rechunk_full_shuffle(rechunk_client, s3_url): | ||
# Test a "full shuffle" rechunk where every input chunk goes into every output chunk | ||
# Dataset is 196.72 GiB | ||
x = da.from_zarr( | ||
"s3://yuvipanda-test1/cmr/gpm3imergdl.zarr/HQprecipitation", | ||
storage_options={"anon": True}, | ||
) | ||
y = x.rechunk((-1, 36, 180)) | ||
y.to_zarr(s3_url) | ||
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.
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.
@rabernat we're trying to establish a set of benchmarks for common workloads faced by Dask users. Ideally these are more realistic and less of toy examples.
We were inspired by your thoughts on reading in a dataset stored in one chunking and then performing an analysis in another. This is a quick proxy to that. Do you happen to have anything that we could use that would be better? In terms of complexity we'd love something in between 20-200 lines of code.
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.
The most difficult / pathological case to test is a "full shuffle" rechunk, where every input chunk goes into every output chunk.
I'd look at this dataset.
An array is at
s3://yuvipanda-test1/cmr/gpm3imergdl.zarr/HQprecipitation
... not quite as big as MUR but chunked contiguously in space.Try something like
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.
Thanks @rabernat . We're also trying to capture a broader set of common operations to keep things real-world-ish. These might eventually graduate into some sort of notebook repository with worked examples that people can take a look at. Is there some icing we could put on this particular cake? Maybe some common analysis and an image that would be produced for example?
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.
Or, maybe stated differently, @rabernat , what are 1-3 workflows you'd like run regularly as part of Dask's benchmark suite. These get used day-to-day by engineers as they run AB tests on various changes that they want to make. Workloads in this suite will naturally be optimized over time.
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.
I appreciate the chance to contribute to this. I'll try to follow up with more detail in the coming days.
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.
Thanks for the pointer @rabernat 🚀 Btw, what region is the dataset located in? I didn't see a region reference on the pangeo-force page or the corresponding feedstock
That example seems to run well (albeit with lots of transfers) when I try it here. I'm currently using a large cluster (~750GiB of memory) which is much bigger than the dataset itself (~200 GiB). Under what conditions do you tend to see bad performance? Maybe on a cluster with less memory than the dataset itself?
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.
Just wanted to check in here -- @rabernat do you have additional details that'd be useful here (e.g. some common follow-up operations/plots like Matt mentioned)?
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.
Just another gentle ping @rabernat
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.
Sorry for my slow response here. I would recommend you look at https://github.com/pangeo-data/distributed-array-examples/issues. This is our best attempt to collect the sort of workflows you're looking for from the Pangeo Community.