Automatically assign resources based on serialized form of functions#3036
Automatically assign resources based on serialized form of functions#3036mrocklin wants to merge 3 commits into
Conversation
This commit adds functionality to the scheduler to automatically assign resources to tasks based on terms found in their serialized forms. This would be useful, for example, to direct all tasks with cupy, cudf, torch, or tensorflow module names in their serialized form, to be automatically tagged with a GPU resource tag. This would simplify deploying GPU systems considerably, and would also allow for nicer mixed CPU/GPU workloads. This should maybe be coupled, in the future, with code that automatically assigns resources based on the presence of GPUs.
|
I'm not familiar with the scheduler code, thus I'm having some difficulty understanding what are the effects that this feature adds in practice, could you clarify that @mrocklin? |
|
We can optionally make it so that every task whose serialized form contains the terms This would help in two ways:
This uses a rarely used feature documented here: https://distributed.dask.org/en/latest/resources.html |
Whose "we" in this case? Do you envision the default |
No. I do not think that this should be the default (it adds a couple microseconds per task) (which is a small, but not-insignificant time). But it would make it so that this behavior would just be a configuration change. We can easily ship around config file snippets. I do think that it might make sense to automatically register a |
|
Thanks for clarifying @mrocklin. I can see how this is helpful now and I agree this is something nice to have, in fact, we had already users asking for ways to do this in rapidsai/dask-cuda#108. My only comment is that we could have some short documentation here to let users know this is supported and make it easily searchable. Apart from that, PR is +1 from me. Thanks for working on it @mrocklin. |
|
Actually, I think the documentation is mostly covered in https://distributed.dask.org/en/latest/resources.html already. So perhaps there's nothing that we really need to do here, and only add a comment later on if we add something by default, as per your sample in #3036 (comment). |
|
Just in case people are still waiting for more feedback, from my side, this is +1 for merging. |
Co-Authored-By: James Bourbeau <jrbourbeau@users.noreply.github.com>
jrbourbeau
left a comment
There was a problem hiding this comment.
This generally looks good to me, thanks @mrocklin. Could you add a section to https://distributed.dask.org/en/latest/resources.html about this?
|
I would like to wait on merging this until I have some time to play with it in the wild if that's ok. cc @jacobtomlinson @rjzamora one of you might also find this interesting. The goal here would be to let dask-workers have many threads, but we would identify which tasks were GPU tasks and only run one of them at a time. This would allow us to use the full CPU for things on the CPU and use the GPU efficiently with only one thread. |
This commit adds functionality to the scheduler to automatically assign
resources to tasks based on terms found in their serialized forms.
This would be useful, for example, to direct all tasks with cupy, cudf,
torch, or tensorflow module names in their serialized form, to be
automatically tagged with a GPU resource tag. This would simplify
deploying GPU systems considerably, and would also allow for nicer mixed
CPU/GPU workloads.
This should maybe be coupled, in the future, with code that
automatically assigns resources based on the presence of GPUs.
In practice, I'm thinking that, at least for GPU computing, we might do something like the following:
This isn't perfect, but I'll bet that it does a decent job in practice. This is free in the common case that nothing is registered. I'm inclined to try this for a while and possibly remove it without warning in the future.
cc @pentschev