# ray.tune.Tuner resource configuration

**URL:** <https://discuss.ray.io/t/ray-tune-tuner-resource-configuration/12018>\
**Category:** Uncategorized\
**Created:** [September 4, 2023, 4:50am UTC](https://discuss.ray.io/t/ray-tune-tuner-resource-configuration/12018 "2023-09-04T04:50:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![runedog48](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@runedog48](https://discuss.ray.io/u/runedog48)\
**Post date:** [September 4, 2023, 4:50am UTC](https://discuss.ray.io/t/ray-tune-tuner-resource-configuration/12018/1 "2023-09-04T04:50:00Z")

</div>

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

- High: It blocks me to complete my task.

How do you specify the resource usage when using the new Tuner? I’ve tried several different ways, but nothing is working and I get the following:

Error  
`No trial resources are available for launching the actor`

Resources available  
`>> ray.available_resources()`  
`{'CPU': 16.0, 'node: __internal_head__': 1.0, 'node:172.22.193.158': 1.0, 'memory': 29689181799.0, 'object_store_memory': 14844590899.0}`

Implementation:  
[Pastebin](https://pastebin.com/uxkiVqqZ)

---

<div class="post-metadata">

**Author:** ![wyn](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wyn](https://discuss.ray.io/u/wyn)\
**Post date:** [September 4, 2023, 4:26pm UTC](https://discuss.ray.io/t/ray-tune-tuner-resource-configuration/12018/2 "2023-09-04T16:26:40Z")

</div>

There seems to be quite a few ways. Here is what I use

```auto
    tuner = ray.tune.Tuner(
        tune.with_resources(partial(main, **kwargs), {'cpu': cpus_per_trial, 'gpu': gpus_per_trial}),
        tune_config=ray.tune.TuneConfig(
            ...
        ),  
        param_space=config
    )   
    results = tuner.fit()

```

I give it a partial method from functools, and then I also pass it a dictionary of my resources per trial with the tune.with\_resources function.

---

<div class="post-metadata">

**Author:** ![kai](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/kai/32/3380_2.png) [@kai](https://discuss.ray.io/u/kai)\
**Post date:** [September 5, 2023, 8:19am UTC](https://discuss.ray.io/t/ray-tune-tuner-resource-configuration/12018/3 "2023-09-05T08:19:51Z")

</div>

Instead of `partial` it can be beneficial to use `tune.with_parameters` instead (especially when passing large objects).

But your code from the pastebin generally looks correct. The issue is that PPO itselfs tries to start actors, and there are not enough resources _in your placement group_ for them to start.

You can try building your PPOConfig in the `main()` function. Then you can use

```auto
pgf = ppo.PPO.default_resource_request(config)

```

to build the placement group factory automatically.

You can then pass the PPOConfig as a param\_space item to tune.Tuner.
