Skip to content
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
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

jrbourbeau
Copy link
Member

xref #725



def test_rechunk(rechunk_client, s3_url):
x = da.random.random((5_000, 5_000, 5_000, 2), chunks="50 MB") # 1.82 TiB
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: Replace this with some public Zarr dataset on AWS

@jrbourbeau jrbourbeau added the workflows Related to representative Dask user workflows label Mar 30, 2023
@jrbourbeau jrbourbeau changed the title Add rechunking workflow [WIP] Add rechunking workflow Mar 30, 2023
def test_rechunk(rechunk_client, s3_url):
x = da.from_zarr("s3://mur-sst/zarr", component="sea_ice_fraction") # 3.80 TiB
y = x.rechunk("200 MB")
y.to_zarr(s3_url)
Copy link
Member

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.

Copy link

@rabernat rabernat Mar 31, 2023

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.

Screen Shot 2023-03-30 at 8 34 37 PM

Try something like

x = da.from_zarr("s3://yuvipanda-test1/cmr/gpm3imergdl.zarr/HQprecipitation")
y = x.rechunk((-1, 36, 180))

Copy link
Member

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?

Copy link
Member

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.

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.

Copy link
Member Author

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

Try something like

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?

Copy link
Member Author

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)?

Copy link
Member Author

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

Copy link

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.

@jrbourbeau
Copy link
Member Author

Interestingly I'm not able to reproduce the zarr.errors.ReadOnlyError: object is read-only failures that we're seeing in CI locally (even when using the CI bot's credentials). Here's an example of me running the rechunk test on my laptop https://cloud.coiled.io/clusters/180635/overview?account=dask-benchmarks. Will need to look into why this is happening

@rabernat
Copy link

Interestingly I'm not able to reproduce the zarr.errors.ReadOnlyError: object is read-only failures

These have been cropping up everywhere. 🤦 See zarr-developers/zarr-python#1353. Should be fixed in Zarr 2.14.2.

@jrbourbeau
Copy link
Member Author

Ah, great. Thanks @rabernat!

Comment on lines 9 to 37
@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["embarrassingly_parallel_cluster"],
) as cluster:
yield cluster


@pytest.fixture
def rechunk_client(
rechunk_cluster,
cluster_kwargs,
upload_cluster_dump,
benchmark_all,
):
n_workers = cluster_kwargs["embarrassingly_parallel_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
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll eventually want to move these into a utility somewhere for better reusability, but for now I'm just copy-and-pasting form other tests

def test_rechunk(rechunk_client, s3_url):
x = da.from_zarr("s3://mur-sst/zarr", component="sea_ice_fraction") # 3.80 TiB
y = x.rechunk("200 MB")
y.to_zarr(s3_url)
Copy link
Member Author

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

Try something like

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?

@hendrikmakait
Copy link
Member

@jrbourbeau: Is there anything you need help with to get this over the finish line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workflows Related to representative Dask user workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants