# Spread trials evenly with fractional gpu resources

**URL:** <https://discuss.ray.io/t/spread-trials-evenly-with-fractional-gpu-resources/15924>\
**Category:** Ray Tune\
**Created:** [September 30, 2024, 11:23pm UTC](https://discuss.ray.io/t/spread-trials-evenly-with-fractional-gpu-resources/15924 "2024-09-30T23:23:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex\_koch](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@alex\_koch](https://discuss.ray.io/u/alex_koch)\
**Post date:** [September 30, 2024, 11:23pm UTC](https://discuss.ray.io/t/spread-trials-evenly-with-fractional-gpu-resources/15924/1 "2024-09-30T23:23:26Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- Medium: It contributes to significant difficulty to complete my task, but I can work around it.

I’m using tune.run with resources\_per\_trial=dict(gpu=0.2) on a cluster with 2 GPUs. Unfortunately, ray places the first five trials on the same GPU. I would like to spread the trials evenly on both GPUs. And I’m not setting the required fractional gpu higher because I don’t know how many trials I’ll launch in advance. Is it possible to do this?

---

<div class="post-metadata">

**Author:** ![justinvyu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/justinvyu/32/4309_2.png) [@justinvyu](https://discuss.ray.io/u/justinvyu)\
**Post date:** [November 8, 2024, 1:57am UTC](https://discuss.ray.io/t/spread-trials-evenly-with-fractional-gpu-resources/15924/2 "2024-11-08T01:57:26Z")

</div>

Is it possible to change the resource per trial fractional GPU requirement so that you get the desired spread? (ex: `"GPU": 0.3` to spread 5 trials onto 2 GPUs)

Note that the GPU resource allocation is purely logical and is used to assign the correct GPU ids to workers. You still need to limit the GPU utilization in your user code.

---

<div class="post-metadata">

**Author:** ![alex\_koch](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@alex\_koch](https://discuss.ray.io/u/alex_koch)\
**Post date:** [November 8, 2024, 2:46am UTC](https://discuss.ray.io/t/spread-trials-evenly-with-fractional-gpu-resources/15924/3 "2024-11-08T02:46:48Z")

</div>

That works if I know in advance how many trials I want to run. But usually I don’t know that before starting the first trials and would like ray to automatically spread the trials evenly.
