【问题标题】:The TensorFlow library wasn't compiled to use AVX - AVX2TensorFlow 库未编译为使用 AVX - AVX2
【发布时间】:2018-03-30 01:19:14
【问题描述】:

我是 TensorFlow 的新手。 我使用的是 64 位版本的 Windows 10,我想为 CPU 安装 Tensorflow。 我不记得安装它的确切步骤,但是当我使用以下命令检查安装时:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

我有以下输出:

2017-10-18 09:56:21.656601: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\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.
2017-10-18 09:56:21.656984: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\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.
b'Hello, TensorFlow!'

我正在使用 SublimeREPL 包在 Sublime Text 3 中运行 python。 我试图搜索这些错误,发现这意味着 tensorflow 是在没有这些指令的情况下构建的,这可以提高 CPU 的性能。我还找到了隐藏这些警告的代码,但实际上我想使用这些说明。

我发现启用此功能的代码是:

bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-msse4.2 --copt=-msse4.1 --copt=-msse3 --copt=-mfma -k //tensorflow/tools/pip_package:build_pip_package

但我得到了这个输出:

ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': no such package 'tensorflow/tools/pip_package': BUILD file not found on package path.
WARNING: Target pattern parsing failed. Continuing anyway.
INFO: Found 0 targets...
ERROR: command succeeded, but there were errors parsing the target pattern.
INFO: Elapsed time: 8,147s, Critical Path: 0,02s

我该如何解决这个问题? 最后,我不明白什么是 pip、wheel 和 bazel,所以我需要一步一步的说明。

非常感谢!

【问题讨论】:

  • 我不想隐藏警告,我想使用 AVX - AVX2 指令,但不知道如何
  • 来自链接问题的答案:“启用这些操作是编译时操作(即,要使用 SSE,您需要从源代码构建库,启用您所针对的特定 SSE 版本) ,在这种情况下你可以take a look at this question。”
  • 我尝试了该帖子中的代码,但出现以下错误:WARNING: Config values are not defined in any .rc file: cuda. ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': no such package 'tensorflow/tools/pip_package': BUILD file not found on package path. WARNING: Target pattern parsing failed. Continuing anyway. INFO: Found 0 targets... ERROR: command succeeded, but there were errors parsing the target pattern. INFO: Elapsed time: 7,622s, Critical Path: 0,01
  • 你是我的向导!!! T_T 我设法弄清楚了一些事情。感谢您迄今为止的支持!

标签: tensorflow neural-network pip bazel python-wheel


【解决方案1】:

如果您想下载 TensorFlow 源代码,编译+安装,请使用 this 链接。
如果您想下载二进制文件,请使用this 链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-31
    • 2018-04-14
    • 2019-03-15
    • 1970-01-01
    • 1970-01-01
    • 2017-09-22
    相关资源
    最近更新 更多