我如何在 Ubuntu 上为 AMD Ryzen Mobile CPU 安装 opencl
How can I install opencl on Ubuntu for AMD Ryzen Mobile CPU
我有一台配备 AMD Ryzen 5 2500u(集成了 radeon vega 8 移动 GPU)处理器的笔记本电脑并使用 Ubuntu 18.04.2。我想 运行 在 CPU 和 GPU 上使用 C++ 进行一些 OpenCL 计算。我的问题是我不确定 opencl 如何识别 cpu.
我已经从amd 网站和AMD APP SDK 3.0 安装了amdgpu-pro。在我 运行 clinfo 之后,我得到以下输出:
Number of platforms 2
Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 Mesa 18.2.8
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA
Platform Name AMD Accelerated
Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (2671.3)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
cl_amd_event_callback cl_amd_offline_devices
Platform Host timer resolution 1ns
Platform Extensions function suffix AMD
Platform Name Clover
Number of devices 1
Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
Device Vendor AMD
Device Vendor ID 0x1002
Device Version OpenCL 1.1 Mesa 18.2.8
Driver Version 18.2.8
Device OpenCL C Version OpenCL C 1.1
Device Type GPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Max compute units 8
Max clock frequency 1100MHz
Max work item dimensions 3
Max work item sizes 256x256x256
Max work group size 256
Preferred work group size multiple 64
Preferred / native vector sizes
char 16 / 16
short 8 / 8
int 4 / 4
long 2 / 2
half 8 / 8 (cl_khr_fp16)
float 4 / 4
double 2 / 2 (cl_khr_fp64)
Half-precision Floating-point support (cl_khr_fp16)
...
Platform Name AMD Accelerated Parallel Processing
Number of devices 1
Device Name gfx902
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 1.2 AMD-APP (2671.3)
Driver Version 2671.3 (PAL,HSAIL)
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Board Name (AMD) Unknown AMD GPU
Device Topology (AMD) PCI-E, 05:00.0
Device Profile FULL_PROFILE
.......
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) No platform
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) No platform
clCreateContext(NULL, ...) [default] No platform
clCreateContext(NULL, ...) [other] Success [MESA]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name Clover
Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Clover
Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
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 Clover
Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
设备 'AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)' 的第一个平台 'Clover' 的设备类型为 'GPU',设备 'gfx902' 的第二个平台似乎也是我系统的 GPU。
所以我的问题是:我必须安装什么才能让 opencl 也识别我系统的 cpu?
感谢您的帮助!
将 CPU 与 OpenCL 一起使用自然需要支持 CPU 的 OpenCL 实现。特别是 POCL 应该可用。 AMD 似乎已经放弃了他们的 CPU OpenCL 实施,而英特尔声称他们的实施仅适用于他们的处理器品牌。
顺便说一句,如果尝试将工作自动分配给所有设备,混合使用同一设备(例如 Clover 和 APP)的 OpenCL 实现可能会产生令人惊讶的结果。如果您可以指定要使用的设备应该没问题。
我有一台配备 AMD Ryzen 5 2500u(集成了 radeon vega 8 移动 GPU)处理器的笔记本电脑并使用 Ubuntu 18.04.2。我想 运行 在 CPU 和 GPU 上使用 C++ 进行一些 OpenCL 计算。我的问题是我不确定 opencl 如何识别 cpu.
我已经从amd 网站和AMD APP SDK 3.0 安装了amdgpu-pro。在我 运行 clinfo 之后,我得到以下输出:
Number of platforms 2
Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 Mesa 18.2.8
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA
Platform Name AMD Accelerated
Parallel Processing Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (2671.3)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Host timer resolution 1ns
Platform Extensions function suffix AMD
Platform Name Clover
Number of devices 1
Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
Device Vendor AMD
Device Vendor ID 0x1002
Device Version OpenCL 1.1 Mesa 18.2.8
Driver Version 18.2.8
Device OpenCL C Version OpenCL C 1.1
Device Type GPU
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Max compute units 8
Max clock frequency 1100MHz
Max work item dimensions 3
Max work item sizes 256x256x256
Max work group size 256
Preferred work group size multiple 64
Preferred / native vector sizes
char 16 / 16
short 8 / 8
int 4 / 4
long 2 / 2
half 8 / 8 (cl_khr_fp16) float 4 / 4
double 2 / 2 (cl_khr_fp64)Half-precision Floating-point support (cl_khr_fp16)
...
Platform Name AMD Accelerated Parallel Processing
Number of devices 1
Device Name gfx902
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 1.2 AMD-APP (2671.3)
Driver Version 2671.3 (PAL,HSAIL)
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Board Name (AMD) Unknown AMD GPU
Device Topology (AMD) PCI-E, 05:00.0
Device Profile FULL_PROFILE
.......
NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) No platform
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) No platform
clCreateContext(NULL, ...) [default] No platform
clCreateContext(NULL, ...) [other] Success [MESA]
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1)
Platform Name Clover Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1)
Platform Name Clover Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
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 Clover Device Name AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)
设备 'AMD RAVEN (DRM 3.26.0, 4.18.0-16-generic, LLVM 7.0.0)' 的第一个平台 'Clover' 的设备类型为 'GPU',设备 'gfx902' 的第二个平台似乎也是我系统的 GPU。
所以我的问题是:我必须安装什么才能让 opencl 也识别我系统的 cpu?
感谢您的帮助!
将 CPU 与 OpenCL 一起使用自然需要支持 CPU 的 OpenCL 实现。特别是 POCL 应该可用。 AMD 似乎已经放弃了他们的 CPU OpenCL 实施,而英特尔声称他们的实施仅适用于他们的处理器品牌。
顺便说一句,如果尝试将工作自动分配给所有设备,混合使用同一设备(例如 Clover 和 APP)的 OpenCL 实现可能会产生令人惊讶的结果。如果您可以指定要使用的设备应该没问题。