This is an automated email from the ASF dual-hosted git repository.

philo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git


The following commit(s) were added to refs/heads/main by this push:
     new 26edf4f2a [GLUTEN-5559][VL] Fix build threads setting for gluten cpp 
on MacOS (#5560)
26edf4f2a is described below

commit 26edf4f2abdecf7ef7535a31c802a3b0dd411ed4
Author: Jaime Pan <[email protected]>
AuthorDate: Sun Apr 28 17:17:25 2024 +0800

    [GLUTEN-5559][VL] Fix build threads setting for gluten cpp on MacOS (#5560)
---
 cpp/compile.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/cpp/compile.sh b/cpp/compile.sh
index 113daeaa3..aa530446e 100755
--- a/cpp/compile.sh
+++ b/cpp/compile.sh
@@ -30,7 +30,19 @@ ENABLE_S3=OFF
 ENABLE_HDFS=OFF
 ENABLE_ABFS=OFF
 VELOX_HOME=
-NPROC=$(nproc --ignore=2)
+# set default number of threads as cpu cores minus 2
+if [[ "$(uname)" == "Darwin" ]]; then
+    physical_cpu_cores=$(sysctl -n hw.physicalcpu)
+    ignore_cores=2
+    if [ "$physical_cpu_cores" -gt "$ignore_cores" ]; then
+        NPROC=${NPROC:-$(($physical_cpu_cores - $ignore_cores))}
+    else
+        NPROC=${NPROC:-$physical_cpu_cores}
+    fi
+else
+    NPROC=${NPROC:-$(nproc --ignore=2)}
+fi
+echo "set default number of threads is ${NPROC}"
 
 for arg in "$@"; do
   case $arg in


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to