2
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.
1Yes, 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 – 2013-08-05T14:59:50.653
1Another 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 – 2013-08-05T15:04:02.247
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 – 2013-08-05T22:30:57.897