PyOpenCL找不到设备

时间:2019-01-26 16:34:20

标签: ubuntu anaconda nvidia pyopencl

问题描述

我正在尝试在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,如{{3 }}。

这是文件的内容:

libMesaOpenCL.so.1

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

1 个答案:

答案 0 :(得分:0)

编辑:

由于PyOpenCL似乎是使用conda安装的,因此有另一种可能性来检测系统范围内的OpenCL ICD,例如: Nvidia将运行:

conda install ocl-icd-system

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

PyOpenCl的pip版本可以检测到其中的ICD

/etc/OpenCL/vendors

直接。

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

相关问题