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

[data] Log a warning if the batch size is misconfigured in a way that would grossly reduce parallelism for actor pool. #34594

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

ericl
Copy link
Contributor

@ericl ericl commented Apr 19, 2023

Why are these changes needed?

In a situation such as:

import ray
import time

def slow_model(x):
    time.sleep(1)
    return x

# This will try to batch 4096 elements into 1 task! resulting in no parallelism.
ds = ray.data.range(100).map_batches(
     slow_model, compute=ray.data.ActorPoolStrategy(size=4),
     batch_size=4096)
ds.show()

Print a warning after execution completes that the batch size is too large.

Signed-off-by: Eric Liang <ekhliang@gmail.com>
Signed-off-by: Eric Liang <ekhliang@gmail.com>
f"should be at most {max_desired_batch_size}. Your configured batch "
f"size for this operator was {self._min_rows_per_bundle}."
)
elif len(self._output_metadata) < min_workers:
Copy link
Contributor

Choose a reason for hiding this comment

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

even if there are a small number of blocks, if the batch size is small, this can still be parallelized across multiple actors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe we ever auto split blocks due to batch size (only ever coalesce blocks up to the min batch size if the user explicitly specifies it).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see...I thought it was using the same mechanism as for iter_batches

@ericl ericl merged commit 3e2ea4c into ray-project:master Apr 19, 2023
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
… would grossly reduce parallelism for actor pool. (ray-project#34594)

Signed-off-by: elliottower <elliot@elliottower.com>
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
… would grossly reduce parallelism for actor pool. (ray-project#34594)

Signed-off-by: Jack He <jackhe2345@gmail.com>
architkulkarni pushed a commit to architkulkarni/ray that referenced this pull request May 16, 2023
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.

3 participants