尝试在虚拟机上安装 OpenCL



PC Config:AMD 双核 E-350 1.6GhzAMD 6310 高清显卡

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

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

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

varun@varun-virtual-machine:/$ 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).

从 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

测试:

  • WSL Ubuntu 20.04 on Windows
  • Ubuntu 18.04, 20.04 on Github Actions (Azure VMs)

非常感谢 PoCL 团队使这成为可能!

可以在

虚拟机中运行 OpenCL,但您只能访问 CPU 设备。英特尔 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/

最新更新