# Placement group support in RaySGD?

**URL:** <https://discuss.ray.io/t/placement-group-support-in-raysgd/2530>\
**Category:** Ray Tune\
**Created:** [June 15, 2021, 9:17pm UTC](https://discuss.ray.io/t/placement-group-support-in-raysgd/2530 "2021-06-15T21:17:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![HuangLED](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/huangled/32/132_2.png) [@HuangLED](https://discuss.ray.io/u/HuangLED)\
**Post date:** [June 15, 2021, 9:17pm UTC](https://discuss.ray.io/t/placement-group-support-in-raysgd/2530/1 "2021-06-15T21:17:02Z")

</div>

I’ve read into the code a bit regarding placement group in RaySGD, but didn’t find an answer.

Let us say I have a cluster with two machines, A and B. I want to start 10 training processes on each machine. The learning relies on a in-memory data service, therefore we want to initialize training processes on A or B with different parameters (very simple just a Rank as int).

Is this already supported in RaySGD? I’ve read this PR: [[tune/placement group] dist. training placement group support by oliverhu · Pull Request #11934 · ray-project/ray · GitHub](https://github.com/ray-project/ray/pull/11934/files), as well as how TorchTrainer and TrainingOperators are implemented. But cannot tell for sure.

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![architkulkarni](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/architkulkarni/32/10_2.png) [@architkulkarni](https://discuss.ray.io/u/architkulkarni)\
**Post date:** [June 17, 2021, 4:55am UTC](https://discuss.ray.io/t/placement-group-support-in-raysgd/2530/2 "2021-06-17T04:55:35Z")

</div>

cc’ing @rliaw, who reviewed the linked PR–any thoughts about this?

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [June 20, 2021, 7:46am UTC](https://discuss.ray.io/t/placement-group-support-in-raysgd/2530/3 "2021-06-20T07:46:37Z")

</div>

Hmm, this is mainly supported for RaySGD + Ray TUne. However, TorchTrainer doesn’t have support for placement groups yet.

This should go onto our backlog; let me know if you would like us to prioritize it (or would be open to contributing this)! If interested, happy to guide you through the implementation.

---

<div class="post-metadata">

**Author:** ![HuangLED](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/huangled/32/132_2.png) [@HuangLED](https://discuss.ray.io/u/HuangLED)\
**Post date:** [June 25, 2021, 5:03pm UTC](https://discuss.ray.io/t/placement-group-support-in-raysgd/2530/4 "2021-06-25T17:03:16Z")

</div>

Sure thing. I’d happy to contribute to that if it is something that my bandwidth can handle. Let me first get a rough idea how much effort it takes.

I am thinking for the first step, we are gonna create something like this:

1. define number of workers for each placement group
2. RaySGD takes this mapping of placement group → num\_worker, then allocate worker accordingly.

Does this align with what you guys already thinking?

Not familiar with how RaySGD work under the hood yet. Will read a bit more into it. Any code pointer (e.g. similar functionality already exist in other modules, or tests are affected etc) or doc is much appreciated.

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [June 25, 2021, 6:15pm UTC](https://discuss.ray.io/t/placement-group-support-in-raysgd/2530/5 "2021-06-25T18:15:44Z")

</div>

Actually, I think it makes sense for Ray side maintainer to implement this. Will cc you on the review!

Could you help post a github issue so we can keep track of it?

---

<div class="post-metadata">

**Author:** ![HuangLED](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/huangled/32/132_2.png) [@HuangLED](https://discuss.ray.io/u/HuangLED)\
**Post date:** [June 25, 2021, 11:44pm UTC](https://discuss.ray.io/t/placement-group-support-in-raysgd/2530/6 "2021-06-25T23:44:04Z")

</div>

Done creating the issue. [[raysgd] Placement group support in RaySGD · Issue #16682 · ray-project/ray · GitHub](https://github.com/ray-project/ray/issues/16682)

Thanks, Richard!
