# Can we make ray evenly schedule tasks on different GPUs?

**URL:** <https://discuss.ray.io/t/can-we-make-ray-evenly-schedule-tasks-on-different-gpus/339>\
**Category:** Ray Core\
**Created:** [December 29, 2020, 7:05pm UTC](https://discuss.ray.io/t/can-we-make-ray-evenly-schedule-tasks-on-different-gpus/339 "2020-12-29T19:05:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icarus](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/icarus/32/202_2.png) [@Icarus](https://discuss.ray.io/u/Icarus)\
**Post date:** [December 29, 2020, 7:05pm UTC](https://discuss.ray.io/t/can-we-make-ray-evenly-schedule-tasks-on-different-gpus/339/1 "2020-12-29T19:05:46Z")

</div>

Hi guys. I am facing a problem here.

I have a computation task that roughly utilizes 70% of single GPU computation power but with little consumption of the memory. Ideally, I want to put two tasks on a single to fully utilize the resources. In my code, I set `num_gpus=0.5` for each task.

When I run 8 tasks on a server with 4 GPUs, everything works as expected. However, if I only run 4 tasks, these tasks will only be scheduled on 2 GPUs, leaving the other two unused. I understand ray is trying to save the card for other tasks that may require a whole GPU. But it is not efficient in my case. Is there any hack that I can use to make the 4 tasks scheduled evenly on 4 cards?

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [January 4, 2021, 6:28pm UTC](https://discuss.ray.io/t/can-we-make-ray-evenly-schedule-tasks-on-different-gpus/339/2 "2021-01-04T18:28:04Z")

</div>

cc @Alex Isn’t it just supposed to be running on 4 gpus? Can you answer his question?

---

<div class="post-metadata">

**Author:** ![Alex](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/alex/32/341_2.png) [@Alex](https://discuss.ray.io/u/Alex)\
**Post date:** [January 4, 2021, 6:47pm UTC](https://discuss.ray.io/t/can-we-make-ray-evenly-schedule-tasks-on-different-gpus/339/3 "2021-01-04T18:47:44Z")

</div>

Hmmm there isn’t really a good way to change the scheduling behavior here. One hack you could do is to split your machine into 4 virtual nodes, then use [placement groups](https://docs.ray.io/en/master/placement-group.html) with a SPREAD policy for your tasks. It admittedly isn’t very elegant, but it should work.

---

<div class="post-metadata">

**Author:** ![Icarus](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/icarus/32/202_2.png) [@Icarus](https://discuss.ray.io/u/Icarus)\
**Post date:** [January 11, 2021, 2:34am UTC](https://discuss.ray.io/t/can-we-make-ray-evenly-schedule-tasks-on-different-gpus/339/4 "2021-01-11T02:34:51Z")

</div>

Thanks for your reply. I will give it a try.
