【问题标题】:Setting up OpenCL in Ubuntu在 Ubuntu 中设置 OpenCL
【发布时间】: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) 路径。程序编译正确。

编辑

安装过程

  1. 先安装x64驱动14.4

  2. 我按照安装指南中的建议安装了AMD-APP-SDK-v2.9-lnx64.tgz(解压SDK,然后执行sudo ./Install-AMD-APP.sh.)。

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

  4. /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。)按照安装指南中的建议。 AMDAPPSDKROOTLD_LIBRARY_PATH 是正确的。在/use/lib 中创建了指向/usr/lib/OpenCL/vendors/amd/libOpenCl.so.1 的符号链接
  • 您能否验证/etc/OpenCL/vendors/amdocl64.icd 存在并包含位于您LD_LIBRARY_PATH 目录中的库的名称(可能是libamdocl64.so)?

标签: ubuntu opencl gpu amd-gpu


【解决方案1】:

我认为至少在 Ubuntu 15.04 上,您可以安装 fglrxfglrx-updates 和依赖项。您可以在核心包中看到所有正确的 OpenCL 库。如果您安装了 fglrx,我认为您根本不需要 AMD SDK 业务。 Andreas 给了很多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 驱动程序。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-26
    • 2018-03-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多