【发布时间】:2021-01-18 18:56:39
【问题描述】:
TL;DR:
- 通过 Python 导入时,Tensorflow 1.15 在我的虚拟机上崩溃(错误消息为
Illegal instruction (core dumped)),这很可能是由于禁用了 AVX 和 AVX2。 - 我的主机(Windows 10 64 位)具有 AVX 和 AVX2(使用 Cygwin 验证,请参阅下面的详细信息)[CPU 是 Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz ]
- 在客户机上(使用 VirtualBox 6.1.16 的 Ubuntu 20.04 64 位,18.04 也是如此),缺少 AVX 和 AVX2。
- 根据现有线程的建议,我在主机上运行了
VBoxManage setextradata "Ubuntu20" VBoxInternal/CPUM/IsaExts/AVX 1和VBoxManage setextradata "Ubuntu20" VBoxInternal/CPUM/IsaExts/AVX2 1并重新启动了客户机 - 没有任何变化(客户机的名称是 Ubuntu20)。
有什么建议吗?
更多详情:
使用 Cygwin 在主机上输出 cat /proc/cpuinfo - 它在 avx2 中有 avx:
.....
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 158
model name : Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
stepping : 9
cpu MHz : 3600.000
cache size : 256 KB
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
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 pni dtes64 est tm2 ssse3 fma cx16 xtpr pdcm sse4_1 sse4_2 movbe
popcnt aes xsave osxsave avx f16c rdrand hypervisor lahf_lm ida xsaveopt pln pts dtherm fsgsbase
tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt
TLB size : 0 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
客户机上cat /proc/cpuinfo 的输出 - 缺少 avx 和 avx2:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 158
model name : Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
stepping : 9
microcode : 0xffffffff
cpu MHz : 3599.996
cache size : 8192 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
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 rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid
tsc_known_freq pni ssse3 pcid sse4_1 sse4_2 hypervisor lahf_lm invpcid_single pti fsgsbase invpcid
md_clear flush_l1d arch_capabilities
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 7199.99
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
【问题讨论】:
-
检查您的 virtualbox 配置设置,了解 AVX 等 CPU 功能的传递。不幸的是,一些虚拟机默认不这样做,可能是为了在没有 AVX 的主机上启用挂起 -> 恢复。
-
我认为问题是,这些设置到底是什么? OP 似乎已尝试使用
setextradata命令来执行此操作。 -
哦,我明白了。也许命令行已经改变,IDK。尝试使用管理 GUI:如果您可以在其中找到 AVX 的 guest-CPU 选项,它应该可以工作。
-
我在整个 GUI 中寻找这样的设置,但没有找到任何东西。我使用了
setextradata(写在 tl;dr 部分),但没有帮助,AVX 和 AVX2 仍然不受支持。这在执行cat /proc/cpuinfo和查看日志时都可见,这表明读取了我设置为 1 的两个“额外数据”值,而稍后仍显示 AVX 和 AVX2 的值 0 (1),这意味着它在来宾上被禁用,同时受到主机的支持。 -
如果你使用的是windows,尤其是wsl2,注意hyper-v和axv是互斥的。forums.virtualbox.org/viewtopic.php?f=25&t=99390
标签: tensorflow virtual-machine virtualbox avx avx2