aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2016-11-23 13:33:22 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2016-11-23 13:48:20 -0800
commit6da3a2bb3c9c8d4eb12f6ed2f61a552fef04a78e (patch)
treebbf46bd8feee3d043542a6c7ca4fcf253600e6b5
parent14c787fb6a70d16279cd0ec9f9d37bcc717d694a (diff)
Adding -j${JOBS_COUNT} for make in build_all_${target_os_type}.sh to speed up build
Change: 140066519
-rwxr-xr-xtensorflow/contrib/makefile/build_all_android.sh8
-rwxr-xr-xtensorflow/contrib/makefile/build_all_ios.sh12
-rwxr-xr-xtensorflow/contrib/makefile/build_all_linux.sh5
-rwxr-xr-xtensorflow/contrib/makefile/compile_ios_tensorflow.sh23
4 files changed, 25 insertions, 23 deletions
diff --git a/tensorflow/contrib/makefile/build_all_android.sh b/tensorflow/contrib/makefile/build_all_android.sh
index 80cc54539c..f06133ce88 100755
--- a/tensorflow/contrib/makefile/build_all_android.sh
+++ b/tensorflow/contrib/makefile/build_all_android.sh
@@ -46,6 +46,9 @@ shift $((OPTIND - 1))
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd ${SCRIPT_DIR}/../../../
+source "${SCRIPT_DIR}/build_helper.subr"
+JOB_COUNT="${JOB_COUNT:-$(get_job_count)}"
+
if [[ "${ONLY_MAKE_TENSORFLOW}" != "true" ]]; then
# Remove any old files first.
make -f tensorflow/contrib/makefile/Makefile clean
@@ -66,14 +69,13 @@ if [[ "${USE_HEXAGON}" == "true" ]]; then
HEXAGON_INCLUDE="${HEXAGON_PARENT_DIR}/include"
fi
-# Recommend make -j<#jobs> e.g. -j8 to speed up build on multi-core machine
if [[ -z "${BUILD_TARGET}" ]]; then
- make -f tensorflow/contrib/makefile/Makefile \
+ make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
TARGET=ANDROID NDK_ROOT="${NDK_ROOT}" CC_PREFIX="${CC_PREFIX}" \
HEXAGON_LIBS="${HEXAGON_LIBS}" HEXAGON_INCLUDE="${HEXAGON_INCLUDE}" \
SUB_MAKEFILES="${SUB_MAKEFILES}"
else
- make -f tensorflow/contrib/makefile/Makefile \
+ make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
TARGET=ANDROID NDK_ROOT="${NDK_ROOT}" CC_PREFIX="${CC_PREFIX}" \
HEXAGON_LIBS="${HEXAGON_LIBS}" HEXAGON_INCLUDE="${HEXAGON_INCLUDE}" \
SUB_MAKEFILES="${SUB_MAKEFILES}" "${BUILD_TARGET}"
diff --git a/tensorflow/contrib/makefile/build_all_ios.sh b/tensorflow/contrib/makefile/build_all_ios.sh
index e0e4a69f7d..4d9ce077ba 100755
--- a/tensorflow/contrib/makefile/build_all_ios.sh
+++ b/tensorflow/contrib/makefile/build_all_ios.sh
@@ -27,13 +27,6 @@ fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd ${SCRIPT_DIR}/../../../
-# You can set the parallelism of the make process with the first argument, with
-# a default of four if nothing is supplied.
-if [ "$#" -gt 1 ]; then
- JOB_COUNT=$1
-else
- JOB_COUNT=4
-fi
# Remove any old files first.
make -f tensorflow/contrib/makefile/Makefile clean
@@ -43,10 +36,11 @@ rm -rf tensorflow/contrib/makefile/downloads
tensorflow/contrib/makefile/download_dependencies.sh
# Compile protobuf for the target iOS device architectures.
-tensorflow/contrib/makefile/compile_ios_protobuf.sh ${JOB_COUNT}
+tensorflow/contrib/makefile/compile_ios_protobuf.sh
# Build the iOS TensorFlow libraries.
-tensorflow/contrib/makefile/compile_ios_tensorflow.sh "-O3" -j ${JOB_COUNT}
+tensorflow/contrib/makefile/compile_ios_tensorflow.sh "-O3"
# Creates a static universal library in
# tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a
+
diff --git a/tensorflow/contrib/makefile/build_all_linux.sh b/tensorflow/contrib/makefile/build_all_linux.sh
index 5f98063c97..5fbccd001e 100755
--- a/tensorflow/contrib/makefile/build_all_linux.sh
+++ b/tensorflow/contrib/makefile/build_all_linux.sh
@@ -22,6 +22,9 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd ${SCRIPT_DIR}/../../../
+source "${SCRIPT_DIR}/build_helper.subr"
+JOB_COUNT="${JOB_COUNT:-$(get_job_count)}"
+
# Remove any old files first.
make -f tensorflow/contrib/makefile/Makefile clean
rm -rf tensorflow/contrib/makefile/downloads
@@ -33,4 +36,4 @@ tensorflow/contrib/makefile/download_dependencies.sh
tensorflow/contrib/makefile/compile_linux_protobuf.sh
# Build TensorFlow.
-make -f tensorflow/contrib/makefile/Makefile OPTFLAGS="-O3" -j 8
+make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile OPTFLAGS="-O3"
diff --git a/tensorflow/contrib/makefile/compile_ios_tensorflow.sh b/tensorflow/contrib/makefile/compile_ios_tensorflow.sh
index 61ab844f18..6f47b80780 100755
--- a/tensorflow/contrib/makefile/compile_ios_tensorflow.sh
+++ b/tensorflow/contrib/makefile/compile_ios_tensorflow.sh
@@ -15,6 +15,9 @@
# ==============================================================================
# Builds the TensorFlow core library with ARM and x86 architectures for iOS, and
# packs them into a fat file.
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+source "${SCRIPT_DIR}/build_helper.subr"
+JOB_COUNT="${JOB_COUNT:-$(get_job_count)}"
function less_than_required_version() {
echo $1 | (IFS=. read major minor micro
@@ -40,40 +43,40 @@ GENDIR=tensorflow/contrib/makefile/gen/
LIBDIR=${GENDIR}lib
LIB_PREFIX=libtensorflow-core
-make -f tensorflow/contrib/makefile/Makefile \
-TARGET=IOS IOS_ARCH=ARMV7 LIB_NAME=${LIB_PREFIX}-armv7.a OPTFLAGS="$1" $2 $3
+make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
+TARGET=IOS IOS_ARCH=ARMV7 LIB_NAME=${LIB_PREFIX}-armv7.a OPTFLAGS="$1"
if [ $? -ne 0 ]
then
echo "armv7 compilation failed."
exit 1
fi
-make -f tensorflow/contrib/makefile/Makefile \
-TARGET=IOS IOS_ARCH=ARMV7S LIB_NAME=${LIB_PREFIX}-armv7s.a OPTFLAGS="$1" $2 $3
+make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
+TARGET=IOS IOS_ARCH=ARMV7S LIB_NAME=${LIB_PREFIX}-armv7s.a OPTFLAGS="$1"
if [ $? -ne 0 ]
then
echo "arm7vs compilation failed."
exit 1
fi
-make -f tensorflow/contrib/makefile/Makefile \
-TARGET=IOS IOS_ARCH=ARM64 LIB_NAME=${LIB_PREFIX}-arm64.a OPTFLAGS="$1" $2 $3
+make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
+TARGET=IOS IOS_ARCH=ARM64 LIB_NAME=${LIB_PREFIX}-arm64.a OPTFLAGS="$1"
if [ $? -ne 0 ]
then
echo "arm64 compilation failed."
exit 1
fi
-make -f tensorflow/contrib/makefile/Makefile \
-TARGET=IOS IOS_ARCH=I386 LIB_NAME=${LIB_PREFIX}-i386.a OPTFLAGS="$1" $2 $3
+make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
+TARGET=IOS IOS_ARCH=I386 LIB_NAME=${LIB_PREFIX}-i386.a OPTFLAGS="$1"
if [ $? -ne 0 ]
then
echo "i386 compilation failed."
exit 1
fi
-make -f tensorflow/contrib/makefile/Makefile \
-TARGET=IOS IOS_ARCH=X86_64 LIB_NAME=${LIB_PREFIX}-x86_64.a OPTFLAGS="$1" $2 $3
+make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
+TARGET=IOS IOS_ARCH=X86_64 LIB_NAME=${LIB_PREFIX}-x86_64.a OPTFLAGS="$1"
if [ $? -ne 0 ]
then
echo "x86_64 compilation failed."