Results 1 to 5 of 5

Thread: Can i call the same kernel function multiple times in a loop

  1. #1

    Can i call the same kernel function multiple times in a loop

    I have two for loops, in the outer for loop i want the result of inner for loop, what I want to do is parallelize the inner for loop which i will be doing using OpenCL. So for the outer loop i need to execute the inner loop multiple times.

  2. #2

    Re: Can i call the same kernel function multiple times in a

    You can call a kernel function an unlimited number of times within any sort of loops structure.

  3. #3

    Re: Can i call the same kernel function multiple times in a

    Can we have print statements inside the kernel function??

  4. #4
    Senior Member
    Join Date
    Oct 2012
    Posts
    166

    Re: Can i call the same kernel function multiple times in a

    Not all Vendors support that feature. Look for the extension in amd and intel sdk. Nvidia will not work afaik

  5. #5

    Re: Can i call the same kernel function multiple times in a

    I am writing an OpenCL code which parallelizes finding the minimum number in an array.
    Here is my kernel function:
    What i am doing is comparing all the elements with all the other elements and the element which is greater i am changing the corresponding value of M[i] to 1. At last we have only one element in M array with value 0, with that index we can look in the A array and have our minimum value

    __kernel void array(__global int *A, __global int *M) {

    // Get index of the element
    int i = get_global_id(0);
    int j = get_global_id(1);


    //barrier(CLK_LOCAL_MEM_FENCE);
    // Do the operation

    if(A[i]<A[j] && i!=j)
    {M[j]=1;}
    }
    I am getting all the values M array as 0.
    But the output should be that only one value of the M array should be 0. and that index would give me the min number index in array A.

Similar Threads

  1. Replies: 4
    Last Post: 08-22-2011, 03:51 AM
  2. calling the same kernel object multiple times
    By poonaatsoc in forum OpenCL
    Replies: 3
    Last Post: 07-29-2009, 12:06 PM

Posting Permissions

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