build ray in parallel

This commit is contained in:
Philipp Moritz 2016-06-25 14:02:33 -07:00
parent 28747d3c5e
commit b99ea3ca4e
2 changed files with 18 additions and 5 deletions

View file

@ -2,8 +2,19 @@
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
# Determine how many parallel jobs to use for make based on the number of cores
unamestr="$(uname)"
if [[ "$unamestr" == "Linux" ]]; then
PARALLEL=$(nproc)
elif [[ "$unamestr" == "Darwin" ]]; then
PARALLEL=$(sysctl -n hw.ncpu)
else
echo "Unrecognized platform."
exit 1
fi
mkdir -p "$ROOT_DIR/build"
pushd "$ROOT_DIR/build"
cmake ..
make install
make install -j$PARALLEL
popd

View file

@ -7,12 +7,14 @@ TP_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)
PREFIX=$TP_DIR/installed
# Determine how many parallel jobs to use for make based on the number of cores
if [[ "$OSTYPE" =~ ^linux ]]; then
PARALLEL=$(grep -c processor /proc/cpuinfo)
elif [[ "$OSTYPE" == "darwin"* ]]; then
unamestr="$(uname)"
if [[ "$unamestr" == "Linux" ]]; then
PARALLEL=$(nproc)
elif [[ "$unamestr" == "Darwin" ]]; then
PARALLEL=$(sysctl -n hw.ncpu)
echo "Platform is macosx."
else
echo Unsupported platform $OSTYPE
echo "Unrecognized platform."
exit 1
fi