cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

alexfd7
Adept I

Question

Hello everyone, I have a question

In this simple example of KERNEL:

__kernel void blank(__global int4 *x) {

     for(int i=0; i<25; i++) {

     x *= 2;

                              }

}

I initialized a vector, and put in a buffer and send as parameter to KERNEL:

      // Initialize data

      for(i=0; i<100; i++) {

         data = i;

      }

If I am correct, the vector of 100 positions will be divided into 4 parts, within the variable '__global int4'. And how is the execution? will be created 4 work-items in the same workgroup and executed in a single processing unit. Or will be created four work-groups and each running on a different processing unit.

I did not understand how it will be executed in relation to work-item and work-group.

To send the KERNEL to run, I'm not using the "enqueueNDRangeKernel" function, just "queue.enqueueTask (kernel);"

Thank you

0 Likes
3 Replies
nibal
Challenger

You pass all these parameters in the global and local arrays of NDRangeKernel. I can't find enqueueTask in ocl 2.0 or 1.2 Where did you find it?

You can also specify workgroups as kernel attriutes:

__kernel __attribute__((reqd_work_group_size(64, 1, 1))) void blank()

HTH

Nikos

0 Likes

Hello Nibal hor are you?

I found the answer in https://www.khronos.org/registry/cl/specs/opencl-cplusplus-1.1.pdf

About the function cl::CommandQueue::enqueueTask "The kernel is executed using a single work-item."

Thank you

0 Likes

These are C++ wrappers, that I don't use. But wrappers mean just that. You can interface them with the actual function, NDRamgeKernel if you need to. You can also use

printf("gid = %d, lid = %d, gsz = %lu, lsz = %lu\n", get_global_id(0), get_local_id(0), get_global_size(0), get_local_size(0));

from within your kernel code, to get any workgroup information you want.

Hth,

Nikos

0 Likes