core_affinity_rs icon indicating copy to clipboard operation
core_affinity_rs copied to clipboard

Doesn't work on macOS Monterey.

Open nicholassm opened this issue 2 years ago • 6 comments

Hi,

I've tried the library successfully on Linux but on my development machine running macOS Monterey (version 12.6.3) it doesn't work with version 0.8.0 or 0.8.1 of this crate.

The Vec of available cores returned by core_affinity::get_core_ids() does contain the core I'm trying to pin to but the boolreturned from core_affinity::set_for_current(core_id) is false.

Are there any tricks I need to apply on Mac?

Kind regards, Nicholas

nicholassm avatar Sep 11 '23 18:09 nicholassm

I’ve noticed this on Sonoma on a Apple Silicon Mac as well. In fact tests on this repo catch the error:

running 4 tests
test macos::tests::test_macos_get_core_ids ... ok
test macos::tests::test_macos_set_for_current ... FAILED
test tests::test_get_core_ids ... ok
test tests::test_set_for_current ... FAILED

jeffutter avatar Nov 25 '23 05:11 jeffutter

Seems like Apple Silicon may not support this call (and core pinning may be less useful on this architecture due to all cores sharing a unified cache?). So I guess I’ll just log a warning for now.

jeffutter avatar Nov 25 '23 05:11 jeffutter

Having the same issue on the M1 Max with Ventura 13.2.1. Is there any other way to achieve the same thing?

nastynaz avatar May 01 '24 22:05 nastynaz

Apple Silicon likely doesn't support thread affinity due to its heterogeneous architecture, which consists of performance and efficiency cores.

cdolan avatar May 10 '24 01:05 cdolan