OpenCL将多个不同大小的数组传递给内核

OpenCL将多个不同大小的数组传递给内核,opencl,Opencl,我想将两个不同大小的数组传递给内核,如何设置cl_ndrange 仅使用一个大小NUM_值数组,可以轻松将范围设置为 cl_ndrange range = { // 6 1, // The number of dimensions to use. {0, 0, 0}, // The offset in each dimension. To specify // that all the data is processed,

我想将两个不同大小的数组传递给内核,如何设置cl_ndrange

仅使用一个大小NUM_值数组,可以轻松将范围设置为

cl_ndrange range = { // 6
            1, // The number of dimensions to use.
            {0, 0, 0}, // The offset in each dimension. To specify
            // that all the data is processed, this is 0
            // in the test case. // 7
            {NUM_VALUES, 0, 0}, // The global range—this is how many items
            // IN TOTAL in each dimension you want to
            // process.
            {NULL, 0, 0} // The local size of each workgroup. This
            // determines the number of work items per
            // workgroup. It indirectly affects the
            // number of workgroups, since the global
            // size / local size yields the number of
            // workgroups. In this test case, there are
            // NUM_VALUE / wgs workgroups.
        };
但我不知道如何处理两个大小不同的阵列。在我的例子中,一个数组实际上用作计算的输入,而另一个数组用于查找


提前感谢。

您需要弄清楚您的内核到底要做什么。编写你的内核代码,当你完成它的时候,你可能会知道这个内核需要的启动配置。在内核执行期间查找表会改变吗?每个数组中大约有多少个元素?您使用的是什么数据类型?NDRange的大小应该与要完成的工作量相适应,这通常是输出数组的大小。如果工作是1:1,输入数组可能匹配,但查找数组可能不匹配,这没关系。