Sys.CPU_THREADS doesn't appear to get all my threads on Mac

On my Mac computer, Sys.CPU_THREADS=16, but in the terminal, sysctl -n hw.ncpu=24, which really implies I have 48 threads. I’m trying to use Distributed’s addprocs()=addprocs(Sys.CPU_THREADS) command, but it seems to not capture all available threads. I’m not pointing fingers at any package or bug, I’m just trying to find what I’m misunderstanding.

Thank you!

1 Like

What CPU do you have?

1 Like

I have the M2 Ultra.

From sysctl -a | grep machdep.cpu:

machdep.cpu.cores_per_package: 24
machdep.cpu.core_count: 24
machdep.cpu.logical_per_package: 24
machdep.cpu.thread_count: 24
machdep.cpu.brand_string: Apple M2 Ultra

So the M2 ultra has 16 big cores and 8 small cores. Julia is only telling you about the big cores because generally putting work on the little cores slows things down a bunch. See also jl_cpu_threads: exclude big.LITTLE efficency cores by staticfloat · Pull Request #42099 · JuliaLang/julia · GitHub

4 Likes

I see. Thank you for the quick responses, Oscar!