aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure
diff options
context:
space:
mode:
authorGravatar Martin Wicke <wicke@google.com>2017-01-13 12:20:42 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-13 12:25:28 -0800
commitc4e3d4a74e86fce3a09badd20952f067ff340f32 (patch)
treea75c0492aeab9bd0d0e5abcf882f3000288a8778 /configure
parent1c5120141b2043c4e0721774c183cb01d23b0682 (diff)
Enable customization of architecture dependent compiler optimizations via configure, defaulting to -march=native.
Change: 144470919
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure15
1 files changed, 15 insertions, 0 deletions
diff --git a/configure b/configure
index 1e4d786974..38079041d5 100755
--- a/configure
+++ b/configure
@@ -54,6 +54,15 @@ while true; do
# Retry
done
+## Set up architecture-dependent optimization flags.
+if [ -z "$CC_OPT_FLAGS" ]; then
+ default_cc_opt_flags="-march=native"
+ read -p "Please specify optimization flags to use during compilation [Default is $default_cc_opt_flags]: " CC_OPT_FLAGS
+ if [ -z "$CC_OPT_FLAGS" ]; then
+ CC_OPT_FLAGS=$default_cc_opt_flags
+ fi
+fi
+
if is_windows; then
TF_NEED_GCP=0
TF_NEED_HDFS=0
@@ -153,6 +162,12 @@ fi
# Invoke python_config and set up symlinks to python includes
./util/python/python_config.sh --setup "$PYTHON_BIN_PATH"
+# Append CC optimization flags to bazel.rc
+echo >> tools/bazel.rc
+for opt in $CC_OPT_FLAGS; do
+ echo "build --cxxopt=$opt --copt=$opt" >> tools/bazel.rc
+done
+
# Run the gen_git_source to create links where bazel can track dependencies for
# git hash propagation
GEN_GIT_SOURCE=tensorflow/tools/git/gen_git_source.py