Results 1 to 3 of 3

Thread: working with thread in a kernel

  1. #1
    Banned
    Join Date
    Oct 2013
    Posts
    15

    working with thread in a kernel

    hello!!!
    I want to do this:
    I have a array "Signal" with length=1000, but I want to process it for parts, in other words: in my PC with 4 cores,
    I need that each core process 250 serial elemtents
    Core1:0-254
    Core2:250-499, etc.
    I have this kernel but doesn't work, why???

    int id = get_global_id(0);
    int i,e;
    e=id*250;
    for(i=e;i<250;i++)
    {
    ....
    }

    In the app the code is this:
    ...
    size_t local_work_size=1;
    size_t global_work_size=4;
    clEnqueueNDRangeKernel(queueGPU, kernel_Notch_Notch, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL);
    ...
    Please help me?!?!?!

  2. #2
    Your for-loop is wrong. Try something like this:

    Code :
    int id = get_global_id(0); // will be 0, 1, 2, or 3
    int start = id * 250; // index of the first element for this block
    for(int i = 0; i < 250; i++){
        // input[start+i] will be the value of the i'th element in this block
    }

  3. #3
    Newbie
    Join Date
    Nov 2013
    Posts
    2
    Or try something like this:
    Code :
    int id = get_global_id(0);
    int i,e;
    e=id*250;
    for(i=e;i<1000;i++)
    {
    ....
    }


    Quote Originally Posted by kylelutz View Post
    Your for-loop is wrong. Try something like this:
    Code :
    int id = get_global_id(0); // will be 0, 1, 2, or 3
    int start = id * 250; // index of the first element for this block
    for(int i = 0; i < 250; i++){
        // input[start+i] will be the value of the i'th element in this block
    }

Posting Permissions

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