Skip to content

Commit

Permalink
[GLUTEN-5559][VL] Fix build threads setting for gluten cpp on MacOS (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
NEUpanning authored Apr 28, 2024
1 parent d985c54 commit 26edf4f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cpp/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26edf4f

Please sign in to comment.