Skip to content

Commit bd288e6

Browse files
authored
Merge pull request #5 from ROCmSoftwarePlatform/march-config
Change the default optimization on ROCm to be -march=haswell
2 parents 25afaad + 7aba309 commit bd288e6

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

configure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ def set_cc_opt_flags(environ_cp):
486486
elif is_windows():
487487
default_cc_opt_flags = '/arch:AVX'
488488
else:
489-
default_cc_opt_flags = '-march=native'
489+
default_cc_opt_flags = '-march=haswell'
490490
question = ('Please specify optimization flags to use during compilation when'
491491
' bazel option "--config=opt" is specified [Default is %s]: '
492492
) % default_cc_opt_flags
@@ -496,7 +496,7 @@ def set_cc_opt_flags(environ_cp):
496496
write_to_bazelrc('build:opt --copt=%s' % opt)
497497
# It should be safe on the same build host.
498498
if not is_ppc64le() and not is_windows():
499-
write_to_bazelrc('build:opt --host_copt=-march=native')
499+
write_to_bazelrc('build:opt --host_copt=-march=haswell')
500500
write_to_bazelrc('build:opt --define with_default_optimizations=true')
501501
# TODO(mikecase): Remove these default defines once we are able to get
502502
# TF Lite targets building without them.

tensorflow/contrib/cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ option(tensorflow_BUILD_CC_TESTS "Build cc unit tests " OFF)
3030
option(tensorflow_BUILD_PYTHON_TESTS "Build python unit tests " OFF)
3131
option(tensorflow_BUILD_MORE_PYTHON_TESTS "Build more python unit tests for contrib packages" OFF)
3232
option(tensorflow_BUILD_SHARED_LIB "Build TensorFlow as a shared library" OFF)
33-
option(tensorflow_OPTIMIZE_FOR_NATIVE_ARCH "Enable compiler optimizations for the native processor architecture (if available)" ON)
33+
option(tensorflow_OPTIMIZE_FOR_NATIVE_ARCH "Enable compiler optimizations for the native processor architecture (if available)" OFF)
3434
option(tensorflow_ENABLE_SNAPPY_SUPPORT "Enable SNAPPY compression support" ON)
3535
option(tensorflow_DISABLE_EIGEN_FORCEINLINE "Disable forceinline, to speed up build on windows." OFF)
3636

tensorflow/contrib/makefile/build_all_linux.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ tensorflow/contrib/makefile/compile_linux_protobuf.sh
4343

4444
# Build TensorFlow.
4545
make -j"${JOB_COUNT}" -f tensorflow/contrib/makefile/Makefile \
46-
OPTFLAGS="-O3 -march=native" \
46+
OPTFLAGS="-O3 -march=haswell" \
4747
HOST_CXXFLAGS="--std=c++11 -march=native" \
4848
MAKEFILE_DIR=$SCRIPT_DIR

tensorflow/docs_src/install/install_sources.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@ the desired version instead of relying on the default.
238238
One of the questions that `configure` will ask is as follows:
239239

240240
<pre>
241-
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]
241+
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=haswell]
242242
</pre>
243243

244244
This question refers to a later phase in which you'll use bazel to [build the
245245
pip package](#build-the-pip-package) or the [C/Java libraries](#BuildCorJava).
246-
We recommend accepting the default (`-march=native`), which will optimize the
247-
generated code for your local machine's CPU type. However, if you are building
246+
We recommend accepting the default (`-march=haswell`), for better portability over different Linux falvors and CPU architectures.
247+
However, if you are building
248248
TensorFlow on one CPU type but will run TensorFlow on a different CPU type, then
249249
consider specifying a more specific optimization
250250
flag as described in [the gcc
@@ -263,7 +263,7 @@ Found possible Python library paths:
263263
Please input the desired Python library path to use. Default is [/usr/lib/python2.7/dist-packages]
264264

265265
Using python library path: /usr/local/lib/python2.7/dist-packages
266-
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
266+
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=haswell]:
267267
Do you wish to use jemalloc as the malloc implementation? [Y/n]
268268
jemalloc enabled
269269
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N]

0 commit comments

Comments
 (0)