Jumbled Matching with SIMD Sukhpal Singh Ghuman and
Jumbled Matching with SIMD Sukhpal Singh Ghuman and Jorma Tarhio
Outline Definition Motivation Previous algorithms SIMD Jumbled matching with SIMD Experimental results Concluding remarks 2
Jumbled matching A substring u of T is a jumbled equivalent to P if the count of each character in P is equal to its count in u and |P| = |u| holds. To find substrings of T which are permutations of P. For example: P = edcba in T = aabecdcddee. 3
Jumbled matching Jumbled patterns can be described as Parikh vector. Vector of multiplicities of the characters. p(S) is (1, 2, 1) for S = abcb. 4
Motivation Alignment of strings SNP discovery Discovery of repeated patterns Interpretation of mass spectrometry data 5
Previous Algorithms: Count Key Idea - scan the text forward while maintaining counts of characters. Work in linear time. These algorithms were developed as filtration methods for online approximate string matching. 6
Previous Algorithms: BAM Cantone and Faro (Proc. PSC 2014) presented the BAM algorithm (Bit-parallel Abelian Matcher). Associate a counter (bin) to each distinct character in P. A single 1 -bit counter for the remaining characters of the alphabet. 7
Bit Parallel simulation P = abbccc c b a other characters 8
Previous Algorithms Chhabra et al. (Proc. PSC 2015) presented: • • BAM 2 - A variation of BAM that handles a 2 - gram at a time. EBL (Exact Backward for Large alphabets) - Based on the SBNDM 2 algorithm. 9
SIMD The SIMD architecture allows the execution of multiple data on single instruction. Sixteen 128 -bit registers known as XMM 0 to XMM 15. We use specialized string matching SIMD instructions in addition to standard SIMD instructions 10
Jumbled Matching + SIMD comprise of several aggregation operations: • • • Equal each Equal any Ranges 11
Equal Any Approach Equal any: • • Handles 16 bytes at one time. Two operands as input. • Set of characters in the pattern. • Text window. Example: • • • Operand 1: aeiou Operand 2: You drive me mad Output: 0110001010010010 12
Equal Any Approach The equal any SIMD command returns a bitvector of 16 bits showing the positions in the test window which hold any character of the pattern. A match candidate is found if the m bits of the vector are ones. 13
SIMD Instructions simd-equal-any(x, y) • _mm_extract_epi 16( _mm_cmpistrm(x, y, SIDD_CMP_EQUAL_ANY), 0). simd-cmpeq(x, y) • mm_movemask_epi 8( _m 128 i_mm_cmpeq_epi 8(_m 128 i x, _m 128 i y)). 14
Least Frequent Character Approach Based on the least frequent character of the text in the pattern. Frequency of the character is based on the text or on the language. We use SIMD instructions to analyze whether a test window of 16 bytes holds the least frequent character of the pattern. 15
Least Frequent Character Approach R is an array containing 16 bytes, each of which holding the least frequent character of the pattern. The SIMD register x holds R and the SIMD register y holds a test window of 16 bytes of the text. The registers x and y are compared by the simd-cmpeq operation. Our previous algorithms used as checking ( or local search) routine. 16
Experimental Results The performance of SIMD instructions depends on the architecture of the processor. The performance of a single instruction is measured by latency and throughput. 17
Latency and throughput of SIMD instructions for Nehalem and Haswell 18
Experimental Results: Execution times of algorithms for English data on Nehalem. 19
Experimental Results: Execution times of algorithms for Protein data on Nehalem. 20
Experimental Results: Execution times of algorithms for English data on Haswell. 21
Execution times of algorithms for English data on Nehalem. 22
Execution times of algorithms for Protein data on Nehalem. 23
Execution times of algorithms for English data on Haswell. 24
Concluding remarks We introduced improved solutions for exact jumbled pattern matching based on the SIMD architecture. If the latency of the used SIMD instructions would improve in future processors, the running times of the algorithms will respectively change. 25
THANK YOU!! 26
- Slides: 26