问题
I am using Tensorflow's Anaconda distribution with MKL support.
from tensorflow.python.framework import test_util
test_util.IsMklEnabled()
This code prints True
. However, when I compile my Keras model I still get
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
This is not the behavior I was expecting.
回答1:
The MKL-DNN portions of the tensorflow execution (which is the main acceleration provided by MKL engineers) are JIT'ed at runtime. So the instruction set targeted at binary creation is not relevant to the MKL-DNN code. It will only effect the other math, mainly the Eigen library and whatever functions haven't been replaced with MKL-DNN functions.
回答2:
This warning can be ignored. The reason this is appearing is because of the instruction set flags set while building TF. However, MKL-DNN(The math lib responsible for performing core computations in tensorflow-mkl) at the run time will use the latest vector Instruction sets supported by your machine. If you look at the intel optimized tensorflow install guide, you can get more details. So bottomline is, although these warning messages appear, AVX2 is being used by MKL at the run time
来源:https://stackoverflow.com/questions/53979991/why-does-tensorflow-warn-about-avx2-while-i-am-using-mkl