View Full Version : can we use compare function in kernel?
01-06-2013, 12:44 AM
can we use compare(str1,str2) function in kernel?
01-11-2013, 02:34 PM
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?
01-12-2013, 12:38 AM
yes ,but how can i do it
01-12-2013, 11:53 AM
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 (http://www.programmingsimplified.com/c-program-compare-two-strings)
01-12-2013, 08:25 PM
ok ,do u know how to make array of string in kernel?
01-15-2013, 02:33 PM
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:
and then pass &strang for the first one, &strang 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!
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.