【问题标题】:Error when using ArrayFire with OpenCL将 ArrayFire 与 OpenCL 一起使用时出错
【发布时间】:2016-06-07 07:48:01
【问题描述】:

我成功安装了 ArrayFire,当我选择 Visual Studio 配置 CUDA_x64 时,示例 helloworld 工作正常。但是当我更改为 OpenCL_x64 时,编译成功,但出现如下运行错误:

/**************************************************** ***********************/

ArrayFire Exception (Internal error:998):
In function __cdecl opencl::DeviceManager::DeviceManager(void)
In file src\backend\opencl\platform.cpp:329
OpenCL Error (-2): Device Not Available when calling clCreateContext

In function void __cdecl af::setDevice(const int)
In file src\api\cpp\device.cpp:91

/**************************************************** ***********************/

任何答案将不胜感激。提前致谢。

【问题讨论】:

    标签: opencl arrayfire


    【解决方案1】:

    -2 是CL_DEVICE_NOT_AVAILABLE,“如果设备中的设备当前不可用,即使设备由 clGetDeviceIDs 返回”。您可以谷歌搜索错误的名称,并找到一些描述可能发生这种情况的网页;两种常见的情况是在旧芯片上使用英特尔 CPU 驱动程序(最新的英特尔 OpenCL SDK 需要 SSE 4.2),或者在不可用时请求 OpenCL/OpenGL 互操作。

    【讨论】:

    • 我的电脑有两个 OpenCL 平台,一个是 Intel,另一个是 NVIDIA。对于 OpenCL,可以在特定平台上查询设备。然而 ArrayFire 并没有为我们提供设置平台的 API。当我同时调用 af::getDevice() 和 af::devicecount() 时,程序会抛出异常。
    • 然后手动创建,并将其设置为ArrayFire,它具有这样做的功能:arrayfire.org/docs/…
    猜你喜欢
    • 2011-07-10
    • 1970-01-01
    • 1970-01-01
    • 2016-11-05
    • 2021-12-06
    • 2015-07-15
    • 2016-05-04
    • 2014-02-10
    • 2016-04-03
    相关资源
    最近更新 更多