Results 1 to 5 of 5

Thread: hardware problem related to OpenCL

Hybrid View

  1. #1
    Newbie
    Join Date
    Sep 2013
    Posts
    3

    hardware problem related to OpenCL

    When get_global_id() is used to different devices, the return value is obviously different. Who is in charge of the id configruation to different device? Is is the hardware or the SDK by manufactor?

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Posts
    166
    This Function will give you the thread ID and should be [0;get_global_size()-1] on all devices. if thats not the case, your openCL impelementation is not valid and the hardwaremanufactor who provides you your library should fix that.

  3. #3
    Newbie
    Join Date
    Sep 2013
    Posts
    3
    Does the function get_global_id() ask the operating system to generate a new thread? If so, who index this thread? The operating system or the function get_global_id()?

  4. #4
    Junior Member
    Join Date
    Jul 2011
    Location
    Bristol, UK
    Posts
    19
    No, the function get_global_id() just returns the index of the thread (work-item) that is executing. When you call clEnqueueNDRangeKernel(), you specify how many threads (work-items) you want to create. Each work-item will run an instance of your kernel, and each will receive a different index from get_global_id().

    For example, if I have a kernel defined as:
    Code :
    __kernel void foobar()
    {
      int i = get_global_id(0);
      printf("Executing work-item %d\n", i);
    }
    and I execute this kernel like this:
    Code :
    size_t global = 4;
    clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global, NULL, 0, NULL, NULL);
    This will create 4 work-items (the global size), and you will see output like this:
    Code :
    Executing work-item 0
    Executing work-item 1
    Executing work-item 2
    Executing work-item 3
    (although these may appear in a different order, since these work-items can execute in parallel).

    I hope that makes things a little clearer.

  5. #5
    Newbie
    Join Date
    Sep 2013
    Posts
    3
    yes, I see. Thank you!

Posting Permissions

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