2017-08-27 313 views
1

我导致official tensorflow guide从源代码安装它,为了解决警告,如The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations,好像他们已经省略了配置期间如何指定优化标志的最重要部分(./configure)。tensorflow:gcc:error:无法识别的命令行选项'--copt = -msse4.2'

... 
gcc: error: unrecognized command line option '--copt=-mavx' 
gcc: error: unrecognized command line option '--copt=-mavx2' 
gcc: error: unrecognized command line option '--copt=-mfma' 
gcc: error: unrecognized command line option '--copt=-msse4.1' 
gcc: error: unrecognized command line option '--copt=-msse4.2' 
gcc: error: unrecognized command line option '--copt=-mavx' 
gcc: error: unrecognized command line option '--copt=-mavx2' 
gcc: error: unrecognized command line option '--copt=-mfma' 
gcc: error: unrecognized command line option '--copt=-msse4.1' 
gcc: error: unrecognized command line option '--copt=-msse4.2' 
Target //tensorflow/tools/pip_package:build_pip_package failed to build 

什么是指定的优化参数的正确方法:用无效的配置(bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package)建设时

喂养它们错误地导致了下面的错误导致了这样的错误?

回答

0

机会是你可能已经错过了部分地方the guide规定:

We recommend accepting the default (-march=native), which will optimize the generated code for your local machine's CPU type. However, if you are building TensorFlow on one CPU type but will run TensorFlow on a different CPU type, then consider specifying a more specific optimization flag as described in the gcc documentation .

而在gcc documentation,你会发现列表,如:

-mmmx -mno-mmx -msse -mno-sse -msse2 -mno-sse2 -msse3 -mno-sse3 -mssse3 -mno-ssse3 -msse4.1 -mno-sse4.1 -msse4.2 -mno-sse4.2 -msse4 -mno-sse4 -mavx -mno-avx -maes -mno-aes -mpclmul -mno-pclmul -msse4a -mno-sse4a -mfma4 -mno-fma4 -mxop -mno-xop -mlwp -mno-lwp -m3dnow -mno-3dnow -mpopcnt -mno-popcnt -mabm -mno-abm

1

也有类似的问题,把下面的在我的“./configure”中:

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: 
--copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.1 --copt=-msse4.2 

As lin由gub doc中的reubenjohn ked'-march = whatever'与'-msse4.1'处于同一级别,因此'--copt ='必须被移除,因为这些选项实际上直接馈送给GCC。

解决通过将改为:

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: 
-mavx -mavx2 -mfma -mfpmath=both -msse4.1 -msse4.2 
相关问题