can we use compare function in kernel?

can we use compare(str1,str2) 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?

yes ,but how can i do it

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

ok ,do u know how to make array of string 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!