nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

commit 74299c8919cb2e2f6e1678817529e3a730cf6b81
parent 9a013b7c68f94e6be0fe8748c9012a441fe0273f
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon, 12 Jan 2026 21:29:39 +0100

Automatically detect number of threads for unix systems

Diffstat:
Mbuild.sh | 19++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/build.sh b/build.sh @@ -43,10 +43,23 @@ NODE=${NODE-${NISSY_BUILD_NODE:-"node"}} # The default value is 16. THREADS=${THREADS-${NISSY_BUILD_THREADS}} +portable_nproc() { + OS="$(uname -s)" + case "$OS" in + "Linux") + nproc + ;; + "Darwin" | "*BSD") + sysctl -n hw.ncpu + ;; + *) + echo "32" # A safe, large default + ;; + esac +} + detectthreads() { - # TODO: detect based on system - # Is 'getconf NPROCESSORD_ONLN' portable? Is it threads or cores? - echo "16" + echo "$(portable_nproc)" } [ -z "$THREADS" ] && THREADS="$(detectthreads)"