Closed billtubbs closed 5 years ago
I found this project that had this issue and resolved it:
In the psutil documentation for cpu_affinity
it says:
Availability: Linux, Windows, FreeBSD
Hi, thanks for the question!
Short answer: to run on MacOS, comment out the lines with cpu_affinity
.
Longer answer:
Yes, my understanding is that the cpu_affinity
functionality is not available in MacOS. Some places in the code (like the sampler parallel worker), there's a try statement to protect against this. I must've left this out of the async code (developed a little later). Also the async code only really makes sense with GPUs, which I figured would be on Linux and not MacOS (but maybe so?). In general in MacOS I don't think you can control the cpu affinity of processes.
Why affinity: In some experiments I found sampling to run faster when assigning the CPU of each processes, so they stay on their own hardware lanes and the system doesn't get bogged down with the OS's cpu scheduler shifting processes all around. But it's not a hard and fast rule, just something to try for your own program. :)
Thanks. This makes sense. Maybe I shouldn't be trying to run this example. What's a good example script to get me started on Mac OS X with CPUs? (I'm just trying out this package for the first time and will transition to a linux-GPU machine once I figured it out).
Looks like examples/example_1.py
seems to be the best place to start. This is working now. Thanks.
Has anyone else had this error with
psutil
?Seems to be a problem with my
psutil
version on Mac OS. My current version is 5.6.3.This illustrates the root of the problem:
Full installation and execution details:
Or, maybe I shouldn't be trying to run this example on Mac OS with CPUs?