如何使用SSE4.1指令而无需从源码安装tensorflow?

问题描述:

我试图根据其官方网站上的指南从源代码安装Tensorflow,但体验非常不愉快。如何使用SSE4.1指令而无需从源码安装tensorflow?

的无法从源代码,我可以看到安装的直接结果是:

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. 

我不知道是否有“使用SSE4.1指令”等说明上述无需安装Tensorflow方式从源头上。

谢谢!

如果不从源构建TensorFlow,则无法使用SIMD指令。

默认情况下TensorFlow二进制文件默认没有进行此优化,以尽可能增加与更广泛CPU架构的兼容性。

如果你想保持沉默的警告,虽然你可以设置TF_CPP_MIN_LOG_LEVEL 2为:

import os 
os.environ['TF_CPP_MIN_LOG_LEVEL']='2' 
import tensorflow as tf 

这TF环境变量默认为0,显示所有日志。 将其设置为1将会过滤掉INFO日志,并且2将额外静默WARNING日志。

+0

感谢您的回答!我想知道TF是否会简化将来从源代码安装的过程。你知道这件事吗?谢谢 – Daniel

+0

从源代码安装不是微不足道的,但如果你按照文档,你将能够毫无问题地完成。总是有改进,反馈总是受欢迎的。如果您有任何关于如何改进Docs的建议,请随时在Github上打开问题:) 您试图在哪个操作系统中构建?通常,Windows是通过CPU优化构建的更具实验性的,但即使它在成功运行。 – Adriano

+0

顺便说一句,有一个非官方Github回购[TensorFlow社区*](https://github.com/yaroslavvb/tensorflow-community-wheels)用户分享他们的构建。访问问题查看可用的构建。 – Adriano