2014-05-10 100 views
3

我试图让我的OpenCL项目在Ubuntu中编译。我有一个兼容的Core i5和AMD HD 5660。在Ubuntu中设置OpenCL

当我执行下面的代码

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和环境变量的注册)

我做错了什么,我无法让我的编辑工作?

请注意,我正在使用Eclipse以正确的路径到lib(/opt/AMDAPP/lib/x86_64)。该程序编译正确。

EDIT

安装步骤

  1. 第一安装作为安装指南中建议的x64驱动14.4

  2. 我安装AMD-APP-SDK-v2.9-lnx64.tgz(解压SDK和比执行sudo ./Install-AMD-APP.sh.)。

  3. 验证AMDAPPSDKROOT 'and LD_LIBRARY_PATH`是正确的。

  4. 创建符号链接到/use/lib/usr/lib64/OpenCL/vendors/amd/libOpenCl.so.1(因为它是一个64位PC,由于某种原因的OpenCL会在/ lib下的x64驱动程序)
+0

Ubuntu的版本是什么? – osgx

+0

嗨,我使用Ubuntu 13.10和14.04。 ( – user3622675

+0

)您是如何安装amd驱动程序和sdk的?是否有系统(通过ubuntu的apt-get安装)amd驱动程序和sdk? – osgx

回答

0

我觉得至少的Ubuntu 15.04,你可以只安装fglrxfglrx-updates和依赖关系。您可以在核心软件包中看到所有正确的OpenCL库。如果您安装了fglrx,我认为您完全不需要AMD SDK业务。安德烈亚斯给出了很多useful information

dpkg -L fglrx-updates-core | grep -v kcl | grep cl 
/usr/bin/atiodcli 
/usr/bin/clinfo 
/usr/lib/libamdocl12cl64.so 
/usr/lib/libamdocl64.so 
/usr/lib/libaticalcl.so 
/usr/lib32/libaticalcl.so 
/usr/lib32/libamdocl32.so 
/usr/lib32/libamdocl12cl32.so 
/etc/OpenCL/vendors/amdocl64.icd 

您需要将flgrx驱动程序加载并运行。