[英]Char*** in OpenCL kernel argument?
I need to pass a vector<vector<string>>
to a kernel OpenCL.我需要将
vector<vector<string>>
传递给内核 OpenCL。 What is the easiest way of doing it?最简单的方法是什么? Passing a
char***
gives me an error:传递一个
char***
给我一个错误:
__kernel void vadd(
__global char*** sets,
__global int* m,
__global long* result)
{}
ERROR: clBuildProgram(CL_BUILD_PROGRAM_FAILURE)错误:clBuildProgram(CL_BUILD_PROGRAM_FAILURE)
In OpenCL 1.x, this sort of thing is basically not possible.在 OpenCL 1.x 中,这种事情基本上是不可能的。 You'll need to convert your data such that it fits into a single buffer object, or at least into a fixed number of buffer objects.
您需要将数据转换为适合单个缓冲区对象,或至少适合固定数量的缓冲区对象。 Pointers on the host don't make sense on the device.
主机上的指针在设备上没有意义。 (With OpenCL 2's SVM feature, you can pass pointer values between host and kernel code, but you'll still need to ensure the memory is allocated in a way that's appropriate for this.)
(使用 OpenCL 2 的 SVM 功能,您可以在主机和内核代码之间传递指针值,但您仍然需要确保以适合于此的方式分配内存。)
One option I can think of, bearing in mind I know nothing about the rest of your program, is as follows:我能想到的一种选择是,记住我对程序的其余部分一无所知,如下所示:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.