使用带有pip的SSE指令进行Tensorflow安装

Cur*_*Dan 11 python sse pip virtualenv tensorflow

我使用此处提供的默认指令在ubuntu 16.04上成功安装了cpu only tensorflow .建议使用virtualenv和pip的指令,所以我没有从源代码构建.我按照这些说明安装没有问题.

我提供的说明验证了我安装的进一步下跌在同一页上,并在程序运行成功,它输出下列警告.

W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 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.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.
Hello, TensorFlow!
Run Code Online (Sandbox Code Playgroud)

我看过的所有stackoverflow页面只针对使用bazel从源代码构建的人,但似乎不适用于使用pip的人.

如何重新编译或更新我的安装以获得SSE指令?

Yar*_*tov 3

您必须使用bazelwith--config=opt选项来构建为您的架构定制的wheel,然后使用pip来安装生成的wheel。

我计划偶尔将 2014 MacBook + Xeon V3 优化版本上传到 https://github.com/yaroslavvb/tensorflow-community-wheels

安装 Bazel 后,为您的pip命令制作一个轮子大致如下

./configure

export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH"
export flags="--config=opt --config=cuda -k"

bazel build $flags -k //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
Run Code Online (Sandbox Code Playgroud)

然后轮子落入/tmp/tensorflow_pkg