[Core] CPU count in available_resources() does not match CPU count from psutil
What happened + What you expected to happen
I'm running Ray Tune on a Paperspace machine that has 8 CPUs, but I noticed from the Tune dashboard that there are only 5 CPUs available. If I run psutil.cpu_count(logical=False) or psutil.cpu_count(logical=True) I get a CPU count of 8 as expected, but if I run ray.init() and then ray.available_resources(), I get a CPU count of 5.
Versions / Dependencies
Python: 3.9.16 Ray: 2.40
Reproduction script
import psutil import ray
print(psutil.cpu_count(logical=False)) print(psutil.cpu_count(logical=True))
ray.available_resources()
Issue Severity
Medium: It is a significant difficulty but I can work around it.
@ericbhanson do you have anything else running when you run this script?
@scv119 It’s running inside of a Jupyter notebook. Otherwise I’m not aware of anything else running.
@scv119 I just tried running it within a terminal inside of Paperspace's interface and I'm getting the same CPU count.
@scv119 there's also this message when Ray initializes that might be helpful:
Ray currently does not support initializing Raywith fractional cpus. Your num_cpus will be truncated from 5.985 to 5.
Also I want to note that I'm now running on Ray 2.5 instead of 2.4.
Thanks @ericbhanson ! I will try repro on my end.
Not sure why, but a more recent release seems to have fixed the issue, as I'm no longer seeing. Closing...