You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GH-45860: [C++] Respect CPU affinity in cpu_count and ThreadPool default capacity (#47152)
### Rationale for this change
We want the ThreadPool default capacity to follow the CPU affinity set by the user, if any.
For example:
```console
$ python -c "import pyarrow as pa; print(pa.cpu_count())"
24
$ taskset -c 5,6,7 python -c "import pyarrow as pa; print(pa.cpu_count())"
3
```
### What changes are included in this PR?
- Implement and expose CPU affinity detection as a utility function in `arrow/io_util.h`; on non-Linux platform, it returns `Status::NotImplemented`
- Use CPU affinity count, if available, to choose the default ThreadPool capacity
(note: based on original changes by Zihan Qi in PR #46034)
### Are these changes tested?
By unit tests on CI, and by hand locally.
### Are there any user-facing changes?
ThreadPool capacity now follows CPU affinity settings on Linux.
* GitHub Issue: #45860
Lead-authored-by: AntoinePrv <[email protected]>
Co-authored-by: Zihan Qi <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
0 commit comments