由于我没有 Nvidia GPU 来使用 CUDA,因此我尝试安装 plaidml。我使用的操作系统是 Ubuntu 16.04 LTS。在尝试安装 plaidml 之前,我检查了 clinfo 命令的输出,如下所示:
Number of platforms 1
Platform Name Intel Gen OCL Driver
Platform Vendor Intel
Platform Version OpenCL 1.2 beignet 1.1.1
Platform Profile FULL_PROFILE
Platform Extensions 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_byte_addressable_store cl_khr_spir cl_khr_icd
Platform Extensions function suffix Intel
Platform Name Intel Gen OCL Driver
Number of devices 1
Device Name Intel(R) HD Graphics IvyBridge M GT2
Device Vendor Intel
Device Vendor ID 0x8086
Device Version OpenCL 1.2 beignet 1.1.1
Driver Version 1.1.1
Device OpenCL C Version OpenCL C 1.2 beignet 1.1.1
Device Type GPU
Device Profile FULL_PROFILE
Max compute units 16
Max clock frequency 1000MHz
Device Partition (core)
Max number of sub-devices 1
Supported partition types None, None, None
Max work item dimensions 3
Max work item sizes 512x512x512
Max work group size 512
Preferred work group size multiple 16
Preferred / native vector sizes
char 16 / 8
short 8 / 8
int 4 / 4
long 2 / 2
half 0 / 8 (n/a)
float 4 / 4
double 0 / 2 (n/a)
Half-precision Floating-point support (n/a)
Single-precision Floating-point support (core)
Denormals No
Infinity and NANs Yes
Round to nearest Yes
Round to zero No
Round to infinity No
IEEE754-2008 fused multiply-add No
Support is emulated in software No
Correctly-rounded divide and sqrt operations No
Double-precision Floating-point support (n/a)
Address bits 32, Little-Endian
Global memory size 2147483648 (2GiB)
Error Correction support No
Max memory allocation 1073741824 (1024MiB)
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 8192
Global Memory cache line 64 bytes
Image support Yes
Max number of samplers per kernel 16
Max size for 1D images from buffer 65536 pixels
Max 1D or 2D image array size 2048 images
Max 2D image size 8192x8192 pixels
Max 3D image size 8192x8192x2048 pixels
Max number of read image args 128
Max number of write image args 8
Local memory type Global
Local memory size 65536 (64KiB)
Max constant buffer size 134217728 (128MiB)
Max number of constant args 8
Max size of kernel argument 1024
Queue properties
Out-of-order execution No
Profiling Yes
Prefer user sync for interop Yes
Profiling timer resolution 80ns
Execution capabilities
Run OpenCL kernels Yes
Run native kernels Yes
SPIR versions <printDeviceInfo:138: get SPIR versions size : error -30>
printf() buffer size 1048576 (1024KiB)
Built-in kernels __cl_copy_region_align4;__cl_copy_region_align16;__cl_cpy_region_unalign_same_offset;__cl_copy_region_unalign_dst_offset;__cl_copy_region_unalign_src_offset;__cl_copy_buffer_rect;__cl_copy_image_1d_to_1d;__cl_copy_image_2d_to_2d;__cl_copy_image_3d_to_2d;__cl_copy_image_2d_to_3d;__cl_copy_image_3d_to_3d;__cl_copy_image_2d_to_buffer;__cl_copy_image_3d_to_buffer;__cl_copy_buffer_to_image_2d;__cl_copy_buffer_to_image_3d;__cl_fill_region_unalign;__cl_fill_region_align2;__cl_fill_region_align4;__cl_fill_region_align8_2;__cl_fill_region_align8_4;__cl_fill_region_align8_8;__cl_fill_region_align8_16;__cl_fill_region_align128;__cl_fill_image_1d;__cl_fill_image_1d_array;__cl_fill_image_2d;__cl_fill_image_2d_array;__cl_fill_image_3d;
Device Available Yes
Compiler Available Yes
Linker Available Yes
Device Extensions 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_byte_addressable_store cl_khr_spir cl_khr_icd
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Intel Gen OCL Driver
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [Intel]
clCreateContext(NULL, ...) [default] Success [Intel]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Intel Gen OCL Driver
Device Name Intel(R) HD Graphics IvyBridge M GT2
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 Intel Gen OCL Driver
Device Name Intel(R) HD Graphics IvyBridge M GT2
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.
我想使用设备“Mesa DRI Intel(R) Ivybridge Mobile”在我的 GPU 上计算深度学习项目。
我尝试按照本指南安装 plaidml:https://github.com/plaidml/plaidml
我通过以下方式创建并激活了虚拟环境:
virtualenv plaidml
source plaidml/bin/activate
在这个虚拟环境中,我通过以下方式安装了 plaidml 和 plaidbench:
pip install plaidml-keras plaidbench
但如果我运行该命令(也在这个虚拟环境中)
plaidml-setup
选择正确的设备,但出现错误:
Traceback (most recent call last):
File "/home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/__init__.py", line 155, in load_library
return ctypes.cdll.LoadLibrary(libpath)
File "/usr/lib/python3.5/ctypes/__init__.py", line 425, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/libplaidml.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/e1326196/plaidml/bin/plaidml-setup", line 10, in <module>
sys.exit(main())
File "/home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/plaidml_setup.py", line 15, in main
ctx = plaidml.Context()
File "/home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/__init__.py", line 858, in Context
return plaidml.context.Context(_lib())
File "/home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/__init__.py", line 758, in _lib
_impl_lib = _Library()
File "/home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/__init__.py", line 177, in __init__
lib = load_library('libplaidml.so', ['lib'])
File "/home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/__init__.py", line 165, in load_library
return ctypes.cdll.LoadLibrary(libpath)
File "/usr/lib/python3.5/ctypes/__init__.py", line 425, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /home/e1326196/plaidml/lib/libplaidml.so)
我不知道为什么它不起作用,也不知道这个错误是什么意思。有人能帮我修复这个错误吗?
先感谢您!
答案1
我在 Debian 10 上没有 venv 的情况下工作。我一直在搜索神秘的 libplaidml.so,终于找到了!它在~/.local/lib/libplaidml.so
现在我们希望 plaidml 能够找到它自己的库和位于 中的本地配置文件~/.local/share/plaidml/config.json
。它也找不到它们。所以它有点问题,或者与 python3 处理本地/每个用户安装的方式不同步。查看源代码,~/.local/lib/python3.7/site-packages/plaidml/settings.py
我们看到以下代码:
def _find_config(name):
prefixes = [
sys.prefix,
os.path.join(sys.prefix, 'local'),
]
...
它获取包含“/usr”而不是“~/.local”的 sys.prefix,因此它尝试加载/usr/share/plaidml/experimental.json
而不是“~/.local/share/plaidml/experimental.json”
答案2
OSError:/home/e1326196/plaidml/lib/python3.5/site-packages/plaidml/libplaidml.so:无法打开共享对象文件:没有此文件或目录
我实际上刚刚遇到了同样的问题。从我有限的理解来看,这意味着在构建某些东西时,链接器无法找到它认为位于上方的共享库。
就我而言,我尝试通过 pip3 卸载 plaidml,然后出于某种原因,我看到库文件的位置实际上是 /usr/lib。因此,我将库文件(我应该复制)移动到错误中的上述地址,并且成功了。(从某种意义上说,它向我显示了另一个错误,但这可能是我特有的)。