Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Am working a bit on CUDA, most of the examples and tutorials i see deal with implementing mathematical functions on the GPU ( Like some vector / matrix calculations).

I was wondering if we can directly use the GPU to work on strings, no mathematical functions. maybe something like matching a bunch of strings all together.

share|improve this question
1  
Yes, but it would only be efficient to do so if you were treating many strings as "byte streams" (arbitrary arrays of bytes) and applying the same type of operation on the strings with very little reading of the string data and mostly just writing. For example, if you wanted to update indexes 16 through 64 of 100000 strings of length 500 by incrementing the value of each character by 1, this might be efficient on the GPU. Each CUDA core could take several hundred strings and do this in massive parallel. It would be bad if the updated value of each string depended on other strings. –  allquixotic Aug 5 '13 at 14:59
1  
Another note; each CUDA core is fairly efficient at reading and writing the data it has control over, meaning if a specific CUDA core has to read from a string it has been "assigned", that could be fine for rapid reads/writes... but "random access", which is efficient on a CPU due to the cache and RAM architecture, where you have to skip all around in a large dataset, would be inefficient on the GPU (faster on the CPU). It depends on the workload. But the bottom line is you have to treat strings as an array, and then figure out if the operations are efficient on the GPU or not. –  allquixotic Aug 5 '13 at 15:04
    
am not trying random read write - imagine - 100 lines, each with 100 characters and i want to match the first line with the remaining 99 (e.g Line 1 with line 2, line 1 with line 3, line 1 with line 4 ... so on) and say return 1 with the matching has less than 10 characters mismatch, return 0 if more than 10 character mismatch. –  SidSen Aug 5 '13 at 22:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.