CPU utilization when using ray and torch

Viewed 366

I use ray and torch in my code and set one CPU core for each ray remote actor to compute gradient(use torch package). But I find the CPU utilization of the actor can go up to 300% in some time, This seems to be impossible since The actor is supposed to use only one CPU core. I want to know if the actor is actually using more CPU resources since torch may open one or more threads to compute gradient. My OS is Win10 and CPU is Ryzen 5600H. Thanks.

1 Answers

Ray currently does not automatically pin the actor to specific CPU cores and prevent it from using other CPU cores. So what you're seeing makes sense.

It is possible to use a library like psutil to pin the actor to a specific core and prevent it from using other cores. This can be helpful if you have many parallel tasks/actors that are all multi-threaded and competing with each other for resources (e.g., because they use pytorch or numpy).

Related