Skip to content

[C++] Default thread count should count process affinity into account #45860

@pitrou

Description

@pitrou

Describe the enhancement requested

When using something like taskset to reduce the number of CPUs actually usable by the current process, Arrow C++ should also limit its number of CPU threads to avoid thread oversubscription:

Compare with what Python does:

$ ipython
>>> import os
>>> os.process_cpu_count()
24
>>> from multiprocessing.pool import ThreadPool
>>> pool = ThreadPool()
>>> pool._processes
24
>>> import pyarrow as pa
>>> pa.cpu_count()
24

$ taskset -c 1,2,3 ipython
>>> import os
>>> os.process_cpu_count()
3
>>> from multiprocessing.pool import ThreadPool
>>> pool = ThreadPool()
>>> pool._processes
3
>>> import pyarrow as pa
>>> pa.cpu_count()
24

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions