tensorflow: Illegal instruction on older CPUs under version 2.4.0
System information
- Ubuntu 18.04 and 20.04, Scientific Linux 7
- binary installed via pip
- version 2.4.0
- Python 3.8
- installed via pip (either inside or not inside a Conda environment)
- various CPU-only and GPU-hosting machines
Describe the problem
import tensorflow
produces “Illegal instruction (core dumped)” on older machines (seemingly those that do not support AVX2 instructions). There is no problem on new machines (seemingly those that support AVX2 instructions).
Provide the exact sequence of commands / steps that you executed before running into the problem
pip install tensorflow
python -c "import tensorflow"
Any other info / logs
The core dump occurs on various machines with various types of CPUs. The common thread seems to be that it occurs on machines that don’t support AVX2 instructions. Most of the machines on which this occurs do support AVX instructions.
The issue does not occur with Tensorflow 2.3.1 nor with Tensorflow 2.5.0 installed via tf-nightly.
Any chance Tensorflow 2.4.0 was built in a way (perhaps unintentionally) that requires AVX2 instructions or some other requirement that causes it to fail on somewhat older (but not really old) machines? Based on what I am seeing, it seems that using 2.4.0 on many machines will fail.
The same issue occurs when running in the official Tensorflow Docker container.
This seems related to issue #44668.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 15 (3 by maintainers)
Commits related to this issue
- Remove `-march=native`. Testing for #45744, #45866, #44701 — committed to tensorflow/tensorflow by mihaimaruseac 3 years ago
- Merge pull request #46184 from tensorflow/mm-remove-march=native Remove `-march=native`. Testing for #45744, #45866, #44701 — committed to tensorflow/tensorflow by mihaimaruseac 3 years ago
- No longer compile with `-march=native`. Should resolve issue reported in #45744, #45866, #44701 and #45991 as well as multiple other issues from other ecosystem places. We will patch 2.4 soon and re... — committed to tensorflow/tensorflow by mihaimaruseac 3 years ago
@paciorek, Yes, that is one of the requirements for TensorFlow. Starting with TensorFlow 1.6, the TensorFlow binaries use AVX instructions which may not run on older CPUs. For more information, please take a look at the hardware requirements.
As an alternative, you can either build TensorFlow from source or use Google Colab.
Thanks!