【问题标题】:"Illegal instruction (core dumped)" on tensorflow >1.6张量流上的“非法指令(核心转储)”> 1.6
【发布时间】:2020-09-18 15:12:16
【问题描述】:

我正在尝试在各种 tensorflow 版本上运行 import tensorflow。我真正想用的是1.13.1

我的 CPU 是 INTEL Xeon Scalable GOLD 6126 - 12 核(24 线程)2.60GHz。

我已经在互联网上搜索过这个错误*,大多数时候解决方法是将 tensorflow 降级到旧版本(通常我尝试了 1.5.1 并且它有效)。有时只是未解决**。

但有可能真正解决问题吗?

这是我对不同版本 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.01.15.22.3.0

Illegal instruction (core dumped)

似乎从源代码构建可能是一种解决方案,但是知道我想在 docker 中运行代码并使用 GPU 时如何正确地做到这一点?

编辑 - 更多信息

  • 在主服务器(主机)上,/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

  • 在虚拟机(我想在其上运行 tensorflow)上,/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_1sse4_2 这次好像不见了。

* 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

【问题讨论】:

  • 您是否在禁用 SIMD ISA 扩展的 VM 中运行它,与 Docker 下分开运行? Xeon Gold 支持 SSE4.1(和 AVX-512)。
  • 感谢您提供有趣的意见。我如何知道 VM 是否禁用了扩展?
  • 测试使用 SSE4 指令的简单二进制文件是显而易见的方法,或者更间接地,您可以检查 /proc/cpuinfo 并在 FLAGS 部分中查找 sse4_1。 (还有avx2fmaavx512f,你的硬件也有,不利用它们是愚蠢的。)
  • 你试过从源头构建 tensorflow 吗?

标签: python docker tensorflow instructions


【解决方案1】:

我设法找到了解决方案。

就我而言,虚拟机由 PROXMOX 管理。我必须在 VM 配置文件中添加以下行:

args: -cpu host,kvm=off

这样,VM 的 CPU 具有与主机 CPU 相同的功能。

【讨论】:

  • 谢谢,谢谢...对于 proxmox 的 UI 用户,您可以通过选择 VM -> 硬件 -> 处理器 -> 编辑 -> 类型 -> 主机来更改它。
【解决方案2】:

几分钟前我遇到了同样的问题,经过多次反复试验,我可以说“-cpu host”参数是解决错误的关键,我没有使用arg“kvm=关闭”,它就像一个魅力。

这是我多次“非法指令”后现在看到的输出

import tensorflow as tf

2020-12-31 21:04:21.424247:W tensorflow/stream_executor/platform/default/dso_lo ader.cc:60] 无法加载动态库“libcudart.so.11.0”; dlerror:libcuda rt.so.11.0:无法打开共享对象文件:没有这样的文件或目录 2020-12-31 21:04:21.424279: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] 如果您的机器上没有设置 GPU,请忽略上面的 cudart dlerror。

【讨论】:

    猜你喜欢
    • 2018-08-12
    • 2020-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多