I want to program an algebra calculation which must be devided into two parts, the latter’s input is the former’s output.

For example:

The former part is to use a vector (vectorA with n factors) as its input to add another vector(vectorB with n factors), the output is vectorC.

The latter part is to use vectorC as the input paramter of some algebra fucntions F(X)(X is vector type), because of F(X) is variable, the whole calculation must be took apart.

My problems are:

For the first part, if the kernel is:

__kernel void adder(__global const float* a, __global const float* b, __global float* result)

{

int idx = get_global_id(0);

result[idx] = a[idx] + b[idx];

}

1.Dose each work item excute only once?

2. For vectorA (with n factors) plus vectorB(with n factors), must there be n work items to complete the addition.

3.Are the n work items in the same work group?

4.In what condition, the work items are in different work group?

5.I want to continue the latter part of this calculation,input vectorC which is in global memory to kernel which has the same function of F(X), what can I do? Use event or commandqueue or some else? How ?

That’s all,please help me!