2017-04-27 127 views
1

我有很多大的深度学习任务在python 3.6之前,并且希望从源代码构建tensorflow(仅限CPU),因为我的MacBook Pro带有Touchbar 13“注意到,如果使用的是tensorflow, SSE4.1 SSE4.2 AVX AVX2和FMA支持在StackOverflow和GitHub上有关于该主题的很多问题,并且我将它们全部读了出来,没有一个解决它为什么不能为我工作。跟着指示由https://www.tensorflow.org/install/install_sourcesbazel从源代码构建Tensorflow

我的配置提供了看起来像这样

./configure 
Please specify the location of python. [Default is /anaconda/bin/python]: /anaconda/python.app/Contents/MacOS/python 
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]: 
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] n 
No Google Cloud Platform support will be enabled for TensorFlow 
Do you wish to build TensorFlow with Hadoop File System support? [y/N] n 
No Hadoop File System support will be enabled for TensorFlow 
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] n 
No XLA JIT support will be enabled for TensorFlow 
Do you wish to build TensorFlow with VERBS support? [y/N] n 
No VERBS support will be enabled for TensorFlow 
Found possible Python library paths: 
    /anaconda/python.app/Contents/lib/python3.6/site-packages 
Please input the desired Python library path to use. Default is [/anaconda/python.app/Contents/lib/python3.6/site-packages] 

Using python library path: /anaconda/python.app/Contents/lib/python3.6/site-packages 
Do you wish to build TensorFlow with OpenCL support? [y/N] n 
No OpenCL support will be enabled for TensorFlow 
Do you wish to build TensorFlow with CUDA support? [y/N] n 
No CUDA support will be enabled for TensorFlow 
INFO: Starting clean (this may take a while). Consider using --async if the clean takes more than several minutes. 
Configuration finished 

与巴泽尔0.4.5然后我尝试做构建在这没有错误执行的指令

bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package 

但它给成百上千的警告。我可以提供一个例子,但几乎没有任何片段没有警告地继续。

我非常感谢你的帮助,非常感谢你。

回答

2

不幸的是,编译器警告是生活中的事实。但是,其中许多来自外部库,这些库被拉入构建中。这些可以用“output_filter”的说法被过滤掉,以巴泽勒:

bazel build --config=opt --output_filter='^//tensorflow' //tensorflow/tools/pip_package:build_pip_package 

这将限制输出由TensorFlow代码(也可以打开警告完全关闭这种方式产生的警告,但这需要所有的乐趣编译)。由于用于构建的工具与TensorFlow的开发更紧密相关,所以警告更少(我获得了一些关于多行注释延续,一些有符号/无符号整数比较以及一些关于“可能”未初始化的变量) 。

这些都没有表明明确的错误,只是代码模式有时容易出错。如果编译器知道某些东西是错误的,它会发出一个错误。说没有什么可担心的是很长的路要走。

+0

非常感谢您的详细解答。我(成功地)构建了未安装的tensorflow(尽管有大约40条警告),但不幸的是,它使用SSE4.1 SSE4.2 AVX AVX2和FMA支持之前的速度一样慢。无论如何,谢谢你的回答! – dennis

+0

有趣。 SIMD的加速取决于所使用的操作系统。我知道的最大加速是CPU上的矩阵乘法(可能非常重要)。然而,许多模型都是IO绑定的。 –