Search code examples
pythondockertensorflowinstructions

"Illegal instruction (core dumped)" on tensorflow >1.6


I am trying to run import tensorflow on various tensorflow version. The one that I really want to use is 1.13.1.

My CPU is INTEL Xeon Scalable GOLD 6126 - 12 Cores (24 Threads) 2.60GHz.

I've already searched for this error on the internet* and most of the time the work-around is to downgrade tensorflow to older versions (typically I tried 1.5.1 and it worked). Sometimes it's just unresolved**.

But it is possible to really solve the issue?

Here are my output for various versions of tensorflow.

1.13.1

2020-09-18 15:00:16.308205: F tensorflow/core/platform/cpu_feature_guard.cc:37] The TensorFlow library was compiled to use SSE4.1 instructions, but these aren't available on your machine.
Aborted (core dumped)

1.14.0, 1.15.2 and 2.3.0

Illegal instruction (core dumped)

It seems that building from source could be a solution, but how to do it properly knowing that I want to run the code inside a docker and using GPU?

EDIT - more information

  • On the main server (host machine) I have the following flags in /proc/cpuinfo:
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke md_clear flush_l1d

  • On the virtual machine (on which I want to run tensorflow) I have the following flags in /proc/cpuinfo:
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl xtopology cpuid pni cx16 x2apic hypervisor lahf_lm cpuid_fault pti

sse4_1 and sse4_2 seem to be missing this time.

* https://github.com/tensorflow/tensorflow/issues/17411

https://github.com/tensorflow/tensorflow/issues/30114

https://tech.amikelive.com/node-887/how-to-resolve-error-illegal-instruction-core-dumped-when-running-import-tensorflow-in-a-python-program/

Illegal instruction(core dumped) tensorflow

https://www.tutorialexample.com/fix-tensorflow-illegal-instruction-core-dumped-error-a-simple-guide-tensorflow-tutorial/

** https://github.com/tensorflow/tensorflow/issues/20139


Solution

  • I manage to find a solution.

    In my case, the virtual machines are managed by PROXMOX. I had to add the following line in the VM configuration file:

    args: -cpu host,kvm=off
    

    This way the VM's CPU has the same features as the host CPU.