问题描述
我正在尝试在 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
我可能遗漏了一些东西,如果有人能帮助我,我会很高兴!
最佳答案
编辑:
由于 PyOpenCL 似乎是使用 conda 安装的,另一种可能性是检测系统范围内的 OpenCL ICD,例如由Nvidia 将运行:
conda install ocl-icd-system
根据建议:https://documen.tician.de/pyopencl/misc.html
PyOpenCl 的 pip 版本检测 ICD
/etc/OpenCL/vendors
直接。
还要确保您的 nvidia 驱动器安装正确。如果有疑问,请使用包管理器重新安装驱动程序并在安装后重新启动系统。
关于ubuntu - PyOpenCL 找不到设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54380371/