OpenCL缓冲区读取错误

时间:2014-07-09 12:20:48

标签: c opencl

我正在开发OpenCL程序,但是当我尝试运行它时,我收到此错误 - 我在谷歌中找不到任何内容。

当我运行程序时,我会得到这个输出:

Checking platform "NVIDIA CUDA": trying device "GeForce GTX 560 Ti"... context ok
Trying to load kernel code from "..."... success
Compiler messages are 2 bytes long.
Compiler messages:

Could not enqueue buffer read for 'size': -5

我完全不知道为什么会出现此错误以及如何解决此问题?

在我的第一个函数中,我创建了数组并调用了扫描(独占的朴素扫描):

local int16_t offsets[64];
local int16_t offsets_out[64];
barrier(CLK_LOCAL_MEM_FENCE);
scan(offsets_out, offsets, pos, self);

这是我的扫描:

void scan(local int16_t *g_odata, local int16_t *g_idata, uint8_t pos, const uint self)
{

    /* Load input into shared memory.
     * This is exclusive scan, so shift right by one
     * and set first element to 0
     */
    offsets[self] = pos;
    offsets_out[self] = pos;
    barrier(CLK_LOCAL_MEM_FENCE);

    for (int i = 1; i <= 6; i++)  // log2(64) = 6
    {
        uint8_t reg = 1 << (i-1);        // 2^(i-1)
        if (self >= reg)
            g_odata[self] += g_idata[self - reg];
        barrier(CLK_LOCAL_MEM_FENCE);

        g_idata[self] = g_odata[self];
        barrier(CLK_LOCAL_MEM_FENCE);
    }

    g_odata[self] -= pos;
    barrier(CLK_LOCAL_MEM_FENCE);
}

0 个答案:

没有答案