Skip to content

Scatter estimator in ParallelPostFit - #843

Closed
rikturr wants to merge 2 commits into
dask:mainfrom
rikturr:parallel-post-fit-scatter
Closed

rikturr wants to merge 2 commits into
dask:mainfrom
rikturr:parallel-post-fit-scatter

Conversation

@rikturr

@rikturr rikturr commented Jul 2, 2021

Copy link
Copy Markdown
Contributor

closes #842

Functionality of ParallelPostFit is the same, except behind the scenes it now scatters the scikit-learn estimator if running with a distributed cluster. Compared to existing functionality showcased in #842 where scheduler memory increases by npartitions * estimator size, the memory increase is now just estimator size for a quick blip while it gets shipped out to the workers

Screen Shot 2021-07-02 at 1 21 26 PM

Aaron Richter added 2 commits July 2, 2021 13:02
@mrocklin

mrocklin commented Jul 2, 2021

Copy link
Copy Markdown
Member

Thank you for tracking this down @rikturr . A couple of questions/comments

  1. Does this still work if things are run in async mode? (if they worked before, that is)
  2. Do you have thoughts on how to test this?
  3. You might want to try wrapping the estimator in dask.delayed instead. That should handle the deduplication. Actually, this is already an optimization in map_partitions and map_blocks. We wrap keywords with large sizeof values in dask.delayed in order to avoid duplication. It might be wise to track down why that didn't occur. That might lead you to a more general fix.

@rikturr

rikturr commented Jul 2, 2021

Copy link
Copy Markdown
Contributor Author

@mrocklin

  1. Looking into the docs for async mode and will report back
  2. Broadly, I was thinking that a good way to test this and potentially other issues is to have some integration tests set up that would allow for more/larger tests with distributed clusters. Is something like that available or in the works? For this specific situation, it can be reproduced with a LocalCluster so should be able to cover in unit tests. I'm not sure if there's a way to get scheduler memory use programatically from dask? I think that could be a good way to verify that dups aren't being sent
  3. Ah, I didn't realize that map_partitions and map_blocks already check object sizes but that makes a lot of sense. So the better solution would be to make sure that the estimator does get delayed so we don't have to change anything in dask-ml (or xgboost, or lightgbm, etc). Looks like sys.getsizeof() on scikit-learn estimators doesn't return the accurate size. Checking the size with pickle does though:

image

Do you think its reasonable to have map_partitions and map_blocks use pickle+getsizeof to get the proper size? Might introduce some latency. Perhaps there's another way to get a more accurate size

@mrocklin

mrocklin commented Jul 2, 2021 via email

Copy link
Copy Markdown
Member

@rikturr

rikturr commented Jul 2, 2021

Copy link
Copy Markdown
Contributor Author

closing in favor of fix for root issue: dask/dask#7860

@rikturr rikturr closed this Jul 2, 2021
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.

ParallelPostFit excessive scheduler memory use and CancelledError

2 participants