开发者

Concurrent access to OpenCL kernel parameter value

开发者 https://www.devze.com 2023-03-01 20:08 出处:网络
I\'m working of parallel application, and I would like to ask one question, because I\'m little confuse. When I have 100 instances of kernel and I would like to sell them the value, which wi开发者_Sta

I'm working of parallel application, and I would like to ask one question, because I'm little confuse. When I have 100 instances of kernel and I would like to sell them the value, which wi开发者_StackOverflow中文版ll be for every kernel the same. Must I have an array of same 100 values (for each kernel one), or good enough for me just one value for all kernel. If I use a single value, will be maintained concurrent access to this value? The value is for read only.


If you are asking if you can pass a scalar as a read-only argument to a kernel launched via clEnqueueNDRangeKernel(), like this:

__kernel void kerncode(int cval,.....) { ... };
.
.
.
int magiconstant = 1234567;
clSetKernelArg(kerncode, 0, sizeof(int),(void*)&magiconstant);
.
.
clEnqueueNDRangeKernel(queue, kerncode, ...);

then the answer yes, of course you can.

0

精彩评论

暂无评论...
验证码 换一张
取 消