在哪里添加 CPU 指令 从源代码安装张量流?



我正在尝试从源代码安装Tensorflow,因为当我使用pip AND virtualenv安装时,有关CPU指令(SSE,AVX...)未安装的警告:

W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.

所以我正在尝试从源代码安装Tensorflow,以便可以使用Tensorflow编译这些指令。

  1. 除了 Tensorflow 网站上的说明之外,我还需要做任何事情来使用这些说明进行编译吗?(./configure

  2. 如果是这样,我需要做什么,我具体该怎么做?

  3. 在安装中,当我必须安装 pip 包时,Tensorflow 网站说对于 Linux,命令是:sudo pip install /tmp/tensorflow_pkg/tensorflow-1.0.1-py2-none-any.whl它说此命令会因机器而异,那么 MacOS 的等效命令是什么?如何执行巴泽尔wheel步骤?

旁注:有人告诉我,有几种方法可以用 Bazel 做到这一点,但由于对 Bazel 没有经验,对终端也没有太多经验,我需要明确的步骤来做什么?

操作系统塞拉 (10.12.2)

对于您的问题一(和第二),./configure 的默认值将为您提供针对您的机器优化的指令集。这是通过默认编译器选项-march=native.只需按照此处的步骤操作即可

对于第三个,一旦您在/tmp/tensorflow_pkg(或任何地方)中生成了whl文件,然后查看该目录中的文件名称。它将与说明中给出的 linux 示例相似但不同。然后,您应该能够使用pip install /tmp/tensorflow_pkg/YOUR_FILENAME.whl.如果您有任何问题,可以按照此处的步骤操作,但使用/tmp/tensorflow_pkg/YOUR_FILENAME.whl而不是tensorflowtensorflow-gpu

祝你好运。

在OSX上你可以做

brew install tensor-flow

我相信。

最新更新