A similar data query method and system based on GPU and CPU
Through the collaborative calculation of GPU and CPU, efficient similarity search of data sequences is realized, which solves the problem of slow response speed in the existing technology and significantly improves the efficiency of similarity search.
Patent Information
- Application Number
- CN202011232695.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-06
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-11-06
AI Technical Summary
When the existing technology processes a large number of data sequences, the response speed of similarity search is slow and cannot meet the real-time requirements. The traditional serial execution index technology and the existing parallel distributed index have limited acceleration capabilities under the limitation of the number of CPU cores.
Using a collaborative computing method based on GPU and CPU, the CPU performs abstract encoding processing on the data sequence to obtain the abstract data sequence, and uses the GPU to calculate the distance, determine the candidate abstract data sequence, receive and calculate the original data sequence synchronously, and implement parallel query responses.
Make full use of the multi-core processing capabilities of the GPU to reduce the computing pressure on the CPU, greatly speed up the response speed of data sequence similarity search, and improve processing efficiency.
Smart Images

Figure CN112256725B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a similar data query method and system based on a GPU and a CPU. Background Art
[0002] Computer data management technology refers to the classification, encoding, storage, retrieval and maintenance of data, which is the central issue of data processing. It includes similarity query, which is formally defined as: given a query vector s of length n q and vector data set s, in set s, determine the sequence s c In vector with s q Minimum distance.
[0003] A data sequence is a sequence of data points arranged in a certain order. When this order is time, we call it a time series, but this order can also be angle, position, and dimension. A sequence can also be a high-dimensional vector. Many applications in fields such as finance, astrophysics, neuroscience, engineering, and multimedia continue to generate large amounts of data sequences that need to be processed and analyzed. Typically, in the process of processing and analyzing large amounts of data sequences, users ask queries, view the results, and then decide what their subsequent query or analysis step should be. The most common type of query that different analytical applications need to answer for these data series sets is similarity search. Therefore, efficiently processing nearest neighbor (NN) queries for similarity searches is critical to speeding up the above tasks.
[0004] As the speed and quantity of data series production continue to grow, the size of the collection has grown to several PBs, showing that the traditional serial execution data series indexing technology is insufficient. The existing parallel and distributed indexing focuses on using the multi-core performance of the CPU to improve the response time of requests. However, due to the limitation of the number of CPU cores, its acceleration ability is limited. Therefore, the current search for similar data has a slow response speed and cannot meet the real-time requirements. Summary of the invention
[0005] Since the existing methods have the above problems, an embodiment of the present invention provides a similar data query method and system based on GPU and CPU.
[0006] In a first aspect, an embodiment of the present invention provides a similar data query method based on a GPU and a CPU, comprising:
[0007] The CPU performs abstract coding processing on the first original data sequence to be queried for similar data, obtains the first abstract data sequence, queries an index tree according to the first abstract data sequence, obtains a node in the index tree that is closest to the first abstract data sequence, and determines an intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence;
[0008] The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value, and determines, according to the comparison result, a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence;
[0009] The CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence based on the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence of the first original data sequence.
[0010] Further, the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence, including:
[0011] The CPU uses iSAX representation to perform abstract coding processing on the first original data sequence to be queried for similar data, and obtains a first abstract data sequence.
[0012] Furthermore, the CPU determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, including:
[0013] The CPU calculates the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, and uses the calculated minimum distance as the distance value.
[0014] Further, the CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, including:
[0015] The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set according to the first relational model, and the GPU compares each calculated distance with the intermediate value, and uses the abstract data sequence corresponding to the distance less than the intermediate value as a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence;
[0016] Among them, the first relationship model is:
[0017]
[0018] Where T is the first original data sequence, S is the original data sequence in the original data set, MINDIST(T,S) is the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, t is the first abstract data sequence, s is the abstract data sequence in the abstract data sequence set, t i is the i-th point of the first abstract data sequence, s i is the i-th point of the abstract data sequence in the abstract data sequence set, and w is the length of the first abstract data sequence.
[0019] Furthermore, it also includes:
[0020] When the CPU finds through calculation that a preset proportion of the distances between the original data sequences corresponding to each candidate abstract data sequence and the first original data sequence are smaller than the intermediate value, the intermediate value is updated according to the distances between the original data sequences corresponding to each candidate abstract data sequence and the first original data sequence.
[0021] In a second aspect, an embodiment of the present invention further provides a similar data query system based on a GPU and a CPU, comprising: a CPU and a GPU, wherein:
[0022] The CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence; wherein the sequence length of the first abstract data sequence is less than the sequence length of the first original data sequence;
[0023] The CPU queries the index tree according to the first abstract data sequence, obtains the node in the index tree that is closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence; wherein the index tree is a tree index constructed based on the abstract data sequence set obtained after performing abstract coding processing on a preset original data set to obtain an abstract data sequence set, wherein when constructing the tree index based on the abstract data sequence set, similar abstract data sequences are clustered to the same node of the tree index;
[0024] The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU;
[0025] The GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and makes the GPU compare each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, and makes the GPU send the determined candidate abstract data sequence to the CPU each time a candidate abstract data sequence is determined;
[0026] The CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence according to the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence to the first original data sequence;
[0027] The process of the CPU calculating the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the process of the GPU determining the candidate abstract data sequence are performed synchronously.
[0028] Furthermore, when the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain the first abstract data sequence, it is specifically used to:
[0029] The CPU uses iSAX representation to perform abstract coding processing on the first original data sequence to be queried for similar data, and obtains a first abstract data sequence.
[0030] Furthermore, when the CPU determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences included in the node and the first original data sequence, it is specifically configured to:
[0031] The CPU calculates the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, and uses the calculated minimum distance as the distance value.
[0032] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the similar data query method based on GPU and CPU as described in the first aspect is implemented.
[0033] In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the similar data query method based on GPU and CPU as described in the first aspect.
[0034] It can be seen from the above technical scheme that the similar data query method, system, electronic device and storage medium based on GPU and CPU provided by the embodiment of the present invention, the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain the first abstract data sequence, and queries the index tree according to the first abstract data sequence to find the node closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all abstract data sequences in the node and the first original data sequence. Further, the CPU sends the intermediate value, the first abstract data sequence and the abstract data sequence set to the GPU for processing, the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value to determine the candidate abstract data sequence, and sends it to the CPU every time a candidate abstract data sequence is determined, the CPU synchronously receives and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence, thereby obtaining the original data sequence closest to the first original data. It should be noted that the CPU calculates the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the GPU determines the candidate abstract data sequence in synchronization. It can be seen that the embodiment of the present invention fully utilizes the multi-core processing capability of the GPU, thereby reducing the processing pressure of the CPU. The parallel query response scheme provided by the embodiment of the present invention can not only reduce the CPU's calculation amount, but also greatly accelerate the response speed of the data sequence similarity search by utilizing the collaborative calculation of the GPU and the CPU and hybrid fast response data sequence similarity search. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 is a flowchart of a similar data query method based on GPU and CPU provided by one embodiment of the present invention;
[0037] Figure 2 It is a coding diagram of a similar data query method based on GPU and CPU provided by one embodiment of the present invention;
[0038] Figure 3 is a flowchart of another similar data query method based on GPU and CPU provided by an embodiment of the present invention;
[0039] Figure 4 is a schematic diagram of a similar data query system based on a GPU and a CPU provided by an embodiment of the present invention;
[0040] Figure 5 It is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0042] Figure 1 A flowchart of a similar data query method based on GPU and CPU provided by an embodiment of the present invention is shown. Figure 2 is a coding diagram of a similar data query method based on GPU and CPU provided by an embodiment of the present invention, Figure 3 FIG. 1 is a flowchart of another similar data query method based on GPU and CPU provided by an embodiment of the present invention. Figure 1 , Figure 2 and Figure 3 The similar data query method based on GPU and CPU provided by the embodiment of the present invention is explained and illustrated in detail. Figure 1 As shown, a similar data query method based on GPU and CPU provided by an embodiment of the present invention specifically includes the following contents:
[0043] Step 101: The CPU performs abstract coding processing on a first original data sequence to be queried for similar data, obtains a first abstract data sequence, and queries an index tree according to the first abstract data sequence to obtain a node in the index tree that is closest to the first abstract data sequence, and determines an intermediate value according to the distance between each original data sequence corresponding to all abstract data sequences contained in the node and the first original data sequence;
[0044] In this step, the first original data sequence is the data sequence to be searched for similarity, and the first abstract data sequence is obtained after the first original data sequence to be searched for similarity is subjected to abstract coding processing. The specific method of the abstract coding processing is: the first original data sequence is abstracted by using iSAX representation, and represented in a symbolic manner, such as Figure 2 As shown, the (y-axis) space is first divided into different regions, and then a bitwise symbol is assigned to each region. In practice, the number of symbols is very small: iSAX achieves a very good approximation with only 256 symbols, and the maximum alphabet cardinality can be represented by 8 bits. It then represents each segment of the series with the symbol of the region to which the PAA belongs, forming Figure 2 The abstract sequence shown is 102002112 (the subscript indicates the number of bits used to represent the symbol of each segment). Therefore, based on different encodings, different sequences have similar characteristics at different nodes. In simple terms, PAA first divides the first original data sequence into w subsequences of equal length, and then replaces each subsequence with the mean of each subsequence, thereby reducing the amount of data in the first original data sequence and encoding the data for classification, thereby generating a first abstract data sequence whose sequence length is smaller than the sequence length of the first original data sequence.
[0045] In this step, the original data set is firstly subjected to abstract coding processing to obtain a set of abstract data sequences, and then a tree index is constructed based on the obtained abstract data sequences to generate an index tree, which can be regarded as a classified coded abstract data set. The method of abstract coding the original data set is the same as step 101. It should be noted that when constructing a tree index based on the set of abstract data sequences, similar abstract data sequences are clustered into the same node of the tree index, that is, each node in the tree index includes multiple similar abstract data sequences. After the index tree is generated, the CPU queries the index tree based on the first abstract data sequence, finds the node closest to the first abstract data sequence in the index tree, and determines the intermediate value based on the Euclidean distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, wherein the Euclidean distance between each original data sequence and the first original data sequence can be calculated using the following formula:
[0046]
[0047] Where T represents the first original data sequence of length n, S represents the original data sequence of length n, T i represents the i-th point of the first original data sequence of length n, S i Represents the i-th point of the original data sequence of length n. After calculating the Euclidean distance between each original data sequence corresponding to all abstract data sequences contained in the node and the first original data sequence, the minimum distance is regarded as the intermediate value.
[0048] Step 102: the CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result;
[0049] In this step, since the intermediate value obtained in step 101 is close enough to the first original data sequence, there may be a data sequence in the data sequence set that is closer to the first original data sequence, so the intermediate value obtained in the above step is still an approximate value. Therefore, in this step, the CPU sends the calculated intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, and the GPU calculates the lower limit distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and the calculation formula is as follows:
[0050]
[0051] Where T is the first original data sequence, S is the original data sequence in the original data set, MINDIST(T,S) is the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, t is the first abstract data sequence, s is the abstract data sequence in the abstract data sequence set, t i is the i-th point of the first abstract data sequence, s iis the i-th point of the abstract data sequence in the abstract data sequence set, and w is the length of the first abstract data sequence. The lower limit distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set is compared with the intermediate value obtained in step 102. If the lower limit distance of the current abstract data sequence is less than the intermediate value, the abstract data sequence is listed as a candidate abstract data sequence similar to the first abstract data sequence, and each time a candidate abstract data sequence is determined, the candidate abstract data sequence is sent to the CPU. By sending the candidate abstract data sequence to the CPU each time a candidate abstract data sequence is determined, the CPU can respond to the request in time while the GPU is calculating, thereby greatly improving the efficiency of the similarity search. Most of the existing similarity searches use multi-threaded hard disk reading technology to speed up the time of reading data from the hard disk as a whole, or use technologies such as tree indexing to reduce the overall amount of calculation to achieve the purpose of acceleration. However, these solutions are all based on the multi-threading technology of multi-core CPUs. They do not use the acceleration capability of the GPU. Therefore, under the limitation of the number of CPU cores, the acceleration capability is relatively limited. The embodiment of the present invention uses the GPU and the CPU to coordinate calculation to respond to the similarity search. It can better distribute the computational workload and respond to similarity searches faster.
[0052] Step 103: the CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence according to the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence to the first original data sequence;
[0053] In this step, after the GPU sends the determined candidate abstract data sequence to the CPU, the CPU calculates the true distance between the original data sequence in the original data set corresponding to each candidate abstract data sequence and the first original data sequence based on the received candidate abstract data sequences. After the CPU calculates the true distance between the original data sequence in the original data set corresponding to all the candidate abstract data sequences transmitted by the GPU and the first original data sequence, the original data sequence corresponding to the smallest distance is used as a similar data sequence to the first original data sequence.
[0054] In this step, it should be noted that the CPU calculates the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the GPU determines the candidate abstract data sequence in a synchronous manner, that is, the calculations of the CPU and GPU are performed synchronously in the form of streaming. While the GPU calculates the lower limit distance and determines the candidate abstract data sequence, it transmits the candidate abstract data sequence back to the CPU block by block. The CPU calculates the real distance of the candidate abstract data sequence just sent by the GPU, and updates each other to respond to requests more quickly. Finally, after scanning all abstract data sequence sets and all candidate abstract data sequences, the most similar sequence is obtained.
[0055] It can be seen from the above technical scheme that the similar data query method based on GPU and CPU provided by the embodiment of the present invention, the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain the first abstract data sequence, and queries the index tree according to the first abstract data sequence to find the node closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all abstract data sequences in the node and the first original data sequence. Further, the CPU sends the intermediate value, the first abstract data sequence and the abstract data sequence set to the GPU for processing, the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares the calculated distances with the intermediate value to determine the candidate abstract data sequence, and sends it to the CPU every time a candidate abstract data sequence is determined, the CPU synchronously receives and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence, thereby obtaining the original data sequence closest to the first original data. It should be noted that the CPU calculates the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the GPU determines the candidate abstract data sequence in synchronization. It can be seen that the embodiment of the present invention fully utilizes the multi-core processing capability of the GPU, thereby reducing the processing pressure of the CPU. The parallel query response scheme provided by the embodiment of the present invention can not only reduce the CPU's calculation amount, but also greatly accelerate the response speed of the data sequence similarity search by utilizing the collaborative calculation of the GPU and the CPU and hybrid fast response data sequence similarity search.
[0056] Based on the content of the above embodiment, in this embodiment, the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain the first abstract data sequence, including:
[0057] The CPU uses iSAX representation to perform abstract coding processing on the first original data sequence to be queried for similar data, and obtains a first abstract data sequence.
[0058] In this embodiment, it should be noted that the first original data sequence is the data sequence to be searched for similarity, and the first abstract data sequence is obtained after the first original data sequence to be searched for similarity is subjected to abstract coding processing. The specific method of the abstract coding processing is: the first original data sequence is abstracted by using iSAX representation, and represented symbolically, such as Figure 2 As shown, the (y-axis) space is first divided into different regions, and then a bitwise symbol is assigned to each region. In practice, the number of symbols is very small: iSAX achieves a very good approximation with only 256 symbols, and the maximum alphabet cardinality can be represented by 8 bits. It then represents each segment of the series with the symbol of the region to which the PAA belongs, forming Figure 2 The abstract sequence shown is 102002112 (the subscript indicates the number of bits used to represent the symbol of each segment). Therefore, based on different encodings, different sequences have similar characteristics at different nodes. In simple terms, PAA first divides the first original data sequence into w subsequences of equal length, and then replaces each subsequence with the mean of each subsequence, thereby reducing the amount of data in the first original data sequence and encoding the data for classification, thereby generating a first abstract data sequence whose sequence length is smaller than the sequence length of the first original data sequence.
[0059] Based on the content of the above embodiment, in this embodiment, the CPU determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, including:
[0060] The CPU calculates the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, and uses the calculated minimum distance as the distance value.
[0061] In this embodiment, it should be noted that after the index tree is generated, the CPU queries the index tree according to the first abstract data sequence, finds the node closest to the first abstract data sequence in the index tree, and determines the intermediate value according to the Euclidean distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, wherein the Euclidean distance between each original data sequence and the first original data sequence can be calculated using the following formula:
[0062]
[0063] Where T represents the first original data sequence of length n, S represents the original data sequence of length n, T i represents the i-th point of the first original data sequence of length n, Si Represents the i-th point of the original data sequence of length n. After calculating the Euclidean distance between each original data sequence corresponding to all abstract data sequences contained in the node and the first original data sequence, the minimum distance is regarded as the intermediate value.
[0064] Based on the content of the above embodiment, in this embodiment, the CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and the GPU compares each calculated distance with the intermediate value, and determines, according to the comparison result, a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence, including:
[0065] The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set according to the first relational model, and the GPU compares each calculated distance with the intermediate value, and uses the abstract data sequence corresponding to the distance less than the intermediate value as a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence;
[0066] Among them, the first relationship model is:
[0067]
[0068] Where T is the first original data sequence, S is the original data sequence in the original data set, MINDIST(T,S) is the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, t is the first abstract data sequence, s is the abstract data sequence in the abstract data sequence set, t i is the i-th point of the first abstract data sequence, s i is the i-th point of the abstract data sequence in the abstract data sequence set, and w is the length of the first abstract data sequence.
[0069] In this embodiment, it should be noted that the CPU sends the calculated intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, and the GPU calculates the lower limit distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and the calculation formula is as follows:
[0070]
[0071] Where T is the first original data sequence, S is the original data sequence in the original data set, MINDIST(T,S) is the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, t is the first abstract data sequence, s is the abstract data sequence in the abstract data sequence set, t i is the i-th point of the first abstract data sequence, s i is the i-th point of the abstract data sequence in the abstract data sequence set, and w is the length of the first abstract data sequence. The lower limit distances of the first abstract data sequence and each abstract data sequence in the abstract data sequence set are compared with the middle value. If the lower limit distance of the current abstract data sequence is less than the middle value, the abstract data sequence is listed as a candidate abstract data sequence similar to the first abstract data sequence.
[0072] Based on the contents of the above embodiments, in this embodiment, it also includes:
[0073] When the CPU finds through calculation that a preset proportion of the distances between the original data sequences corresponding to each candidate abstract data sequence and the first original data sequence are smaller than the intermediate value, the intermediate value is updated according to the distances between the original data sequences corresponding to each candidate abstract data sequence and the first original data sequence.
[0074] In this embodiment, it should be noted that if the lower limit distance of the current abstract data sequence is less than the intermediate value, it indicates that there is an abstract sequence with a smaller distance from the first abstract data sequence in the abstract data sequence set, and at this time, the abstract data sequence is listed as a candidate abstract data sequence similar to the first abstract data sequence; if the CPU obtains the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence through calculation, and the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence may be less than the intermediate value, or may be equal to or greater than the intermediate value. When it is less than the intermediate value, the intermediate value is updated according to the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence, otherwise the intermediate value remains unchanged. In this embodiment of the present invention, when the CPU obtains through calculation that a preset proportion of the distances between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence are less than the intermediate value, the intermediate value is updated according to the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence, so as to ensure that the minimum distance is always maintained during the updating process, and finally obtain the data sequence most similar to the first original data sequence.
[0075] Based on the same inventive concept, another embodiment of the present invention provides a similar data query system based on GPU and CPU, see Figure 4, a schematic diagram of a similar data query system based on a GPU and a CPU provided by an embodiment of the present invention, the similar data query system based on a GPU and a CPU comprises: a CPU and a GPU, wherein:
[0076] The CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence; wherein the sequence length of the first abstract data sequence is less than the sequence length of the first original data sequence;
[0077] The CPU queries the index tree according to the first abstract data sequence, obtains the node in the index tree that is closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence; wherein the index tree is a tree index constructed based on the abstract data sequence set obtained after performing abstract coding processing on a preset original data set to obtain an abstract data sequence set, wherein when constructing the tree index based on the abstract data sequence set, similar abstract data sequences are clustered to the same node of the tree index;
[0078] The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU;
[0079] The GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and makes the GPU compare each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, and makes the GPU send the determined candidate abstract data sequence to the CPU each time a candidate abstract data sequence is determined;
[0080] The CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence according to the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence to the first original data sequence;
[0081] In this embodiment, the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence; wherein the sequence length of the first abstract data sequence is less than the sequence length of the first original data sequence;
[0082] In this embodiment, the first original data sequence is the data sequence to be searched for similarity, and the first abstract data sequence is obtained after the first original data sequence to be searched for similarity is subjected to abstract coding processing. The specific method of the abstract coding processing is: the first original data sequence is abstracted by using iSAX representation, and represented symbolically, such as Figure 2 As shown, the (y-axis) space is first divided into different regions, and then a bitwise symbol is assigned to each region. In practice, the number of symbols is very small: iSAX achieves a very good approximation with only 256 symbols, and the maximum alphabet cardinality can be represented by 8 bits. It then represents each segment of the series with the symbol of the region to which the PAA belongs, forming Figure 2 The abstract sequence shown is 102002112 (the subscript indicates the number of bits used to represent the symbol of each segment). Therefore, based on different encodings, different sequences have similar characteristics at different nodes. In simple terms, PAA first divides the first original data sequence into w subsequences of equal length, and then replaces each subsequence with the mean of each subsequence, thereby reducing the amount of data in the first original data sequence and encoding the data for classification, thereby generating a first abstract data sequence whose sequence length is smaller than the sequence length of the first original data sequence.
[0083] In this embodiment, the original data set is first subjected to abstract coding processing to obtain a set of abstract data sequences, and then a tree index is constructed based on the acquired abstract data sequences to generate an index tree, which can be regarded as a classified coded abstract data set. The manner in which the original data set is subjected to abstract coding processing is the same as in the previous embodiment. It should be noted that when constructing a tree index based on a set of abstract data sequences, similar abstract data sequences are clustered into the same node of the tree index, that is, each node in the tree index includes multiple similar abstract data sequences. After the index tree is generated, the CPU queries the index tree based on the first abstract data sequence, finds the node in the index tree that is closest to the first abstract data sequence, and determines the intermediate value based on the Euclidean distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, wherein the Euclidean distance between each original data sequence and the first original data sequence can be calculated using the following formula:
[0084]
[0085] Where T represents the first original data sequence of length n, S represents the original data sequence of length n, T i represents the i-th point of the first original data sequence of length n, S iRepresents the i-th point of the original data sequence of length n. After calculating the Euclidean distance between each original data sequence corresponding to all abstract data sequences contained in the node and the first original data sequence, the minimum distance is regarded as the intermediate value.
[0086] In this embodiment, since the intermediate value obtained in the above embodiment is close enough to the first original data sequence, there may be a data sequence in the data sequence set that is closer to the first original data sequence, and therefore, the intermediate value obtained in the above embodiment is still an approximate value. Therefore, in this embodiment, the CPU sends the calculated intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, and the GPU calculates the lower limit distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and the calculation formula is as follows:
[0087]
[0088] Where T is the first original data sequence, S is the original data sequence in the original data set, MINDIST(T,S) is the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, t is the first abstract data sequence, s is the abstract data sequence in the abstract data sequence set, t i is the i-th point of the first abstract data sequence, s i is the i-th point of the abstract data sequence in the abstract data sequence set, and w is the length of the first abstract data sequence. The lower limit distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set is compared with the intermediate value obtained in the above embodiment. If the lower limit distance of the current abstract data sequence is less than the intermediate value, the abstract data sequence is listed as a candidate abstract data sequence similar to the first abstract data sequence, and each time a candidate abstract data sequence is determined, the candidate abstract data sequence is sent to the CPU. By sending the candidate abstract data sequence to the CPU each time a candidate abstract data sequence is determined, the CPU can respond to the request in time while the GPU is calculating, thereby greatly improving the efficiency of the similarity search.
[0089] In this embodiment, after the GPU sends the determined candidate abstract data sequence to the CPU, the CPU calculates the true distance between the original data sequence in the original data set corresponding to each candidate abstract data sequence and the first original data sequence based on the received candidate abstract data sequences. After the CPU calculates the true distance between the original data sequence in the original data set corresponding to all the candidate abstract data sequences transmitted by the GPU and the first original data sequence, the original data sequence corresponding to the smallest distance is used as a similar data sequence to the first original data sequence.
[0090] In this embodiment, it should be noted that the CPU calculates the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the GPU determines the candidate abstract data sequence in a synchronous manner, that is, the calculations of the CPU and the GPU are performed synchronously in the form of streaming. While the GPU calculates the lower limit distance and determines the candidate abstract data sequence, it transmits the candidate abstract data sequence back to the CPU block by block. The CPU calculates the real distance of the candidate abstract data sequence just sent by the GPU, and updates each other to respond to requests more quickly. Finally, after scanning all abstract data sequence sets and all candidate abstract data sequences, the most similar sequence is obtained.
[0091] In this embodiment, it should be noted that due to the continuous growth in the speed and quantity of data series production, the size of the collection has grown to several PBs, showing that the traditional serial execution data series indexing technology is insufficient, and the existing parallel and distributed indexing focuses on using the multi-core performance of the CPU to improve the response time of the request, that is, using technologies such as tree indexing and multi-threading technology based on multi-core CPI to reduce the overall amount of calculation to achieve the purpose of acceleration, but under the limitation of the number of CPU cores, its acceleration ability is limited. The processing solution based on GPU still stays on the brute force search algorithm, and there is no response for accelerating the index. In addition, for PB-level data volume, the brute force search algorithm needs to transfer all data to the memory of the GPU, but the bandwidth of the PCIE bus cannot transmit such a large amount of data in a short time. Therefore, the current solutions for similarity search do not utilize the acceleration capability of the GPU, and the response speed of the entire similarity search needs to be improved.
[0092] It can be seen from the above technical scheme that the similarity data query system based on GPU and CPU provided by the embodiment of the present invention obtains the first abstract data sequence by performing abstract coding processing on the first original data sequence to be queried for similarity through the CPU, and queries the index tree according to the first abstract data sequence to find the node closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all abstract data sequences in the node and the first original data sequence. Further, the CPU sends the intermediate value, the first abstract data sequence and the abstract data sequence set to the GPU for processing, the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value to determine the candidate abstract data sequence, and sends it to the CPU every time a candidate abstract data sequence is determined, the CPU synchronously receives and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence, thereby obtaining the original data sequence closest to the first original data. It should be noted that the CPU calculates the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the GPU determines the candidate abstract data sequence in synchronization. It can be seen that the embodiment of the present invention fully utilizes the multi-core processing capability of the GPU, thereby reducing the processing pressure of the CPU. The parallel query response scheme provided by the embodiment of the present invention can not only reduce the CPU's calculation amount, but also greatly accelerate the response speed of the data sequence similarity search by utilizing the collaborative calculation of the GPU and the CPU and hybrid fast response data sequence similarity search.
[0093] Based on the content of the above embodiment, in this embodiment, when the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain the first abstract data sequence, it is specifically used to:
[0094] The CPU uses iSAX representation to perform abstract coding processing on the first original data sequence to be queried for similar data, and obtains a first abstract data sequence.
[0095] In this embodiment, it should be noted that the first original data sequence is the data sequence to be searched for similarity, and the first abstract data sequence is obtained after the first original data sequence to be searched for similarity is subjected to abstract coding processing. The specific method of the abstract coding processing is: the first original data sequence is abstracted by using iSAX representation, and represented symbolically, such as Figure 2As shown, the (y-axis) space is first divided into different regions, and then a bitwise symbol is assigned to each region. In practice, the number of symbols is very small: iSAX achieves a very good approximation with only 256 symbols, and the maximum alphabet cardinality can be represented by 8 bits. It then represents each segment of the series with the symbol of the region to which the PAA belongs, forming Figure 2 The abstract sequence shown is 102002112 (the subscript indicates the number of bits used to represent the symbol of each segment). Therefore, based on different encodings, different sequences have similar characteristics at different nodes. In simple terms, PAA first divides the first original data sequence into w subsequences of equal length, and then replaces each subsequence with the mean of each subsequence, thereby reducing the amount of data in the first original data sequence and encoding the data for classification, thereby generating a first abstract data sequence whose sequence length is smaller than the sequence length of the first original data sequence.
[0096] Based on the content of the above embodiment, in this embodiment, when the CPU determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences included in the node and the first original data sequence, it is specifically used to:
[0097] The CPU calculates the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, and uses the calculated minimum distance as the distance value.
[0098] In this embodiment, it should be noted that after the index tree is generated, the CPU queries the index tree according to the first abstract data sequence, finds the node closest to the first abstract data sequence in the index tree, and determines the intermediate value according to the Euclidean distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, wherein the Euclidean distance between each original data sequence and the first original data sequence can be calculated using the following formula:
[0099]
[0100] Where T represents the first original data sequence of length n, S represents the original data sequence of length n, T i represents the i-th point of the first original data sequence of length n, S i Represents the i-th point of the original data sequence of length n. After calculating the Euclidean distance between each original data sequence corresponding to all abstract data sequences contained in the node and the first original data sequence, the minimum distance is regarded as the intermediate value.
[0101] The similar data query system based on GPU and CPU described in this embodiment can be used to execute the above method embodiments. Its principles and technical effects are similar and will not be repeated here.
[0102] Based on the same inventive concept, another embodiment of the present invention provides an electronic device, see Figure 5 The structural diagram of the electronic device specifically includes the following contents: a processor 501, a memory 502, a communication interface 503 and a communication bus 504;
[0103] The processor 501, the memory 502, and the communication interface 503 communicate with each other through the communication bus 504; the communication interface 503 is used to realize information transmission between various devices;
[0104] The processor 401 is used to call the computer program in the memory 402. When the processor executes the computer program, all steps of the above-mentioned similar data query method based on GPU and CPU are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0105] The CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence; wherein the sequence length of the first abstract data sequence is less than the sequence length of the first original data sequence;
[0106] The CPU queries the index tree according to the first abstract data sequence, obtains the node in the index tree that is closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence; wherein the index tree is a tree index constructed based on the abstract data sequence set obtained after performing abstract coding processing on a preset original data set to obtain an abstract data sequence set, wherein when constructing the tree index based on the abstract data sequence set, similar abstract data sequences are clustered to the same node of the tree index;
[0107] The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, and sends the determined candidate abstract data sequence to the CPU whenever the GPU determines a candidate abstract data sequence;
[0108] The CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence according to the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence to the first original data sequence;
[0109] The process of the CPU calculating the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the process of the GPU determining the candidate abstract data sequence are performed synchronously.
[0110] Based on the same inventive concept, another embodiment of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, all steps of the above-mentioned similar data query method based on GPU and CPU are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0111] The CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence; wherein the sequence length of the first abstract data sequence is less than the sequence length of the first original data sequence;
[0112] The CPU queries the index tree according to the first abstract data sequence, obtains the node in the index tree that is closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence; wherein the index tree is a tree index constructed based on the abstract data sequence set obtained after performing abstract coding processing on a preset original data set to obtain an abstract data sequence set, wherein when constructing the tree index based on the abstract data sequence set, similar abstract data sequences are clustered to the same node of the tree index;
[0113] The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, and sends the determined candidate abstract data sequence to the CPU whenever the GPU determines a candidate abstract data sequence;
[0114] The CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence according to the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence to the first original data sequence;
[0115] The process of the CPU calculating the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the process of the GPU determining the candidate abstract data sequence are performed synchronously.
[0116] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the similar data query method based on GPU and CPU described in each embodiment or some parts of the embodiment.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A similar data query method based on GPU and CPU, It is characterized in that include: The CPU performs abstract coding processing on a first original data sequence to be queried for similar data, obtains the first abstract data sequence, queries an index tree according to the first abstract data sequence, obtains a node in the index tree that is closest to the first abstract data sequence, determines an intermediate value according to the distance between each original data sequence corresponding to all abstract data sequences contained in the node and the first original data sequence, and performs abstract coding processing on a preset original data set to obtain an abstract data sequence set; The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and compares each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, wherein the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set according to a first relational model, and the first relational model is: Where T is the first original data sequence, S is the original data sequence in the original data set, MINDIST(T,S) is the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, t is the first abstract data sequence, s is the abstract data sequence in the abstract data sequence set, t i is the i-th point of the first abstract data sequence, s i is the i-th point of the abstract data sequence in the abstract data sequence set, and w is the length of the first abstract data sequence; The CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence based on the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence of the first original data sequence.
2. According to the similar data query method based on GPU and CPU according to claim 1, It is characterized in that The CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence, including: The CPU uses iSAX representation to perform abstract coding processing on the first original data sequence to be queried for similar data, and obtains a first abstract data sequence.
3. The similar data query method based on GPU and CPU according to claim 1, It is characterized in that The CPU determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, including: The CPU calculates the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, and uses the calculated minimum distance as the intermediate value.
4. The similar data query method based on GPU and CPU according to claim 1, It is characterized in that The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU, so that the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and the GPU compares each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, including: The CPU sends the intermediate value, the first abstract data sequence and the abstract data sequence set to the GPU, and enables the GPU to compare the calculated distances with the intermediate value, and take the abstract data sequences corresponding to the distances less than the intermediate value as candidate abstract data sequences in the abstract data sequence set that are similar to the first abstract data sequence.
5. The similar data query method based on GPU and CPU according to claim 1, It is characterized in that Also includes: When the CPU finds through calculation that a preset proportion of the distances between the original data sequences corresponding to each candidate abstract data sequence and the first original data sequence are smaller than the intermediate value, the intermediate value is updated according to the distances between the original data sequences corresponding to each candidate abstract data sequence and the first original data sequence.
6. A similar data query system based on GPU and CPU, It is characterized in that include: CPU and GPU, where: The CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain a first abstract data sequence; wherein the sequence length of the first abstract data sequence is less than the sequence length of the first original data sequence; The CPU queries the index tree according to the first abstract data sequence, obtains the node in the index tree that is closest to the first abstract data sequence, and determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence; wherein the index tree is a tree index constructed based on the abstract data sequence set obtained after performing abstract coding processing on a preset original data set to obtain an abstract data sequence set, wherein when constructing the tree index based on the abstract data sequence set, similar abstract data sequences are clustered to the same node of the tree index; The CPU sends the intermediate value, the first abstract data sequence, and the abstract data sequence set to the GPU; The GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, and makes the GPU compare each calculated distance with the intermediate value, and determines a candidate abstract data sequence in the abstract data sequence set that is similar to the first abstract data sequence according to the comparison result, and makes the GPU send the determined candidate abstract data sequence to the CPU each time a candidate abstract data sequence is determined, wherein the GPU calculates the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set according to a first relational model, and the first relational model is: Where T is the first original data sequence, S is the original data sequence in the original data set, MINDIST(T,S) is the distance between the first abstract data sequence and each abstract data sequence in the abstract data sequence set, t is the first abstract data sequence, s is the abstract data sequence in the abstract data sequence set, t i is the i-th point of the first abstract data sequence, s i is the i-th point of the abstract data sequence in the abstract data sequence set, and w is the length of the first abstract data sequence; The CPU synchronously receives each candidate abstract data sequence sent by the GPU, and calculates the distance between the original data sequence corresponding to each candidate abstract data sequence and the first original data sequence according to the received candidate abstract data sequences, and uses the original data sequence corresponding to the minimum distance as a similar data sequence to the first original data sequence; The process of the CPU calculating the distance between the original data sequence corresponding to the candidate abstract data sequence and the first original data sequence and the process of the GPU determining the candidate abstract data sequence are performed synchronously.
7. The similar data query system based on GPU and CPU according to claim 6, It is characterized in that When the CPU performs abstract coding processing on the first original data sequence to be queried for similar data to obtain the first abstract data sequence, it is specifically used to: The CPU uses iSAX representation to perform abstract coding processing on the first original data sequence to be queried for similar data, and obtains a first abstract data sequence.
8. The similar data query system based on GPU and CPU according to claim 6, It is characterized in that When the CPU determines the intermediate value according to the distance between each original data sequence corresponding to all the abstract data sequences included in the node and the first original data sequence, it is specifically configured to: The CPU calculates the distance between each original data sequence corresponding to all the abstract data sequences contained in the node and the first original data sequence, and uses the calculated minimum distance as the intermediate value.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the steps of the GPU-based data processing method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the GPU-based data processing method as claimed in any one of claims 1 to 5 are implemented.
