【发布时间】:2014-06-27 23:41:13
【问题描述】:
我试图在 Ubuntu 中编译我的 OpenCL 项目。我有一个兼容的 Core i5 和 AMD HD 5660。
当我执行以下代码时
cl_int status;
// Retrieve the number of platforms
cl_uint numPlatforms = 0;
status = clGetPlatformIDs(0, NULL, &numPlatforms);
if (status != CL_SUCCESS)
{
std::cout << "Error: Getting platforms!" << std::endl;
std::cin.get();
}
我收到Error: Getting platforms!
当我执行clinfo 时,我得到:terminate called after throwing an instance of 'cl::Error \n what(): clGetPlatformIDs'
我正在使用 AMD 驱动程序 14.4 和 SDK 2.9(在 AMD 安装指南中提到,设置这两个文件将处理 icd 和环境变量的注册)
我做错了什么,无法让我的 prog 工作?
请注意,我使用的 Eclipse 具有正确的 lib (/opt/AMDAPP/lib/x86_64) 路径。程序编译正确。
编辑
安装过程
先安装x64驱动14.4
我按照安装指南中的建议安装了
AMD-APP-SDK-v2.9-lnx64.tgz(解压SDK,然后执行sudo ./Install-AMD-APP.sh.)。验证
AMDAPPSDKROOT 'andLD_LIBRARY_PATH` 是正确的。- 在
/use/lib中创建了指向/usr/lib64/OpenCL/vendors/amd/libOpenCl.so.1的符号链接(因为它是x64 位PC,并且出于某种原因,opencl 在/lib 中查找x64 驱动程序)
【问题讨论】:
-
你的 Ubuntu 是什么版本?
-
嗨,我使用的是 ubuntu 13.10 和 14.04。两者都有相同的问题:(
-
你是怎么安装amd驱动和sdk的?是否有系统(通过ubuntu的apt-get安装)amd驱动和sdk?
-
首先安装 x64 驱动程序 14.4 我安装了
AMD-APP-SDK-v2.9-lnx64.tgz(解压 SDK 然后执行sudo ./Install-AMD-APP.sh。)按照安装指南中的建议。AMDAPPSDKROOT和LD_LIBRARY_PATH是正确的。在/use/lib中创建了指向/usr/lib/OpenCL/vendors/amd/libOpenCl.so.1的符号链接 -
您能否验证
/etc/OpenCL/vendors/amdocl64.icd存在并包含位于您LD_LIBRARY_PATH目录中的库的名称(可能是libamdocl64.so)?