Results 1 to 2 of 2

Thread: How does OpenCL handle loops ??

  1. #1
    lcnepo
    Guest

    How does OpenCL handle loops ??

    following situation...

    global_work_size = (128,12
    local_work_size = (16,16)
    >> the result is a workgroup size of 256 /// 16x16 work items per workgroup /// and 64 workgroups

    Code :
    __kernel void example_kernel(_global int * p) {
       for(int i = 0; i < 10; i++) {
          ...
       }
    }

    is it correct, that the loop is, work group wide and for each work_group a loop is executed asynchronous? so workgroup (0,1) for example could be finished faster than workgroup (2,3) ??

    how does opencl handle loops in workgroups?
    can anyone explain that?

  2. #2

    Re: How does OpenCL handle loops ??

    It is correct that workgroup (0,1) may finish before workgroup (2,3). The latter may not even have started when the former finished, or vise versa.

    Not sure what you mean with "how does opencl handle loops in workgroups?". Each individual thread runs the iterations of the loop, and when all threads in a work group has finished then that work group is finished. When all work groups have finished, then the kernel has also finished.

Similar Threads

  1. Reg OpenCL Loops
    By mouli in forum OpenCL
    Replies: 0
    Last Post: 02-26-2012, 02:34 PM
  2. Inner loops with OpenCL
    By akhal in forum OpenCL
    Replies: 2
    Last Post: 08-03-2011, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •