# Enforcing CPU-only defaults while reserving specific tasks for GPU nodes in Ray cluster

**URL:** <https://discuss.ray.io/t/enforcing-cpu-only-defaults-while-reserving-specific-tasks-for-gpu-nodes-in-ray-cluster/23334>\
**Category:** Uncategorized\
**Created:** [November 24, 2025, 6:06pm UTC](https://discuss.ray.io/t/enforcing-cpu-only-defaults-while-reserving-specific-tasks-for-gpu-nodes-in-ray-cluster/23334 "2025-11-24T18:06:32Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RunLLM](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/runllm/32/8249_2.png) [@RunLLM](https://discuss.ray.io/u/RunLLM)\
**Post date:** [November 24, 2025, 6:07pm UTC](https://discuss.ray.io/t/enforcing-cpu-only-defaults-while-reserving-specific-tasks-for-gpu-nodes-in-ray-cluster/23334/2 "2025-11-24T18:07:40Z")

</div>

There is currently no built-in Ray feature to globally restrict scheduling of non-GPU tasks to only CPU nodes, or to make GPU nodes “opt-in” for only GPU-requiring tasks, without annotating every @ray.remote call or using custom resources/labels. The Ray scheduler prefers to use available nodes, so CPU-only tasks may be scheduled on GPU nodes if those nodes have available CPUs, unless you explicitly prevent it via resource requirements or by setting num\_cpus=0 on GPU nodes (which, as you noted, is brittle and can break code expecting CPUs) [[Ray GitHub Issue #47866](https://github.com/ray-project/ray/issues/47866)] [[Ray Discuss: How to prevent scheduling non-GPU tasks to GPU nodes](https://discuss.ray.io/t/how-to-prevent-scheduling-non-gpu-tasks-to-gpu-nodes/15139)].

Best practices today are: (1) use custom resources or node labels to tag CPU nodes and require those resources for CPU tasks, but this does require updating all relevant @ray.remote calls; (2) set num\_cpus=0 on GPU nodes, but then you must use a custom resource for all tasks, which is not ideal; (3) use placement groups or node affinity for fine-grained control, but this also requires code changes. There is ongoing discussion and feature requests for a more Kubernetes-like taints/tolerations or “opt-in” scheduling model, but it is not yet implemented [[Ray GitHub Issue #47866](https://github.com/ray-project/ray/issues/47866)] [[Ray Discuss: Heterogeneous clusters](https://discuss.ray.io/t/can-ray-dataset-facilitate-training-on-heterogeneous-clusters/8596)]. Would you like more detail or code examples for any of these approaches?

Sources:

- [Ray GitHub Issue #47866](https://github.com/ray-project/ray/issues/47866)
- [Ray Discuss: How to prevent scheduling non-GPU tasks to GPU nodes](https://discuss.ray.io/t/how-to-prevent-scheduling-non-gpu-tasks-to-gpu-nodes/15139)
- [Ray Discuss: Heterogeneous clusters](https://discuss.ray.io/t/can-ray-dataset-facilitate-training-on-heterogeneous-clusters/8596)

Hint: Mention @RunLLM in the post for followups.

---

_[View the full topic](https://discuss.ray.io/t/enforcing-cpu-only-defaults-while-reserving-specific-tasks-for-gpu-nodes-in-ray-cluster/23334)._
