0

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

Adrien Pavao
  • 452
  • 5
  • 11
  • 2
    Are you running it inside a VM that disables SIMD ISA extensions, separately from under Docker? A Xeon Gold supports SSE4.1 (and AVX-512). – Peter Cordes Sep 18 '20 at 15:32
  • Thank you for your interesting input. How can I know if the VM disables the extensions? – Adrien Pavao Sep 21 '20 at 17:02
  • Testing a simple binary that uses an SSE4 instruction would be the obvious way, or more indirectly you can check `/proc/cpuinfo` and look for `sse4_1` in the FLAGS section. (And `avx2`, `fma`, and `avx512f` which your hardware also has, and which it would be foolish not to take advantage of.) – Peter Cordes Sep 21 '20 at 17:07
  • Have you tried building tensorflow from the source? – Yigit Alparslan Apr 03 '21 at 02:43

2 Answers2

3

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.

Adrien Pavao
  • 452
  • 5
  • 11
  • thank you, just thank you... for UI users of proxmox, you can change it by selecting the VM -> Hardware -> Processors -> edit -> Type -> host. – Anan Raddad Feb 10 '22 at 19:31
0

I've run into the same problem some minutes ago and after many trial and error, I can say that "-cpu host" argument is the key here for solving the error, I haven't used the arg "kvm=off" and it worked like a charm.

This is the output I can see now after many times of "illegal instruction"

import tensorflow as tf

2020-12-31 21:04:21.424247: W tensorflow/stream_executor/platform/default/dso_lo ader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcuda rt.so.11.0: cannot open shared object file: No such file or directory 2020-12-31 21:04:21.424279: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
Pedro
  • 1