如何在Ubuntu上为AMD Ryzen Mobile CPU安装OpenCL

3

我有一台笔记本电脑,搭载AMD Ryzen 5 2500u处理器(带有集成的Radeon Vega 8移动GPU),并使用Ubuntu 18.04.2。我想在CPU和GPU上使用C++进行一些OpenCL计算。我的问题是我不确定如何让OpenCL识别CPU。

我已经从AMD网站安装了amdgpu-pro和AMD APP SDK 3.0。 运行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)
第一个平台“Clover”带有设备“AMD RAVEN(DRM 3.26.0、4.18.0-16-generic、LLVM 7.0.0)”,设备类型为“GPU”,第二个平台带有设备“gfx902”,也似乎是我的系统的GPU。
所以我的问题是:我需要安装什么才能让OpenCL也识别出我的系统CPU?
谢谢帮忙!

晚来的评论:平台名称“Clover”表示您使用OpenCL的Mesa实现。 您不需要这个... 此外,您不需要AMD APP SDK。 您应该将它们删除。 在Ubuntu 18.04上,“amdgpu-pro”应该足够了。 - HEKTO
1个回答

3
使用OpenCL处理器需要具备支持CPU的OpenCL实现。特别地,POCL应该是可用的。AMD似乎已经放弃了他们的CPU OpenCL实现,而英特尔声称他们的实现仅适用于他们品牌的处理器。
顺便说一下,对于同一设备使用不同的OpenCL实现(例如Clover和APP),如果某些东西尝试自动分配所有设备的工作,可能会产生意想不到的结果。如果您可以指定要使用哪些设备,则应该没问题。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接