我正在使用 tensorflow(不支持 GPU),与预期相比,我发现性能受到了相当大的影响。所以,我认为是时候注意这些警告了:
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.
我见过一些人声称他们已经获得了接近 10 倍的速度提升,使用这些指令进行构建。
不过,我发现的有关执行此操作的说明似乎与旧版本的 TF (v < 1.0) 有关。我想知道是否有人可以指出我使用更新版本的 tf 构建的正确 bazel 命令?
按照此处的说明在 Mac OSX 上安装 python3:https ://www.tensorflow.org/install/install_sources并选择“否”以获得 CUDA 支持。
并使用 bazel 命令:
bazel build --linkopt='-lrt' -c opt --copt=-march=native --copt=-mavx --copt=-msse4.2 --copt=-msse4.1 //tensorflow/tools/pip_package:build_pip_package
但是,这会导致许多页面的警告/错误......主要是以下形式:
target '//tensorflow/contrib/learn:learn' depends on deprecated target '//tensorflow/contrib/session_bundle:exporter': Use SavedModel Builder instead.
和
external/protobuf/python/google/protobuf/pyext/message_factory.cc:78:28: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
编辑
我会注意到,我只看到从源头构建的速度略有增加。