You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gluten.apache.org by "PHILO-HE (via GitHub)" <gi...@apache.org> on 2024/04/28 03:56:01 UTC

Re: [PR] [GLUTEN-5559][VL]Use different commands to get the number of available processing unit in MacOS [incubator-gluten]

PHILO-HE commented on code in PR #5560:
URL: https://github.com/apache/incubator-gluten/pull/5560#discussion_r1582008691


##########
cpp/compile.sh:
##########
@@ -30,7 +30,18 @@ ENABLE_S3=OFF
 ENABLE_HDFS=OFF
 ENABLE_ABFS=OFF
 VELOX_HOME=
-NPROC=$(nproc --ignore=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 $NPROC

Review Comment:
   Nit: please also print some necessary message to indicate what $NPROC stands for.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@gluten.apache.org
For additional commands, e-mail: commits-help@gluten.apache.org