# Use either X CPU or Y GPU for a task

**URL:** <https://discuss.ray.io/t/use-either-x-cpu-or-y-gpu-for-a-task/12792>\
**Category:** Uncategorized\
**Created:** [November 11, 2023, 8:45am UTC](https://discuss.ray.io/t/use-either-x-cpu-or-y-gpu-for-a-task/12792 "2023-11-11T08:45:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vdusserr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/vdusserr/32/5328_2.png) [@vdusserr](https://discuss.ray.io/u/vdusserr)\
**Post date:** [November 11, 2023, 8:45am UTC](https://discuss.ray.io/t/use-either-x-cpu-or-y-gpu-for-a-task/12792/1 "2023-11-11T08:45:43Z")

</div>

Hi,

I’m trying to setup parallel training of independent models and I would like to be able to parallel my training procedure, in a way that it can be either processed on X amount of cpus OR Y amount of gpus.  
If I do @ray.remote(num\_cpus=X, num\_gpus=Y) then it will give to that task both X and Y resources whereas I want this to work:  
If I have 32 cpus and 4 gpus and a task consumes either 8 cpus or 1 gpu then I want to be able to parallel 8 jobs at the same time

Is there a way to do this with Ray ?

Thanks

Valentin
