Results 1 to 6 of 6

Thread: can we use compare function in kernel?

  1. #1

    can we use compare function in kernel?

    can we use compare(str1,str2) function in kernel?
    thanks

  2. #2

    Re: can we use compare function in kernel?

    I don't know of an OpenCL built-in called "compare". Are you looking for a specific functionality? Are you trying to compare zero-terminated strings inside an OpenCL kernel?

  3. #3

    Re: can we use compare function in kernel?

    yes ,but how can i do it

  4. #4

    Re: can we use compare function in kernel?

    ocl c doesn't have string functions. you can write your own. the second example from this page might work as is :

    http://www.programmingsimplified.com/c- ... wo-strings

  5. #5

    Re: can we use compare function in kernel?

    ok ,do u know how to make array of string in kernel?

  6. #6

    Re: can we use compare function in kernel?

    well, if you know how long the longest one will be, and it's not too horribly huge, I'd just use a 2-d array. If you needed 20 strings of 100 length each:

    char strang[20][100]

    and then pass &strang[20][0] for the first one, &strang[20][1] for the second...

    (I'm just guessing, as I don't have any arrays of strings in my kernel. But that kind of thing should work just fine, in my experience....)

    ... I don't think you can allocate dynamically-sized memory in a kernel (someone correct me if wrong). I haven't run into memory limitations on the GPU yet, but my task may not be like yours!

Similar Threads

  1. Atomic compare and swap
    By Elias in forum OpenCL
    Replies: 7
    Last Post: 11-19-2012, 10:35 AM
  2. Replies: 4
    Last Post: 08-22-2011, 03:51 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
  •