Tensorflow源码编译,解决tf提示未使用SSE4.1 SSE4.2 AVX警告
来源:互联网 发布:码字软件 编辑:程序博客网 时间:2024/06/05 07:31
运行tf出现这条警告,是说 你的CPU可以使用这些指令集来提高计算能力,官方说大概能提高3倍,如果训练一个数据集需要8个小时,辣么使用了之后只需要2个多小时就搞定,效果还是杠杠滴。
首先卸载掉原来安装的tf
pip uninstall tensorflow
然后下载tf的源码,直接
git clone --recurse-submodules https://github.com/tensorflow/tensorflow
会在你所在的文件夹下新建一个TensorFlow文件夹
安装bazel,编译tensorflow需要这个工具
首先:
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
然后就可以
apt-get updateapt-get install bazel
不过在install这里被卡了好久,一直出现如下错误
dpkg: error processing archive /var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb (--unpack): trying to overwrite '/usr/lib/jvm/java-9-openjdk-amd64/include/linux/jawt_md.h', which is also in package openjdk-9-jdk-headless:amd64 9~b114-0ubuntu1
如果这时再次apt-get install XX的话,就会出现类似于 XXX请用 apt-get -f install 的提示,你用了之后还是这个提示,解决办法:
dpkg --purge bazel
然后用如下命令:
apt-get -o Dpkg::Options::="--force-overwrite" install bazel
这样就可以看到令人愉悦的success啦
接下来进入到刚才git下来的tf文件夹下,执行:
./config
大部分直接回车按默认配置就OK,然后就可以使用bazel编译出来一个build_pip_package的脚本了,命令如下:
bazel build -c opt --copt=-msse3 --copt=-msse4.1 --copt=-msse4.2 --copt=-mavx //tensorflow/tools/pip_package:build_pip_package
说明:–copt=XXX 这里如果你机器还支持AVX2 可以再加一条–copt=-mavx2,我的机器不支持所以没加,这个过程很费时间,大概需要等20分钟左右
接着创建一个pip的安装包
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
在/tmp/tensorflow_pkg文件夹下就是我们的tf安装包了
pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl
文件名可能不同
然后,运行之前的tf程序,没再出这个警告,而且还快了不少,这几个小时的源码编译投入还是很值的,哈哈!
阅读全文
0 0
- Tensorflow源码编译,解决tf提示未使用SSE4.1 SSE4.2 AVX警告
- ubuntu16.04解决tensorflow提示未编译使用SSE3、SSE4.1、SSE4.2、AVX、AVX2、FMA的问题
- tensorflow提示未编译使用SSE4.1,SSE4.2等问题的解决方法
- tensorflow隐藏编译警告SSE4.2 and AVX instructions
- The TensorFlow library wasn't compiled to use SSE4.1/SSE4.2/AVX/AVX2/FMA instructions, but these are
- How to compile Tensorflow with SSE4.2 and AVX instructions?
- SSE4.1和SSE4.2 Intrinsics各函数介绍
- SSE4.1和SSE4.2 Intrinsics各函数介绍
- 使用tensorflow serving 启动模型时,报如下错误:The TensorFlow library wasn't compiled to use SSE4.1 instructions
- The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available...
- The TensorFlow library wasn't compiled to use SSE4.1 instructions
- high performance program (SSE4.2 intrin instruction)
- SSE4.1指令集系列之一
- RapidJSON 代码剖析(二):使用 SSE4.2 优化字符串扫描
- The TensorFlow library wasn'tcompiled to use SSE4.1 instructions, but these are available on your ma
- SSE4 Instruction Set
- 使用SSE4指令集优化双线性插值图像缩放
- MinGW+Eclipse下C/C++使用SSE4指令集
- holder.js的使用
- [ Spring Boot ] Bean 单例注入
- 一分钟掌握数据库垂直拆分
- 4K分辨率单网无损延长器KE-100HK
- 结巴分词安装与使用
- Tensorflow源码编译,解决tf提示未使用SSE4.1 SSE4.2 AVX警告
- 数据库秒级平滑扩容架构方案
- 异常处理实例
- 乱码问题
- 错误:找不到或无法加载主类 com.pactera.ServerApplication
- python使用scapy报错Traceback (most recent call last):ImportError: No module named all
- python3中,关于Tkinter中Button参数的问题
- 好架构是进化来的,不是设计来的(58架构演进)
- Java邮箱正则表达式