【问题标题】:PyOpenCL no device foundPyOpenCL 找不到设备
【发布时间】:2019-01-26 16:34:20
【问题描述】:

问题描述

我正在尝试在 Anaconda 中将 pyopencl 与我的 GPU 一起使用。但是没有找到设备。在 Python 中,我得到以下输出:

>>> import pyopencl as cl
>>> cl.get_platforms()
[<pyopencl.Platform 'Clover' at 0x7f3569088100>]
>>> cl.get_platforms()[0].get_devices()
[]

当我运行sudo clinfo:

Number of platforms                               1
  Platform Name                                   Clover
  Platform Vendor                                 Mesa
  Platform Version                                OpenCL 1.1 Mesa 18.0.5
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd
  Platform Extensions function suffix             MESA

  Platform Name                                   Clover
Number of devices                                 0

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  Clover
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Clover
  clCreateContext(NULL, ...) [default]            No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  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)  No devices found in platform

ICD loader properties
  ICD loader Name                                 OpenCL ICD Loader
  ICD loader Vendor                               OCL Icd free software
  ICD loader Version                              2.2.8
  ICD loader Profile                              OpenCL 1.2
    NOTE:   your OpenCL library declares to support OpenCL 1.2,
        but it seems to support up to OpenCL 2.1 too.

GPU 规格:

sudo lshw -C video

  *-display               
       description: 3D controller
       product: NVIDIA Corporation
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:134 memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:df000000-df07ffff
  *-display
       description: VGA compatible controller
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 04
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:125 memory:dd000000-ddffffff memory:b0000000-bfffffff ioport:f000(size=64) memory:c0000-dffff

OCL 驱动程序:

我安装了最新版本的 nvidia-opencl-icd-410 软件包,并将文件 mesa.icd 从 /etc/OpenCL/vendors 复制到 /usr/lib/anadonda3/etc/OpenCL/vendors,如 here 所述.

这是文件的内容:

libMesaOpenCL.so.1

我可能遗漏了一些东西,如果有人可以帮助我,我会很高兴!

【问题讨论】:

    标签: ubuntu anaconda nvidia pyopencl


    【解决方案1】:

    编辑:

    由于 PyOpenCL 似乎是使用 conda 安装的,因此还有另一种可能来检测系统范围内的 OpenCL ICD,例如英伟达要跑:

    conda install ocl-icd-system
    

    建议:https://documen.tician.de/pyopencl/misc.html

    PyOpenCl 的 pip 版本检测 ICD

    /etc/OpenCL/vendors
    

    直接。

    还要确保您的 nvidia 驱动器安装正确。如果有疑问,请使用包管理器重新安装驱动程序并在安装后重新启动系统。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-19
      • 2023-03-11
      • 1970-01-01
      • 2020-10-06
      相关资源
      最近更新 更多