问题描述

我正在尝试在Anaconda的GPU中使用pyopencl。但是找不到设备。在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


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

最佳答案

编辑:

由于PyOpenCL似乎是使用conda安装的,因此另一种可能性可以检测例如Nvidia将运行:

conda install ocl-icd-system


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

PyOpenCl的pip版本可检测到ICD

/etc/OpenCL/vendors


直。

还要确保正确安装了nvidia驱动器。如有疑问,请使用软件包管理器重新安装驱动程序,并在安装后重新引导系统。

10-07 17:30