Parallel Approaches to the String Matching Problem on the GPU

We design a family of parallel algorithms and GPU implementations for the exact string matching problem, based on Rabin-Karp (RK) randomized string matching. We describe and analyze three primary parallel approaches to binary string matching: cooperative (CRK), divide-and-conquer (DRK), and a novel hybrid of both (HRK). The CRK is most effective for large patterns (>8K characters), while the DRK approach is superior for shorter patterns. We then generalize the DRK to support any alphabet size without loss of performance. Our DRK method achieves up to a 64 GB/s processing rate on 8-character patterns from an 8-bit alphabet on an NVIDIA Tesla K40c GPU. We next demonstrate a novel parallel two-stage matching method (DRK-2S), which first skims the text for a smaller subset of the pattern and then verifies all potential matches in parallel. Our DRK-2S method is superior for pattern sizes up to 64k compared to the fastest CPU-based string matching implementations. With an 8-bit alphabet and up to 1k-character patterns, we get a geometric mean speedup of 4.81x against the best CPU methods, and can achieve a processing rate of at least 53 GB/s.

[1]  Sartaj Sahni,et al.  GPU-to-GPU and Host-to-Host Multipattern String Matching on a GPU , 2013, IEEE Transactions on Computers.

[2]  Zvi Galil,et al.  Optimal parallel algorithms for string matching , 1984, STOC '84.

[3]  Kevin Skadron,et al.  Scalable parallel programming , 2008, 2008 IEEE Hot Chips 20 Symposium (HCS).

[4]  Robert S. Boyer,et al.  A fast string searching algorithm , 1977, CACM.

[5]  Thierry Lecroq,et al.  The exact online string matching problem: A review of the most recent results , 2013, CSUR.

[6]  Konstantinos G. Margaritis,et al.  String Matching on a Multicore GPU Using CUDA , 2009, 2009 13th Panhellenic Conference on Informatics.

[7]  Uzi Vishkin,et al.  Optimal Parallel Pattern Matching in Strings , 2017, Inf. Control..

[8]  Guy E. Blelloch,et al.  Prefix sums and their applications , 1990 .

[9]  Donald E. Knuth,et al.  Fast Pattern Matching in Strings , 1977, SIAM J. Comput..

[10]  Cheng-Hung Lin,et al.  Accelerating Regular Expression Matching Using Hierarchical Parallel Machines on GPU , 2011, 2011 IEEE Global Telecommunications Conference - GLOBECOM 2011.

[11]  Nathan Bell,et al.  Thrust: A Productivity-Oriented Library for CUDA , 2012 .

[12]  Richard M. Karp,et al.  Efficient Randomized Pattern-Matching Algorithms , 1987, IBM J. Res. Dev..

[13]  Thierry Lecroq,et al.  Fast exact string matching algorithms , 2007, Inf. Process. Lett..

[14]  Cole Trapnell,et al.  Fast Exact String Matching on the GPU , 2011 .