tensorflow - 如何在 Ubuntu 20.04 64 位的 VirtualBox 6.1.16 中启用 AVX/AVX2?

标签 tensorflow virtual-machine virtualbox avx avx2

特尔;博士:

  • 使用 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]
  • 在 guest 机器上(使用 VirtualBox 6.1.16 的 Ubuntu 20.04 64 位,18.04 也会发生同样的情况),缺少 AVX 和 AVX2。
  • 根据现有线程的建议,我运行了 VBoxManage setextradata "Ubuntu20" VBoxInternal/CPUM/IsaExts/AVX 1VBoxManage setextradata "Ubuntu20" VBoxInternal/CPUM/IsaExts/AVX2 1在主机上并重新启动 guest 机器 - 没有任何改变( guest 机器的名称是 Ubuntu20)。

  • 有什么建议吗?
    更多细节:cat /proc/cpuinfo 的输出在使用 Cygwin 的主机上 - 它在 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 的输出在 guest 机器上 - 缺少 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:
    

    最佳答案

    我遇到了类似的问题。我的 Windows CPU 启用了正确的标志,但在我的 ubuntu20.04 虚拟机上导入 tensorflow 失败并显示非法指令。如上所述,我确认 hypervisorlaunchtype 已设置为关闭。问题是在 VirtualBox Manager 安装过程中出了点问题。所以,我卸载了它,然后重新安装了它。我第一次这样做时显示了一些错误,所以我又重复了一遍,这次我得到了一个干净的安装,没有任何错误。我确认我的 ubuntu20.04 VM 现在按照我的预期显示了正确的 CPU 标志。我仍然需要卸载/重新安装 tensorflow 和 numpy 才能使其正常工作。如果其他人觉得它有用,请在此处添加它。

    关于tensorflow - 如何在 Ubuntu 20.04 64 位的 VirtualBox 6.1.16 中启用 AVX/AVX2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65780506/

    相关文章:

    machine-learning - Adam 方法中的参数 delta

    python - 如何实现一个以非全连接层作为最后一层的神经网络?

    python - Keras 自定义损失计算不正确

    Azure Powershell : Find the creator of a virtual machine

    javascript - VirtualBox 限制了可以从共享文件夹中包含的 .js 文件的大小?

    python - 在 Tensorflow 2.0 中使用自定义层时,渐变返回 None

    testing - 在 Windows 虚拟机上运行 Jenkins 作业

    azure - 无法连接两个 Azure 虚拟机 - 权限被拒绝(公钥)

    visual-studio - 是否可以使用 Visual Studio 远程调试 VirtualBox?

    virtual-machine - 将 VirtualBox vhd 移动到另一个位置会导致 vhd 出现 uuid 问题