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
On Apple Silicon, I'd like to be able to set the maximum count of worker threads to the number of performance cores, rather than all. Nim's built-in CPU count proc is unaware of perf levels on AS. I assume the same is the case for later Intel CPUs.
I'm using this workaround right now:
ifhostOS=="macosx"andhostCPU=="arm64"andcpuEndian==Endianness.littleEndian:
echo"Apple Silicon detected, tuning parallel runtime to use perflevel0 only"# sysctl hw.perflevel0.logicalcpu_max# hw.perflevel0.logicalcpu_max: 8 let outp =execProcess(
"/usr/sbin/sysctl",
args = ["hw.perflevel0.logicalcpu_max"],
options = { poStdErrToStdOut }
)
let perfCores = outp.split(": ")[1].strip.parseInt
echo&"Detected {perfCores} cores at perflevel0"putEnv("WEAVE_NUM_THREADS", $perfCores)
This works, and macOS scheduler seems to pin the threads to the right cores. It'd be nice for Weave to be aware of this natively, and to be able to allow one to specify cores to init directly without the round-trip through the environment, e.g.:
init(Weave, threads =42, [perfLevel = all, performanceOnly])
No opinion on whether a potentially set ENV var should override this init parameter.
The text was updated successfully, but these errors were encountered:
On Apple Silicon, I'd like to be able to set the maximum count of worker threads to the number of performance cores, rather than all. Nim's built-in CPU count proc is unaware of perf levels on AS. I assume the same is the case for later Intel CPUs.
I'm using this workaround right now:
This works, and macOS scheduler seems to pin the threads to the right cores. It'd be nice for Weave to be aware of this natively, and to be able to allow one to specify cores to
init
directly without the round-trip through the environment, e.g.:No opinion on whether a potentially set ENV var should override this init parameter.
The text was updated successfully, but these errors were encountered: