Results 1 to 2 of 2

Thread: Comparing two arrays

  1. #1

    Comparing two arrays

    I have 2 arrays, i am declaring the global work size equal to the size of one array, and in each thread i am comparing every element of one array with all the other elements of the 2nd array - this i am doing using a for loop.
    Is there a better method to compare both the arrays in which i don't need to use the for loop??

  2. #2

    Re: Comparing two arrays

    You could launch your work as a 2D NDRange. Then, you could use get_global_id(0) to be the index of one array and get_global_id(1) to be the index in the other. This could successfully get rid of the loop, but it's hard to say if it results in faster code. If the code is only doing one comparison, the overhead of lauching work on the compute units may eclipse the computation cost. But if you are doing more work than just the comparison, this path may result in simpler code.

Similar Threads

  1. Pointers to arrays
    By IRWolfie- in forum OpenCL
    Replies: 4
    Last Post: 03-29-2011, 06:23 AM
  2. Arrays to the kernel
    By bharath.s.jois in forum OpenCL
    Replies: 3
    Last Post: 03-13-2011, 03:35 PM
  3. Arrays of images
    By pelotoescogorciao in forum Suggestions for next release
    Replies: 2
    Last Post: 01-31-2011, 01:26 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
  •