Have you come across the “Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA” error? If you are still troubled by it, then this post of MiniTool is what you need.
A lot of users receive the “Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2” error message when trying to install or run TensorFlow. Here is a true example from the GitHub forum:
Hi, I followed the instructions in Wide & Deep and run the test successfully, but saw the below messages: I TensorFlow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA.https://github.com/IntelAI/models/issues/48
What Does the AVX Mean?
To figure out the “your CPU supports instructions that this TensorFlow” error, it’s necessary to know what is AVX. AVX is the short name for Advanced Vector Extensions (also known as Sandy Bridge New Extensions) that are extensions to the x86 instruction set architecture for microprocessors from Intel and AMD. It provides many new features, new instructions, and a new coding scheme.
AVX2, known as Haswell New Instructions expands most integer commands to 256 bits and releases new instructions. It was first supported by Intel with the Haswell processors. When the AVX introduced the FMA, it uses the floating-point multiply-add operation that is done in a single step, speeding up many operations.
Moreover, AVX helps the algebra computation run faster and be easier to use. The CPUs that support the AVX and FMA could be faster than the older CPUs. However, if your CPU doesn’t support AVX, you may receive this warning message.
What to do if my computer is frozen and Control Alt Delete not working? If you are troubled by the issue, you can obtain several effective fixes from this post.
What Causes the “Your CPU Support Instructions That This TensorFlow” Error
If you encounter the “your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA” error, it indicates that the shared library of TensorFlow doesn’t include the type of instructions that your CPU can use. This is because, after TensorFlow 1.6, the binaries use AVX instructions that may not run on older CPUs.
The older CPUs cannot run the AVX instructions, while on the newer CPUs, you need to build the TensorFlow from source to the CPU. Why the AVX cannot be used by default? This is because the TensorFlow default distribution is built without the CPU extensions, which triggers the issue.
How to Fix the “Your CPU Support Instructions That This TensorFlow” Error
How to fix the “your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2” issue? In fact, the warning message was sent to inform you about the built TensorFlow from the source.
If you have a GPU installed on your computer, you can ignore these warning messages from the AVX support. Well, if you don’t want to see this error message anymore, you can disable it by adding the following text. Here you need to import the OS module in your main program code and set the mapping object for it.
os.environ[‘TF_CPP_MIN_LOG_LEVEL’] = ‘2’
If you are on a Unix, you can use the following export command in the bash shell.
If you don’t have GPU and you still want to use your CPU as much as possible, you need to build TensorFlow from the source optimize for your CPU with AVX, AVX2, and FMA enabled.