【问题标题】:This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical此 TensorFlow 二进制文件使用 Intel(R) MKL-DNN 进行了优化,可在性能关键的情况下使用以下 CPU 指令
【发布时间】:2019-12-10 11:12:37
【问题描述】:

我正在尝试在 Ubuntu 上安装 tensorflow,我收到了这条消息:

(base) k@k-1005:~/Documents/ClassificationTexte/src$ python tester.py 
Using TensorFlow backend.


RUN: 1
  1.1. Training the classifier...
LABELS: {'negative', 'neutral', 'positive'}
2019-12-10 11:58:13.428875: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations:  SSE4.1 SSE4.2 AVX AVX2 FMA
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
2019-12-10 11:58:13.432727: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3190585000 Hz
2019-12-10 11:58:13.433041: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5591c387b750 executing computations on platform Host. Devices:
2019-12-10 11:58:13.433098: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Host, Default Version
2019-12-10 11:58:13.433182: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 2. Tune using inter_op_parallelism_threads for best performance.
Model: "model_1"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         (None, 8000)              0         
_________________________________________________________________
dense_1 (Dense)              (None, 3)                 24003     


但是脚本可以工作并显示准确性,但上面的这部分显示在运行之前。你有什么想法吗,我在 anaconda 上安装了 tensorflow:

【问题讨论】:

  • 不要使用你的基础环境!

标签: python tensorflow keras deep-learning nltk


【解决方案1】:

如果您对看到这些错误不感兴趣,请在运行脚本之前使用它

export TF_CPP_MIN_LOG_LEVEL=2

import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

在您的脚本中。

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

更新:代码中的更简洁的方式:tf.get_logger().setLevel('ERROR')

【讨论】:

    【解决方案2】:

    抛出上述警告是因为TensorFlow 库最初是在不同架构的机器上编译的,并且没有针对您的特定架构进行优化。这意味着它将继续运行,但您不会从库中获得最大性能。

    要在您的机器上获得最大性能,您需要在您的机器上构建 TensorFlow。

    有关从源代码构建的步骤,请参阅official documentation。

    官方文档:https://www.tensorflow.org/install/source

    【讨论】:

    • 我在同一台机器上构建了我的 Tensorflow,但仍然出现此错误。但我不知道如何为我的英特尔 cpu 找到合适的标志来启用 AVX2。我只是在任何地方都找不到它,
    • @Shilan 在 ./configure 中,当询问“请在指定 bazel 选项“--config=opt”时指定要在编译期间使用的优化标志 [默认为 -march=native -Wno-sign- compare]:" 提供 -mavx2(可能还有其他的,例如 -msse4.2 和 -mfma)
    • @Tyreal 那么这是否意味着如果我在配置文件中配置所有内容,我在运行 train 命令时就不需要再次标记它们?
    • @Shilan 是的,没错。您只能在构建时添加对 CPU 指令的支持。创建包后,它将使用已编译的标志,以后无法启用对特定指令的支持。
    猜你喜欢
    • 1970-01-01
    • 2021-02-03
    • 2018-04-14
    • 2018-12-28
    • 1970-01-01
    • 2019-01-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多