ray icon indicating copy to clipboard operation
ray copied to clipboard

[Core] CPU count in available_resources() does not match CPU count from psutil

Open ericbhanson opened this issue 2 years ago • 6 comments

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 avatar Jun 09 '23 15:06 ericbhanson

@ericbhanson do you have anything else running when you run this script?

scv119 avatar Jun 13 '23 00:06 scv119

@scv119 It’s running inside of a Jupyter notebook. Otherwise I’m not aware of anything else running.

ericbhanson avatar Jun 13 '23 02:06 ericbhanson

@scv119 I just tried running it within a terminal inside of Paperspace's interface and I'm getting the same CPU count.

ericbhanson avatar Jun 13 '23 23:06 ericbhanson

@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.

ericbhanson avatar Jun 15 '23 15:06 ericbhanson

Also I want to note that I'm now running on Ray 2.5 instead of 2.4.

ericbhanson avatar Jun 15 '23 15:06 ericbhanson

Thanks @ericbhanson ! I will try repro on my end.

rickyyx avatar Jun 15 '23 17:06 rickyyx

Not sure why, but a more recent release seems to have fixed the issue, as I'm no longer seeing. Closing...

ericbhanson avatar Jul 03 '23 20:07 ericbhanson