【问题标题】:Trying to install OpenCL on VM尝试在 VM 上安装 OpenCL
【发布时间】:2015-03-15 19:51:27
【问题描述】:

电脑配置: AMD 双核 E-350 1.6Ghz AMD 6310 高清显卡

我在 Windows 8 上的 VMware Player 上运行 Ubuntu 14.04,并试图弄清楚我是否可以在 ubunutu 上运行 OpenCL,即使用 VM。

我正在阅读如何安装 OpenCL 的手册,第一步给出了这个输出。有人可以看到输出并告诉我应该做什么吗?我可以在 VM 上运行 OpenCL 吗?

1)首先,我们需要检查我们的系统配置,以确定是否可以在我们的机器上安装 OpenCL。我们可以在终端上运行“Hardinfo”命令来获取我们系统配置的完整摘要。如果我们的系统中没有安装 Hardinfo 命令,那么我们可以通过在终端上运行以下命令来轻松安装它: sudo apt-get install hardinfo 2)如果我们的系统可以支持OpenCL,那么我们可以进入OpenCL的实际安装。 3) 从Intel's web site 下载面向 OpenCL 应用程序的英特尔 SDK。 .....

varun@varun-virtual-machine:/$ hardinfo

当前未安装程序“hardinfo”。您可以通过键入以下内容来安装它: sudo apt-get install hardinfo

varun@varun-virtual-machine:/$ sudo apt-get install hardinfo

Reading package lists... Done
Building dependency tree

Reading state information... Done

您可能需要运行“apt-get -f install”来纠正这些问题:

以下包具有未满足的依赖关系:

fglrx : Depends: fglrx-core but it is not installable
         Recommends: fglrx-amdcccle but it is not going to be installed

E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

【问题讨论】:

  • 虚拟机中没有硬件加速的 OpenCL(除非您可以通过 PCI-passthrough 将 GPU 传递给 VM,即使这样也不可靠)。
  • 所以我应该双启动 Windows 和 Ubuntu?
  • 是的,这是一个更好的主意。

标签: linux virtual-machine opencl ubuntu-14.04


【解决方案1】:

可以在虚拟机中运行 OpenCL,但您只能访问 CPU 设备。 Intel SDK 将无法工作,因为它有严格的硬件要求,但 AMD SDK 可以正常安装。我在 Windows 8 + VirtualBox 下的 Ubuntu 14.04 VM 上使用 AMD-APP-SDK-v2.8-RC-lnx64 运行。您可以从这里获取 SDK:http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/download-archive/

【讨论】:

    【解决方案2】:

    从 Ubuntu 18.04 开始,您需要获得一个在纯 CPU 环境(如 VM)上运行的 OpenCL 版本:

    sudo apt-get install libpocl2
    

    然后clinfo会告诉你,例如:

    Number of platforms                               1
      Platform Name                                   Portable Computing Language
      Platform Vendor                                 The pocl project
      Platform Version                                OpenCL 1.2 pocl 1.4, None+Asserts, LLVM 9.0.1, RELOC, SLEEF, DISTRO, POCL_DEBUG
      Platform Profile                                FULL_PROFILE
      Platform Extensions                             cl_khr_icd
      Platform Extensions function suffix             POCL
    
      Platform Name                                   Portable Computing Language
    Number of devices                                 1
      Device Name                                     pthread-Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      Device Vendor                                   GenuineIntel
      Device Vendor ID                                0x6c636f70
      Device Version                                  OpenCL 1.2 pocl HSTR: pthread-x86_64-pc-linux-gnu-skylake
      Driver Version                                  1.4
      Device OpenCL C Version                         OpenCL C 1.2 pocl
      Device Type                                     CPU
      Device Profile                                  FULL_PROFILE
      Device Available                                Yes
      Compiler Available                              Yes
      Linker Available                                Yes
      Max compute units                               8
      Max clock frequency                             2807MHz
      Device Partition                                (core)
        Max number of sub-devices                     8
        Supported partition types                     equally, by counts
        Supported affinity domains                    (n/a)
      Max work item dimensions                        3
      Max work item sizes                             4096x4096x4096
      Max work group size                             4096
      Preferred work group size multiple              8
      Preferred / native vector sizes
        char                                                16 / 16
        short                                               16 / 16
        int                                                  8 / 8
        long                                                 4 / 4
        half                                                 0 / 0        (n/a)
        float                                                8 / 8
        double                                               4 / 4        (cl_khr_fp64)
      Half-precision Floating-point support           (n/a)
      Single-precision Floating-point support         (core)
        Denormals                                     Yes
        Infinity and NANs                             Yes
        Round to nearest                              Yes
        Round to zero                                 Yes
        Round to infinity                             Yes
        IEEE754-2008 fused multiply-add               Yes
        Support is emulated in software               No
        Correctly-rounded divide and sqrt operations  Yes
      Double-precision Floating-point support         (cl_khr_fp64)
        Denormals                                     Yes
        Infinity and NANs                             Yes
        Round to nearest                              Yes
        Round to zero                                 Yes
        Round to infinity                             Yes
        IEEE754-2008 fused multiply-add               Yes
        Support is emulated in software               No
      Address bits                                    64, Little-Endian
      Global memory size                              24638332928 (22.95GiB)
      Error Correction support                        No
      Max memory allocation                           8589934592 (8GiB)
      Unified memory for Host and Device              Yes
      Minimum alignment for any data type             128 bytes
      Alignment of base address                       1024 bits (128 bytes)
      Global Memory cache type                        Read/Write
      Global Memory cache size                        6291456 (6MiB)
      Global Memory cache line size                   64 bytes
      Image support                                   Yes
        Max number of samplers per kernel             16
        Max size for 1D images from buffer            536870912 pixels
        Max 1D or 2D image array size                 2048 images
        Max 2D image size                             16384x16384 pixels
        Max 3D image size                             2048x2048x2048 pixels
        Max number of read image args                 128
        Max number of write image args                128
      Local memory type                               Global
      Local memory size                               4194304 (4MiB)
      Max number of constant args                     8
      Max constant buffer size                        4194304 (4MiB)
      Max size of kernel argument                     1024
      Queue properties
        Out-of-order execution                        Yes
        Profiling                                     Yes
      Prefer user sync for interop                    Yes
      Profiling timer resolution                      1ns
      Execution capabilities
        Run OpenCL kernels                            Yes
        Run native kernels                            Yes
      printf() buffer size                            16777216 (16MiB)
      Built-in kernels                                (n/a)
      Device Extensions                               cl_khr_byte_addressable_store cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp64
    
    NULL platform behavior
      clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Portable Computing Language
      clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [POCL]
      clCreateContext(NULL, ...) [default]            Success [POCL]
      clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
        Platform Name                                 Portable Computing Language
        Device Name                                   pthread-Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  Success (1)
        Platform Name                                 Portable Computing Language
        Device Name                                   pthread-Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  No devices found in platform
      clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR)  No devices found in platform
      clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM)  No devices found in platform
      clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL)  Success (1)
        Platform Name                                 Portable Computing Language
        Device Name                                   pthread-Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    
    ICD loader properties
      ICD loader Name                                 OpenCL ICD Loader
      ICD loader Vendor                               OCL Icd free software
      ICD loader Version                              2.2.11
      ICD loader Profile                              OpenCL 2.1
    

    测试:

    非常感谢PoCL team 让这一切成为可能!

    【讨论】:

    • 谢谢,sudo apt-get install libpocl2 非常重要!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-27
    • 2016-12-10
    • 2012-01-16
    相关资源
    最近更新 更多