Data processing method and device and storage medium

By sending a single processing request containing multiple data to the GPU and using the proxy module to merge the processing requests, the problem of GPU inefficiency in processing multiple requests is solved and more efficient data processing is achieved.

CN118550677APending Publication Date: 2024-08-27HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310132874.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-17
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

In a server that recognizes vehicle images, the GPU takes too long to process data due to receiving multiple processing requests, resulting in low processing efficiency.

Method used

By sending a single processing request containing multiple data to the GPU, the number of reads to the global memory is reduced, the proxy module is used to intercept CPU requests, and the processing requests are merged to improve the processing efficiency of the GPU.

Benefits of technology

It effectively reduces the number of reads of the global memory by the GPU, improves the efficiency of data processing, avoids GPU congestion, and ensures efficient processing of multiple processing requests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550677A
    Figure CN118550677A
Patent Text Reader

Abstract

The invention discloses a data processing method and device and a storage medium, and belongs to the field of communication. The method is applied to the computing device, the computing device comprises a CPU and a GPU, the GPU comprises a global memory, the global memory stores at least one piece of first data, and the method comprises the steps that a plurality of first processing requests are obtained, the plurality of first processing requests are requests needing to be sent to the GPU by the CPU, and the first processing requests are sent to the GPU; each first processing request comprises second data to be processed; a second processing request is sent to the GPU, the second processing request comprises multiple pieces of second data, the multiple pieces of second data are the second data included in each first processing request, and the second processing request is used for requesting the GPU to read the at least one piece of first data stored in the global memory, and processing the plurality of second data based on the at least one first data. The data processing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a method, device and storage medium for processing data. Background Art

[0002] Typically, a device includes hardware components such as a central processing unit (CPU) and a graphics processing unit (GPU). The CPU of the device may send a request for processing data to the GPU of the device to request the GPU to process the data.

[0003] In the related art, it is assumed that the device is a server for identifying vehicle images, and the GPU of the server includes a global memory, and the global memory stores an intelligent model. The CPU of the server can receive an identification request from a user, and the identification request includes a picture to be identified, and send the identification request to the GPU of the server. The GPU of the server reads the intelligent model from the global memory and identifies the vehicle image in the picture through the intelligent model.

[0004] In the related art, the CPU of the device may concurrently receive multiple processing requests and send multiple processing requests to the GPU. The GPU takes a long time to process data based on the multiple processing requests, resulting in low efficiency in processing data. Summary of the invention

[0005] The present application provides a method, device and storage medium for processing data to improve the efficiency of processing data. The technical solution is as follows:

[0006] In a first aspect, the present application provides a method for processing data, the method being applied to a computing device, the computing device comprising a central processing unit (CPU) and a graphics processing unit (GPU), the GPU comprising a global memory, and the global memory storing at least one first data. In the method, a plurality of first processing requests are obtained, the plurality of first processing requests are requests that the CPU needs to send to the GPU, and each first processing request includes second data to be processed. A second processing request is sent to the GPU, the second processing request includes a plurality of second data, the plurality of second data is the second data included in each first processing request, and the second processing request is used to request the GPU to read at least one first data stored in the global memory, and process the plurality of second data based on the at least one first data.

[0007] Since the second processing request includes multiple second data, and the multiple second data are the second data included in each of the multiple first processing requests, the second processing request is sent to the GPU. After receiving the second processing request, the GPU reads at least one first data stored in the global memory, and processes the multiple second data based on the at least one first data, so that the GPU can process the multiple second data by reading the global memory once, and can process the data in the multiple first processing requests by reading the data in the global memory once based on the second processing request, thereby reducing the number of times the global memory is read to improve the efficiency of processing data.

[0008] In a possible implementation, the multiple first processing requests are dequeued from a task queue, where the task queue is used to store the first processing requests that the CPU needs to send to the GPU, so as to obtain the multiple first processing requests.

[0009] In another possible implementation, when the number of first processing requests included in the task queue exceeds M, M first processing requests are dequeued from the task queue, where M is an integer greater than 1 and M is the maximum number of second data that the GPU can process simultaneously. When the number of first processing requests included in the task queue does not exceed M, each first processing request included in the task queue is dequeued. This avoids sending too much second data to the GPU, thereby avoiding congestion of the GPU.

[0010] In another possible implementation, the first processing request sent by the CPU to the GPU is intercepted and the intercepted first processing request is saved in a task queue, thereby preventing the GPU from receiving the first processing request from the CPU, so that the GPU does not read the global memory once each time it receives a second data, thereby reducing the number of times the global memory is read.

[0011] In another possible implementation, multiple processing results sent by the GPU are received, where the multiple processing results include a processing result obtained by the GPU processing each second data among the multiple second data; and the multiple processing results are sent to the CPU.

[0012] In another possible implementation, the multiple first processing requests are processing requests sent by multiple threads in the CPU, and the multiple threads include the first thread. A first processing result is obtained from the multiple processing results, and the first processing result is a processing result obtained by the GPU processing the second data included in the first processing request sent by the first thread. The first processing result is sent to the first thread, so that the first thread can obtain the processing result corresponding to the second data sent by it, and avoid processing errors.

[0013] In another possible implementation, the multiple first processing requests are all retrieval requests for requesting to retrieve data, and the second processing request is used to request the GPU to read at least one first data stored in the global memory, and retrieve data from the at least one first data based on each second data in the multiple second data. In this way, multiple second data can be retrieved by reading the global memory once, thereby improving the efficiency of data retrieval.

[0014] In another possible implementation, the multiple first processing requests are all inference requests for requesting inference data, at least one first data stored in the global memory is an intelligent model, and the second processing request is used to request the GPU to read the intelligent model stored in the global memory, and to infer each of the multiple second data through the intelligent model. In this way, multiple second data can be inferred by reading the global memory once, thereby improving the efficiency of inferring data.

[0015] In a second aspect, the present application provides a device for processing data, which is used to execute the method in the first aspect or any possible implementation of the first aspect. Specifically, the device includes a unit for executing the method in the first aspect or any possible implementation of the first aspect.

[0016] In a third aspect, the present application provides a cluster for processing data, the cluster comprising at least one computing device, each of the at least one computing device comprising at least one processor and at least one memory, the at least one memory storing computer-readable instructions; the at least one processor executes the computer-readable instructions so that the cluster implements the method in the first aspect or any possible implementation manner of the first aspect.

[0017] In a fourth aspect, the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium, and the computer program is loaded by a processor to implement the method of the above-mentioned first aspect or any possible implementation method of the first aspect.

[0018] In a fifth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program is loaded by a processor to execute the method of the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0019] In a sixth aspect, the present application provides a chip comprising a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and run the computer instructions from the memory to execute the method of the above-mentioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0021] Figure 2 It is a structural diagram of a network architecture provided by an embodiment of the present application;

[0022] Figure 3 It is a structural diagram of another network architecture provided by an embodiment of the present application;

[0023] Figure 4 is a flow chart of a method for processing data provided by an embodiment of the present application;

[0024] Figure 5 It is a schematic diagram of receiving a processing request and sending a processing request provided by an embodiment of the present application;

[0025] Figure 6 is a flow chart of a method for retrieving data provided by an embodiment of the present application;

[0026] Figure 7 is a schematic diagram of multiple processing components selecting first data provided by an embodiment of the present application;

[0027] Figure 8 is a flow chart of a method for establishing a second corresponding relationship provided by an embodiment of the present application;

[0028] Fig. 9 is a schematic diagram of calculating distances of multiple resource blocks provided in an embodiment of the present application;

[0029] Fig.10 It is a flow chart of a method for reasoning data provided by an embodiment of the present application;

[0030] Fig.11 is a schematic diagram of the structure of a device for processing data provided in an embodiment of the present application;

[0031] Fig.12 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0032] Fig.13 It is a schematic diagram of the structure of a cluster for processing data provided in an embodiment of the present application;

[0033] Fig.14 It is a schematic diagram of the structure of another cluster for processing data provided in an embodiment of the present application. DETAILED DESCRIPTION

[0034] The implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0035] See also Figure 1An embodiment of the present application provides a computing device 100, which is a device with a C / S heterogeneous architecture. The computing device 100 includes a CPU 101, an agent module 102 and a GPU 103, and the agent module 102 communicates with the CPU 101 and the GPU 103 respectively.

[0036] The CPU 101 includes a first task queue 1011 , the proxy module 102 includes a second task queue 1021 , and the GPU 103 includes a global memory 1021 . The global memory 1021 stores at least one first data.

[0037] In the computing device 100 , the CPU 101 acts as a client and the GPU 102 acts as a server. The CPU 101 is used to receive a first processing request from a user, the first processing request including second data to be processed, and save the first processing request in a first task queue 1011 .

[0038] Each time the CPU 101 receives a first processing request, it saves the received first processing request to the first task queue 1011. The first task queue 1011 may store one or more first processing requests. Optionally, multiple users may send multiple first processing requests to the computing device 100 at the same time, resulting in the CPU receiving multiple first processing requests.

[0039] The CPU 101 is also used to dequeue a first processing request from the first task queue 1011 and send the dequeued first processing request. Since the first task queue 1011 stores one or more first processing requests, the CPU 101 can send one or more first processing requests.

[0040] The proxy module 102 is used to intercept each first processing request sent by the CPU 101, save each received first processing request to the second task queue 1021, dequeue multiple first processing requests from the second task queue 1021, and send a second processing request to the GPU 102, where the second processing request includes multiple second data, and the multiple second data are the second data included in each first processing request in the multiple first processing requests.

[0041] GPU 103 is used to receive the second processing request, read at least one first data from the global memory 1031, and process multiple second data in the second processing request based on the at least one first data.

[0042] If there is no proxy module 102, the CPU 101 sends multiple first processing requests to the GPU 103. Each time the GPU 103 receives a first processing request, it reads the global memory once under the trigger of the received first processing request. Therefore, the GPU 103 needs to read the global memory multiple times when receiving multiple first processing requests. However, the amount of data in the global memory is large, and it takes a long time to read the global memory each time, resulting in low efficiency in processing data.

[0043] See also Figure 1 , GPU103 also includes W streaming multiprocessors (SM) 1032, W is an integer greater than 1, and GPU103 can process multiple second data in the second processing request through some or all of the W SM1032.

[0044] In some embodiments, the computing device 100 can be applied to different fields. For example, the computing device 100 can be applied to the field of data retrieval, the computing device 100 is a retrieval device, and the first processing request and the second processing request are both retrieval requests for requesting the retrieval device to retrieve data. For another example, the computing device 100 can be applied to the field of data reasoning, the first processing request and the second processing request are both reasoning requests for requesting the computing device 100 to perform data reasoning.

[0045] When the computing device 100 is applied to the field of data retrieval, the computing device 100 is a retrieval device.

[0046] See also Figure 2 Next, a network architecture 200 for retrieving data is listed, the network architecture 200 includes multiple first devices 201 and multiple retrieval clusters 202. For any first device 201, the first device 201 communicates with each retrieval cluster 202. For any retrieval cluster 102, the retrieval cluster 102 includes at least one retrieval device 100, each of which can be Figure 1 Computing device 100 is shown.

[0047] Each search cluster 202 stores multiple first data, and there is no intersection between the first data stored in each search cluster 202. For any search cluster 202, the multiple first data stored in the search cluster 202 means that the multiple first data are stored in the global memory 1031 of the GPU 103 of each search device 100 in the search cluster 202, and the multiple first data stored in the global memory 1031 of the GPU 103 of each search device 100 are the same.

[0048] For any first device 201 among the multiple first devices 201 , the first device 201 receives a retrieval command from a user, the retrieval command includes second data to be retrieved, and sends a first retrieval request to each retrieval cluster 102 , the first retrieval request includes the second data.

[0049] For a retrieval device 100 in any retrieval cluster 102, the retrieval device 100 may receive a first retrieval request, obtain the distance between the second data included in the first retrieval request and each of the multiple first data, select K first data with the best distance to the second data, K is an integer greater than or equal to 1, and send a first retrieval response to the first device 101, the first retrieval response including the K first data, and the distance between the second data and each of the K first data.

[0050] The first device 201 receives a first search response sent by the search device 100 in each search cluster 202, and the first search response sent by the search device 100 in each search cluster 202 includes K first data and the distance between the second data and each of the K first data. The first device 201 receives a total of Q*K first data and the distance between the second data and each of the Q*K first data, where Q is the number of search clusters 202 included in the network architecture 200, and * is a multiplication operation.

[0051] The first device 201 selects L first data with the best distance to the second data from the Q*K first data, and sends the L first data to the user, where L is an integer greater than or equal to 1 and less than or equal to K.

[0052] In some embodiments, for the above retrieval device 100, the operation of the retrieval device 100 to retrieve K first data is:

[0053] The CPU 101 of the retrieval device 100 receives the first retrieval request and saves the first retrieval request to the first task queue 1011 of the CPU 101. Optionally, the CPU 101 may receive first retrieval requests sent by different first devices 201 at the same time, and saves the received first retrieval request to the first task queue 1011 each time the first retrieval request is received. The first task queue 1011 may store one or more first retrieval requests.

[0054] The CPU 101 is further configured to dequeue a first search request from the first task queue 1011 and send the dequeued first search request. Since the first task queue 1011 stores one or more first search requests, the CPU 101 can send one or more first search requests.

[0055] The proxy module 102 is used to intercept each first search request sent by the CPU 101, save each received first search request to the second task queue 1021, dequeue multiple first search requests from the second task queue 1021, and send a second search request to the GPU 102, where the second search request includes multiple second data, and the multiple second data are the second data included in each first search request in the multiple first search requests.

[0056] GPU103 is used to receive the second search request, read multiple first data from the global memory 1031, obtain the distance between any second data included in the second search request and each of the multiple first data, select K first data with the best distance to the second data, K is an integer greater than or equal to 1, and obtain the search result corresponding to the second data, and the search result includes the K first data. For each other second data included in the second search request, GPU103 retrieves the search result corresponding to each other second data in the above manner, so as to obtain the search result corresponding to each second data in the second search request, that is, to obtain the K first data corresponding to each second data. Send a second search response to the proxy module 102, and the second search response includes the search result corresponding to each second data.

[0057] The proxy module 102 is further configured to receive a second search response, and send a first search response to the CPU 101 for any search result corresponding to the second data in the second search response, wherein the first search response includes the search result corresponding to the second data.

[0058] The CPU 101 is further configured to receive a first search response, and send the first search response to the first device 201 .

[0059] The better the distance between the first data and the second data, the higher the similarity between the first data and the second data. Optionally, the smaller the distance between the first data and the second data, the better the distance between the first data and the second data; or, the larger the distance between the first data and the second data, the better the distance between the first data and the second data.

[0060] In some embodiments, the first retrieval request includes the second data, which means that the first retrieval request includes n first feature vectors of the second data, where n is an integer greater than or equal to 1, each first feature vector includes D features of the second data, where D is an integer greater than 1, and each first feature vector is different.

[0061] In some embodiments, the shared memory 1031 of the GPU 103 stores a plurality of first data, which means that the shared memory 1031 of the GPU 103 stores a first correspondence relationship, and the first correspondence relationship is used to store the correspondence relationship between the first data and the second feature vector of the first data.

[0062] For any record in the first corresponding relationship, the record includes a first data and a second feature vector of the first data, and the second feature vector of the first data includes the feature of the first data.

[0063] In some embodiments, the operation of GPU103 obtaining the distance between the second data and each first data among multiple first data can be: the GPU103 obtains the distance between the second data and each first data based on the n first feature vectors of the second data and the second feature vector of each first data.

[0064] Optionally, for any first data, GPU 103 may calculate the distance between the second eigenvector of the first data and n first eigenvectors of the second data, and use the distance as the distance between the first data and the second data.

[0065] For any retrieval device 100 in any retrieval cluster 202, the retrieval device 100 includes multiple retrieval algorithms. For any retrieval algorithm, the retrieval algorithm is used to retrieve K first data from multiple first data using at least one first feature vector.

[0066] In some embodiments, for any two retrieval algorithms, the two retrieval algorithms may use different numbers of first feature vectors when the performance of retrieving data meets the first condition. For example, some retrieval algorithms may meet the first condition when the performance of retrieving first data from multiple first data using x first feature vectors, where x is an integer greater than or equal to 1. Some retrieval algorithms may meet the first condition when the performance of retrieving first data from multiple first data using y first feature vectors, where y is an integer greater than or equal to 1, and x is not equal to y.

[0067] In some embodiments, the first condition may be optimal performance, that is, the number of first feature vectors used by any two retrieval algorithms when the performance of retrieving data is optimal may be different. Alternatively, the first condition may be that the performance of retrieving data exceeds a performance threshold, that is, the number of first feature vectors used by any two retrieval algorithms when the performance of retrieving data exceeds a performance threshold may be different. Optionally, the performance of the retrieval algorithm in retrieving data may include the time required by the retrieval algorithm to retrieve data.

[0068] Therefore, in order to improve the efficiency of retrieving data, for the retrieval device 100 that receives the first retrieval request in the retrieval cluster 202, since the first retrieval request includes n first feature vectors of the second data, the retrieval device 100 obtains a first retrieval algorithm based on n, the multiple retrieval algorithms include a first retrieval algorithm, and the first retrieval algorithm is a retrieval algorithm whose performance meets the first condition when using n first feature vectors to retrieve data. The GPU 103 of the retrieval device 100 retrieves K first data from multiple first data through the first retrieval algorithm based on the n first feature vectors, which can improve the efficiency of retrieving the K first data.

[0069] In some embodiments, the retrieval device 100 in the retrieval cluster 202 may include a second correspondence relationship, and the second correspondence relationship is used to store the correspondence between the number of first feature vectors and the retrieval algorithm. Any record in the second correspondence relationship includes a number and a retrieval algorithm, and the record is used to indicate that the performance of the retrieval algorithm when using the number of first feature vectors to retrieve data meets the first condition. In this way, when the retrieval device 1021 receives a second retrieval request, the second retrieval request includes n first feature vectors of the first data, and based on n, the corresponding retrieval algorithm is obtained from the second correspondence relationship as the first retrieval algorithm.

[0070] For any retrieval algorithm, the retrieval algorithm retrieves first data from a plurality of first data based on operating parameters, and the performance of the retrieval algorithm in retrieving data using different operating parameters is different.

[0071] In some embodiments, the second correspondence is used to store the correspondence between the number of first feature vectors, the operating parameters, and the retrieval algorithm. Any record in the second correspondence includes a number, an operating parameter, and a retrieval algorithm, and the record is used to indicate that the performance of the retrieval algorithm when using the number of first feature vectors and the one operating parameter to retrieve data meets the first condition.

[0072] In this way, when receiving the second search request, the search device 1022 obtains the corresponding search algorithm as the first search algorithm and the corresponding operating parameter as the first operating parameter from the second corresponding relationship based on n. The first search algorithm is a search algorithm whose performance meets the first condition when using n first feature vectors to search for data. The first operating parameter is an operating parameter used by the first search algorithm when the performance of searching for data meets the first condition. The GPU 103 of the search device 100 retrieves K first data from multiple first data through the first search algorithm based on the n first feature vectors and the first operating parameter, which can improve the efficiency of retrieving the K first data.

[0073] In some embodiments, see Figure 3The network architecture 200 also includes a balancing device 203, which can communicate with each first device 201 of the multiple first devices 201.

[0074] The balancing device 201 is used to receive a search command from a user, select a first device 201 from the multiple first devices 201 based on a load balancing strategy, and send a first search request to the selected first device 201 .

[0075] See also Figure 4 The present application embodiment provides a method 400 for processing data, wherein the method 400 is applied to Figure 1 The computing device 100 is shown. The method 400 includes the following process from step 401 to step 408.

[0076] Step 401: A CPU of a computing device receives a first processing request, where the first processing request includes second data to be processed.

[0077] See also Figure 5 There may be multiple clients sending first processing requests to the computing device, and the CPU of the computing device may receive the first processing requests sent by multiple clients, that is, the CPU of the computing device can receive multiple first processing requests and save the multiple first processing requests to the first task queue of the CPU of the computing device.

[0078] Step 402: The CPU of the computing device sends a first processing request.

[0079] See also Figure 5 In step 402, the CPU of the computing device may start multiple threads. For any one of the multiple threads, the thread dequeues a first processing request from the first task queue and sends the dequeued first processing request. Each thread dequeues a first processing request from the first task queue and sends the dequeued first processing request, so that multiple first processing requests may be sent.

[0080] Step 403: The proxy module of the computing device intercepts the first processing request and caches the first processing request.

[0081] Since each thread started in the CPU of the computing device sends a first processing request, the proxy module of the computing device can intercept the first processing request sent by each thread, thereby intercepting multiple first processing requests and caching the multiple first processing requests in the second task queue.

[0082] Step 404: The proxy module of the computing device obtains multiple first processing requests from the cached first processing requests.

[0083] In step 404 , the proxy module of the computing device dequeues a plurality of first processing requests from the second task queue.

[0084] Optionally, during implementation, when the number of first processing requests included in the second task queue exceeds M, M first processing requests are dequeued from the second task queue, where M is an integer greater than 1 and M is the maximum number of second data that can be processed simultaneously by the GPU of the computing device. When the number of first processing requests included in the second task queue does not exceed M, each first processing request included in the second task queue is dequeued.

[0085] In some embodiments, the proxy module of the computing device may periodically obtain the multiple first processing requests, or obtain the multiple first processing requests when the GPU of the computing device is idle.

[0086] After the GPU of the computing device processes the data, the proxy module of the computing device receives a processing response sent by the GPU of the computing device, the processing response including the processing result of the GPU of the computing device. When receiving the processing response, the proxy module of the computing device determines that the GPU of the computing device is idle.

[0087] Step 405: The proxy module of the computing device sends a second processing request to the GPU of the computing device, where the second processing request includes a plurality of second data, and the plurality of second data is the second data included in each first processing request in the plurality of first processing requests.

[0088] The proxy module of the computing device reads the second data included in each first processing request, obtains a plurality of second data, and generates a second processing request including the plurality of second data.

[0089] Step 406: The GPU of the computing device receives the second processing request, reads at least one first data stored in the global memory, and processes the plurality of second data based on the at least one first data.

[0090] In step 406, the GPU of the computing device receives a second processing request, reads multiple second data included in the second processing request, reads at least one first data stored in the global memory based on the second processing request, and processes each of the multiple second data based on the at least one first data.

[0091] If the CPU of the computing device sends multiple first processing requests to the GPU of the computing device, each time the GPU of the computing device receives a first processing request, it reads the first data stored in the global memory based on the received first processing request, and processes the second data included in the first processing request based on the read first data. In this way, the GPU of the computing device needs to read the global memory to process each second data, and the amount of data stored in the global memory is large, so it takes a long time to read the first data in the global memory, so that the time to process each second data is long.

[0092] However, in step 406, since the second data request includes multiple second data, the GPU of the computing device reads the first data from the global memory based on the second processing request, and then processes each second data in the second processing request based on the first data. In this way, the GPU of the computing device can process multiple second data by reading the global memory once, thereby reducing the number of times the global memory is read and improving the efficiency of processing the second data.

[0093] In some embodiments, the proxy module of the computing device processes each second data respectively, and may obtain a processing result corresponding to each second data. After obtaining the processing result corresponding to each second data, the following step 407 is further executed.

[0094] Step 407: The GPU of the computing device sends a second processing response to the proxy module of the computing device, where the second processing response includes multiple processing results, including a processing result corresponding to each second data in the multiple second data.

[0095] In some embodiments, the order of the plurality of second data in the second processing request is the same as the order of the processing results corresponding to the plurality of second data in the second processing response. For example, the processing result corresponding to the first second data in the second processing response corresponds to the first second data in the second processing request, the processing result corresponding to the second second data in the second processing response corresponds to the second second data in the second processing request, the processing result corresponding to the third second data in the second processing response corresponds to the third second data in the second processing request, and so on.

[0096] The plurality of second data included in the second processing request corresponds one-to-one to the plurality of threads, and the plurality of processing results included in the second processing response corresponds one-to-one to the plurality of threads.

[0097] Step 408: The proxy module of the computing device receives the second processing response, and sends the multiple processing results included in the second processing response to the CPU of the computing device.

[0098] The plurality of threads in the CPU of the computing device include a first thread, and the plurality of threads include a plurality of threads that send the plurality of first processing requests.

[0099] In step 408, a first processing result is obtained from a plurality of processing results included in the second processing response, the first processing result being a processing result obtained by the GPU of the computing device processing second data included in the first processing request sent by the first thread, and a first processing response is sent to the first thread included in the CPU of the computing device, the first processing response including the first processing result.

[0100] In some embodiments, the proxy module of the computing device determines the second data corresponding to each processing result based on the order of each processing result included in the second processing response. Based on the second data corresponding to each processing result, the thread corresponding to each processing result is determined, and the first processing response is sent to each thread. The first processing response sent to the first thread includes the processing result corresponding to the first thread.

[0101] The first thread in the CPU of the computing device receives a first processing response, the first processing response includes a first processing result, and sends the first processing response to the first client. The first processing request sent by the first client is the first processing request dequeued by the first thread from the first task queue.

[0102] In an embodiment of the present application, the proxy module of the device obtains multiple first processing requests, sends a second processing request to the GPU of the device, and the second processing request includes multiple second data, and the multiple second data are the second data included in each of the multiple first processing requests. The GPU of the computing device receives the second processing request, reads at least one first data stored in the global memory based on the second processing request, and processes the multiple second data included in the second processing request based on the at least one first data. In this way, the GPU of the computing device reads the global memory once and can process the multiple second data included in the second processing request, thereby reducing the number of times the global memory is read and improving the efficiency of processing data.

[0103] For the above Figure 4 The method 400 shown in FIG. 4 is a method for implementing the method 400, and the method 400 is applied to the field of retrieving data. Figure 2 or Figure 3 The network architecture 200 is shown. Figure 6 The method for processing data implemented in this example is a method 600 for retrieving data, including the following process from step 601 to step 613.

[0104] Step 601: The equalizing device receives a retrieval command, where the retrieval command includes second data to be retrieved.

[0105] When the user needs to use the second data to retrieve data, the user can use the client to send a retrieval command to the balancing device, where the retrieval command includes the second data.

[0106] In some embodiments, the retrieval command including the second data may mean that the retrieval command includes n first feature vectors of the second data, that is, the retrieval command sent by the client to the balancing device includes n first feature vectors of the second data, where n is an integer greater than or equal to 1.

[0107] The second data may be unstructured data, that is, the second data may be data such as pictures, videos, audios, or user logs, etc. Alternatively, the second data may be structured data, that is, the second data may be text data, etc.

[0108] Step 602: The balancing device sends the retrieval command to the first device.

[0109] In step 602, the balancing device selects a first device from a plurality of first devices based on a load balancing strategy, and sends the retrieval command to the selected first device.

[0110] Step 603: The first device receives the retrieval command, and sends a first retrieval request to each of the Q retrieval clusters, where the first retrieval request includes the second data, and Q is an integer greater than 1.

[0111] In some embodiments, the first search request includes the second data means that the first search request includes n first feature vectors of the second data. In step 603, after receiving the search command, the first device obtains n first feature vectors based on the second data included in the search command, and sends a first search request to each of the Q search clusters, where the first search request includes n first feature vectors of the second data.

[0112] Each of the n first eigenvectors includes D features of the second data.

[0113] In some embodiments, the first device receives the retrieval command, inputs the second data included in the retrieval command into the feature vector acquisition model, enables the feature vector acquisition model to acquire n first feature vectors of the second data based on the second data, and acquires n first feature vectors of the second data output by the feature vector acquisition model.

[0114] In some embodiments, the retrieval command sent by the client to the balancing device includes n first feature vectors of the second data. After receiving the retrieval command, the first device sends a first retrieval request to each of the Q retrieval clusters, the first retrieval request including the n first feature vectors of the second data.

[0115] For any one of the Q search clusters, the search cluster includes at least one search device, and the first device selects a search device from the at least one search device based on a load balancing strategy. The first device sending the first search request to the search cluster is essentially sending the first search request to the selected search device.

[0116] Step 604: The CPU of the retrieval device receives the first retrieval request and sends the first retrieval request. The Q retrieval clusters include the retrieval cluster to which the retrieval device belongs.

[0117] In step 604, after receiving the first search request, the CPU of the search device saves the first search request into the first task queue.

[0118] In step 603, multiple first devices may receive retrieval commands sent by multiple clients. After receiving the retrieval command, each first device sends a first retrieval request to each retrieval device in the retrieval set. The CPU of the retrieval device may receive multiple first retrieval requests and save the multiple first retrieval requests to the first task queue.

[0119] In step 604, the CPU of the retrieval device may start multiple threads, and for any one of the multiple threads, the thread dequeues a first processing request from the first task queue and sends the dequeued first processing request. Each thread dequeues a first processing request from the first task queue and sends the dequeued first processing request, so that multiple first processing requests can be sent.

[0120] Step 605: The proxy module of the retrieval device intercepts the first retrieval request and caches the first retrieval request.

[0121] Since each thread started in the CPU of the retrieval device sends a first retrieval request, the proxy module of the retrieval device can intercept the first retrieval request sent by each thread, thereby intercepting multiple first retrieval requests and caching the multiple first retrieval requests in the second task queue.

[0122] Step 606: The proxy module of the retrieval device obtains multiple first retrieval requests from the cached first retrieval requests.

[0123] In step 606, the proxy module of the retrieval device dequeues a plurality of first retrieval requests from the second task queue.

[0124] Optionally, during implementation, when the number of first search requests included in the second task queue exceeds M, M first search requests are dequeued from the second task queue, where M is an integer greater than 1 and M is the maximum number of second data that the GPU of the search device can process simultaneously. When the number of first search requests included in the second task queue does not exceed M, each first search request included in the second task queue is dequeued.

[0125] In some embodiments, the proxy module of the retrieval device may periodically obtain multiple first retrieval requests, or obtain multiple first retrieval requests when the GPU of the retrieval device is idle.

[0126] After the GPU of the retrieval device retrieves the data, the proxy module of the retrieval device receives a retrieval response sent by the GPU of the retrieval device, the retrieval response including the data retrieved by the GPU of the retrieval device. When receiving the retrieval response, the proxy module of the retrieval device determines that the GPU of the retrieval device is idle.

[0127] Step 607: the proxy module of the retrieval device sends a second retrieval request to the GPU of the retrieval device, where the second retrieval request includes a plurality of second data, and the plurality of second data is the second data included in each of the plurality of first retrieval requests.

[0128] The proxy module of the retrieval device reads the second data included in each first retrieval request, obtains a plurality of second data, and generates a second retrieval request including the plurality of second data.

[0129] In some embodiments, the second search request including the plurality of second data means that the second search request includes n first feature vectors of each second data in the plurality of second data.

[0130] Step 608: The GPU of the retrieval device receives the second retrieval request, reads the multiple first data stored in the global memory, and based on each second data included in the second retrieval request, retrieves the retrieval result corresponding to each second data from the multiple first data.

[0131] The search result corresponding to any second data includes the first data retrieved based on the second data.

[0132] In step 608, the GPU of the retrieval device receives the second retrieval request, reads the multiple second data included in the second retrieval request, and reads the multiple first data stored in the global memory based on the second processing request. For any second data among the multiple second data included in the second retrieval request, the distance between the second data and each first data among the multiple first data is obtained. At least one first data having the best distance to the second data is selected from the multiple first data, and the at least one first data corresponds to the second data, that is, the retrieval result corresponding to the second data includes the at least one first data.

[0133] In some embodiments, the GPU of the retrieval device may retrieve the retrieval result corresponding to the second data through the following operations 6081 to 6083.

[0134] 6081: The GPU of the retrieval device obtains the n first feature vectors of the second data and the second feature vector of each first data in the multiple first data, and obtains the distance between the second data and each first data based on the n first feature vectors of the second data and the second feature vector of each first data.

[0135] In some embodiments, the second search request includes the second data, and the GPU of the search device inputs the second data into the feature vector acquisition model, so that the feature vector acquisition model acquires n first feature vectors of the second data based on the second data, and acquires the n first feature vectors of the second data output by the feature vector acquisition model. Alternatively, the second search request includes the n first feature vectors of the second data, and the GPU of the search device acquires the n first feature vectors of the second data from the second search request.

[0136] In some embodiments, the global memory stores a first correspondence relationship, and the GPU of the retrieval device obtains a plurality of first data and a second feature vector of each first data from the first correspondence relationship stored in the global memory.

[0137] In some embodiments, the operation of the retrieval device obtaining the distance between the second data and each first data is:

[0138] The retrieval device obtains a first retrieval algorithm based on n, wherein the first retrieval algorithm is a retrieval algorithm that uses the n first feature vectors to retrieve data and the performance meets the first condition. The distance between the second data and each first data is obtained based on the n first feature vectors and the second feature vector of each first data.

[0139] In some embodiments, the GPU of the retrieval device may also obtain a first operating parameter based on n, where the first operating parameter is an operating parameter used when the first retrieval algorithm performs best in retrieving data. Then, the retrieval device obtains the distance between the second data and each first data based on the first operating parameter, the n first feature vectors, and the second feature vector of each first data.

[0140] In some embodiments, the retrieval device obtains the first retrieval algorithm and the first operating parameter corresponding to n from the second corresponding relationship based on n, and the second corresponding relationship is used to store the correspondence between the number of first feature vectors, the operating parameters and the retrieval algorithm.

[0141] Since the first search algorithm is a search algorithm whose performance of retrieving data using the n first feature vectors satisfies the first condition, it means that the first search algorithm is a search algorithm with the best performance of retrieving data using the n first feature vectors, or it means that the first search algorithm is a search algorithm whose performance of retrieving data using the n first feature vectors exceeds a performance threshold. In this way, retrieving data using the first search algorithm can greatly improve the efficiency of retrieving data.

[0142] In some embodiments, the first operating parameter includes one or more of the following: the number of resource blocks "block2" used by the first search algorithm, the number of threads "thread2" included in the resource block, or the shared memory size "memory2" used by the resource block.

[0143] Thus, in step 6081, the GPU of the retrieval device allocates "block2" resource blocks based on the first operating parameters and allocates shared memory to each resource block. Each resource block in the "block2" resource blocks includes "thread2" threads, and the size of the shared memory allocated to each resource block is equal to "memory2". For each resource block in the "block2" resource blocks, each resource block corresponds to a part of the records in the first corresponding relationship, and each resource block corresponds to different records. For any resource block, the thread in the resource block is used to run the first retrieval algorithm, so that the thread in the resource block can calculate the distance between the second data and the first data in each record based on the n first feature vectors and the second feature vector of the first data in each record corresponding to the resource block, and the shared memory corresponding to the resource block is used to save the distance calculated by the thread in the resource block. Thus, the distance calculated by the thread in each resource block is the distance between the second data and each first data in the first corresponding relationship.

[0144] 6082: The GPU of the retrieval device obtains N data sets, where the N data sets include a first data set, where the first data set includes a portion of first data among the plurality of first data, and a distance between second data and the portion of first data, where N is an integer greater than 1.

[0145] In 6082, the GPU of the retrieval device divides the plurality of first data into N data sets, each data set including a portion of the first data in the plurality of first data and a distance between the second data and the portion of the first data.

[0146] In some embodiments, the GPU of the retrieval device selects Z first data from the multiple first data, and combines the Z first data and the distance between the second data and the Z first data into a data set, where Z is an integer greater than 1. If the number of remaining unselected first data exceeds Z, the retrieval device selects Z first data from the remaining first data, and combines the Z first data and the distance between the second data and the Z first data into a data set. If the number of remaining unselected first data does not exceed Z, the GPU of the retrieval device combines the remaining first data and the distance between the second data and the remaining first data into a data set.

[0147] Z may be an integer value such as 32767, 65535, or 131070.

[0148] 6083: The GPU of the retrieval device allocates the N data sets to multiple SMs, the GPU of the retrieval device includes the multiple SMs, the SM allocated to the first data set is used to select K first data from the first data set based on the distance included in the first data set, K is an integer greater than or equal to 1.

[0149] The GPU of the retrieval device includes W SMs, and the multiple SMs are part or all of the W SMs. When N is greater than W, the number of the multiple SMs is W, that is, the multiple SMs are the W SMs. Alternatively, when N is less than or equal to W, the number of the multiple SMs is N.

[0150] In some embodiments, when N is greater than W, the multiple SMs include W SMs, and the GPU of the retrieval device allocates the N data sets to the W SMs. Optionally, during implementation, the retrieval device selects W data sets from the N data sets and allocates the W data sets to the W SMs. For any one of the W SMs, for ease of explanation, the one SM is referred to as the first SM, and the data set allocated to the first SM is referred to as the second data set. When the first SM selects K first data from the second data set, the GPU of the retrieval device selects a data set from the unselected data set as the third data set, and allocates the third data set to the first SM.

[0151] In some embodiments, when N is less than or equal to W, the plurality of SMs include N SMs, and the retrieving device distributes the N data sets to the N SMs.

[0152] For any SM assigned to a data set, the SM selects K first data from the first data included in the data set based on the distance included in the data set. In implementation, the SM selects K first data with the best distance from the second data from the first data included in the data set.

[0153] In some embodiments, the GPU of the retrieval device further obtains the first data selected by each SM, and obtains N*K first data in total, and the retrieval result corresponding to the second data includes the N*K first data. Optionally, the retrieval result also includes the distance between the second data and each of the N*K first data.

[0154] In some embodiments, the number of the N*K first data may be larger, see Figure 7 , the retrieval device GPU may also assign a second data set to a second SM, the second data set includes the N*K first data, and the distance between the second data and each of the N*K first data, and the GPU of the retrieval device includes a second SM. The second SM is used to select K first data from the second data set based on the distance included in the second data set. When implemented, the second SM selects K first data with the best distance from the first data included in the second data set. The retrieval result corresponding to the second data includes the K first data. Optionally, the retrieval result also includes the distance between the second data and each of the K first data.

[0155] Step 609: The GPU of the retrieval device sends a second retrieval response to the proxy module of the retrieval device, where the second retrieval response includes a plurality of retrieval results, and the plurality of retrieval results correspond one-to-one to the plurality of second data.

[0156] The multiple second data included in the second search request correspond one-to-one to the multiple threads, and the multiple search results included in the second search response correspond one-to-one to the multiple threads.

[0157] Step 610: The proxy module of the retrieval device receives the second retrieval response and sends a first retrieval response to the CPU of the retrieval device. The first retrieval response includes a retrieval result of a second data in the second retrieval response.

[0158] The first search response corresponds to the one second data.

[0159] In step 610, the proxy module of the retrieval device may send multiple first retrieval responses to the CPU of the retrieval device, the multiple first retrieval responses correspond one-to-one to the multiple retrieval results included in the second retrieval response, and each first retrieval response includes the retrieval results in each first retrieval response.

[0160] The CPU of the retrieval device includes a plurality of threads including a first thread, and the plurality of threads include a plurality of threads for sending the plurality of first retrieval requests.

[0161] In step 610, a first search result is obtained from the multiple search results included in the second search response, the first search result being the search result corresponding to the second data included in the first search request sent by the first thread, and a first search response is sent to the first thread included in the CPU of the search device, the first search response including the first search result.

[0162] Step 611: The CPU of the retrieval device receives the first retrieval response and sends the first retrieval response to the first device.

[0163] Every time the CPU of the retrieval device receives a first retrieval response, it may send the first retrieval response to the first device.

[0164] When the retrieval device in each of the Q retrieval clusters retrieves the retrieval result, it sends a first retrieval response to the first device.

[0165] Step 612: The first device receives a first search response sent by a search device in each of the Q search clusters, and selects L first data from the first data included in the Q first search responses, where L is an integer greater than or equal to 1 and less than or equal to K.

[0166] In step 612, for any second data, the first device receives a total of Q first search responses corresponding to the second data, each of which includes N*K first data and the distance between the second data and each of the N*K first data. Therefore, the first device receives a total of Q*N*K first data and the distance between the second data and each of the Q*N*K first data. The first device selects L first data with the best distance to the second data from the Q*N*K first data. Or,

[0167] The first device receives a total of Q first search responses corresponding to the second data, each of which includes K first data and the distance between the second data and each of the K first data. Therefore, the first device receives a total of Q*K first data and the distance between the second data and each of the Q*K first data. The first device selects L first data with the best distance to the second data from the Q*K first data.

[0168] Step 613: The first device sends the L second data to the client.

[0169] For the above-mentioned feature vector acquisition model, the feature vector acquisition model is obtained through training based on at least one training sample, each of the at least one training sample includes a data and at least one feature vector, and each of the at least one feature vector includes D features of the data.

[0170] In some embodiments, the process of training the feature vector acquisition model includes the following operations (1)-(3).

[0171] (1): Based on the feature vector to be trained, a model is obtained and the data in each training sample, and at least one feature vector corresponding to each training sample is obtained.

[0172] For each training sample, at least one feature vector corresponding to the training sample is a feature vector output by the feature vector acquisition model to be trained after processing the data in the training sample.

[0173] The traffic type recognition model to be trained includes a convolutional neural network, a random forest algorithm, a logistic regression algorithm or a support vector machine (SVM), etc.

[0174] In operation (1), the data in each training sample is input into the feature vector acquisition model to be trained, so that the feature vector acquisition model to be trained obtains at least one feature vector corresponding to each training sample based on the data in each training sample, and obtains at least one feature vector corresponding to each training sample output by the feature vector acquisition module to be trained.

[0175] (2): Based on at least one feature vector in each training sample and at least one feature vector corresponding to each training sample, a loss value is calculated through a loss function, and the parameters of the model obtained by adjusting the feature vector to be trained based on the loss value.

[0176] (3): When it is determined that the feature vector acquisition model to be trained should continue to be trained, the operation returns to operation (1); when it is determined that the feature vector acquisition model to be trained should not continue to be trained, the feature vector acquisition model to be trained is used as the feature vector acquisition model.

[0177] In some embodiments, when the number of times the feature vector acquisition model to be trained reaches a specified number of times, it is determined not to continue training the feature vector acquisition model to be trained. Or,

[0178] Use multiple verification samples to obtain the accuracy of the feature vector obtained by the feature vector acquisition model to be trained. If the accuracy exceeds the specified accuracy threshold, it is determined not to continue training the feature vector acquisition model to be trained. When implementing:

[0179] A plurality of verification samples are obtained, each verification sample including data and at least one feature vector. Based on the data in each verification sample and the feature vector to be trained, a model is obtained, and at least one feature vector corresponding to each verification sample is obtained. Based on at least one feature vector in each verification sample and at least one feature vector corresponding to each verification sample, the accuracy of the feature vector is calculated. If the accuracy does not exceed a specified accuracy threshold, it is determined to continue training the feature vector acquisition model to be trained, and if the accuracy exceeds the specified accuracy threshold, it is determined not to continue training the feature vector acquisition model to be trained.

[0180] In an embodiment of the present application, the CPU of the retrieval device receives a first retrieval request, and the first retrieval request includes the second data to be retrieved. The proxy module of the retrieval device sends a second retrieval request to the GPU of the retrieval device, and the second retrieval request includes multiple second data, and the multiple second data are the second data included in the multiple first retrieval requests received by the CPU of the retrieval device. The GPU of the retrieval device receives the second retrieval request and reads multiple first data from the global memory, so that each second data in the second retrieval request can be retrieved and processed by reading the global memory once, which reduces the number of times the global memory is read and improves the efficiency of retrieving data. For any second data in the second retrieval request, the distance between the second data and each first data is obtained. The multiple first data are divided into N data sets, each data set includes part of the first data in the multiple first data, and the distance between the second data and the part of the first data, and the N data sets are allocated to multiple SMs. For any SM and the data set allocated to the SM, the SM selects the first data from the data set based on the distance included in the data set. In this way, the multiple SMs can select the second data from the multiple first data in parallel, improve the efficiency of selecting the first data, and thus improve the efficiency of retrieving data.

[0181] See also Figure 8The present application embodiment provides a method 800 for establishing a second corresponding relationship, wherein the method 800 is applied to Figure 2 or Figure 3 In the network architecture 200 shown, the execution subject of the method 800 may be a retrieval device in the network architecture 200. The method 800 includes the following process from step 801 to step 804.

[0182] Step 801: The retrieval device obtains m third feature vectors of third data to be detected, each third feature vector including D features of the third data.

[0183] D is also called the dimension of the third eigenvector.

[0184] m may be an integer selected from a numerical range greater than or equal to 1 and less than or equal to H, where H is an integer greater than 1. Optionally, H is a numerical value such as 16, 32 or 64.

[0185] In step 801, the detection device may obtain m third feature vectors of the third data in a variety of ways. Two ways are listed below, which are respectively way 1 and way 2.

[0186] Method 1: The retrieval device obtains the third data to be detected, inputs the third data into the feature vector acquisition model, enables the feature vector acquisition model to obtain m third feature vectors of the third data based on the third data, and obtains m third feature vectors of the third data output by the feature vector acquisition model.

[0187] In some embodiments, the third data is data generated by the retrieval device, or the third data is data downloaded from the network by the retrieval device, etc.

[0188] In a second manner, the retrieval device receives a retrieval request, where the retrieval request includes m third feature vectors of the third data.

[0189] In some embodiments, the retrieval request is a retrieval request sent by any first device and received by the retrieval device.

[0190] Step 802: The retrieval device obtains the performance of a target retrieval algorithm using each of a plurality of operating parameters to retrieve data based on the m third feature vectors, where the target retrieval algorithm is any one of the plurality of retrieval algorithms.

[0191] The dimension of the feature vector used by each of the multiple retrieval algorithms to retrieve data is equal to D. Optionally, the multiple retrieval algorithms are pre-set retrieval algorithms.

[0192] In some embodiments, the retrieval device includes a third correspondence relationship, and the third correspondence relationship is used to store the correspondence between the dimension of the feature vector and the retrieval algorithm. Any record in the third correspondence relationship includes a dimension and multiple retrieval algorithms, and the dimension of the feature vector used by each retrieval algorithm in the multiple retrieval algorithms when retrieving data is equal to the dimension included in the record.

[0193] In some embodiments, before executing step 802, multiple corresponding retrieval algorithms can be obtained from the third corresponding relationship based on the dimension D of the third feature vector, and a retrieval algorithm can be selected from the multiple retrieval algorithms as a target retrieval algorithm.

[0194] In step 802, the retrieval device obtains multiple operating parameters, selects one operating parameter from the multiple operating parameters as the target operating parameter, retrieves data in the first corresponding relationship through the target retrieval algorithm based on the m third characteristic vectors and the target operating parameter, and obtains the performance of the target retrieval algorithm using the target operating parameter to retrieve data. Then, for other operating parameters in the multiple operating parameters, the other operating parameters are processed according to the above-mentioned processing method for the target operating parameter to obtain the performance of the target retrieval algorithm using the target operating parameter to retrieve data. In this way, the performance of the target retrieval algorithm using each operating parameter to retrieve data is obtained.

[0195] In some embodiments, the performance of the target retrieval algorithm in retrieving data may include the latency required for the target retrieval algorithm to retrieve data.

[0196] In some embodiments, the retrieval device may enumerate multiple operating parameters, each operating parameter including the number of resource blocks "block", the number of threads "thread" included in the resource block and / or the size of shared memory "memory" used by the resource block.

[0197] For example, referring to Table 1 below, assuming that the retrieval device enumerates multiple operating parameters as shown in Table 1, each row in Table 1 is recorded as an operating parameter. Optionally, when the retrieval device enumerates the number of resource blocks "block", each enumerated "block" may be a multiple of 16. For example, referring to Table 1 below, the number of resource blocks enumerated "block" may be 16, 32, or 64.

[0198] When the retrieval device enumerates the number of threads "thread" included in each resource block, each enumerated "thread" may be a multiple of 16. For example, as shown in Table 1 below, the number of threads "thread" included in each enumerated resource block may be 16, 32, 64 or 128.

[0199] When the retrieval device enumerates the shared memory size "memory" that can be used by each thread included in the resource block, each enumerated "memory" may be a multiple of 16. For example, as shown in Table 1 below, each enumerated "memory" may be 16k, 32k or 64k.

[0200] Table 1

[0201] Serial number The number of resource blocks "block" Number of threads "thread" Shared memory size "memory" 1 16 16 16k 2 16 32 16k 3 16 64 16k 4 16 128 16k 5 32 16 32k 6 32 32 32k 7 32 64 32k 8 32 128 32k 9 64 16 64k 10 64 32 64k 11 64 64 64k 12 64 128 64k …… …… …… ……

[0202] In some embodiments, the performance of the target retrieval algorithm using the target operating parameters to retrieve data includes the time delay required for the target retrieval algorithm to use the target operating parameters to retrieve data.

[0203] The retrieval device calculates the distance between the third data and each second data in the first corresponding relationship through a target retrieval algorithm based on the m third feature vectors, the second feature vector of each second data in the first corresponding relationship, and the target operation parameter, and selects K second data with the smallest distance from the third data from the first corresponding relationship. The K second data are the data retrieved by the retrieval device, and the retrieval device times the process of retrieving the K second data using the m third feature vectors, the second feature vector of each second data in the first corresponding relationship, and the target operation parameter, to obtain the time delay required for the target retrieval algorithm to retrieve the data using the target operation parameter.

[0204] In some embodiments, the target operating parameters include the number of resource blocks "block1", the number of threads "thread1" included in the resource block and / or the size of the shared memory "memory1" used by the resource block, etc. The process of the retrieval device retrieving the K second data is:

[0205] The retrieval device allocates "block1" resource blocks based on the target operation parameters and allocates shared memory to each resource block. Each resource block in the "block1" resource blocks includes "thread1" threads, and the size of the shared memory allocated to each resource block is equal to "memory1". For each resource block in the "block1" resource blocks, each resource block corresponds to a part of the records in the first corresponding relationship, and the records corresponding to each resource block are different. For any resource block, the threads in the resource block are used for the target retrieval algorithm, so that the threads in the resource block can calculate the distance between the third data and the second data in each record corresponding to the resource block based on the m third feature vectors and the second feature vector of the second data in each record corresponding to the resource block, and the shared memory corresponding to the resource block is used to save the distance calculated by the threads in the resource block. In this way, the distance calculated by the threads in each resource block includes the distance between the third data and each second data in the first corresponding relationship. The retrieval device selects K second data with the best distance to the third data from the first corresponding relationship.

[0206] For example, see Fig. 9 , assuming that the number of resource blocks "block" in the target operation parameter is equal to 4, the retrieval device allocates 4 resource blocks, namely resource block A, resource block B, resource block C and resource block D. Resource block A corresponds to the records of lines 0-31, lines 128-159, lines 256-278, and so on in the first correspondence. Resource block B corresponds to the records of lines 32-63, lines 160-191, lines 288-319, and so on in the first correspondence. Resource block C corresponds to the records of lines 64-95, lines 192-223, lines 320-351, and so on in the first correspondence. Resource block D corresponds to the records of lines 96-127, lines 224-255, lines 352-383, and so on in the first correspondence. In this way, resource block A, resource block B, resource block C and resource block D can calculate distances in parallel, thereby improving the efficiency of retrieving data.

[0207] In some embodiments, for any resource block, the threads in the resource block run on the SM of the GPU of the retrieval device. Optionally, for any SM in the GPU, the SM can run threads in one or more resource blocks, thereby effectively utilizing the parallel architecture of multiple SMs of the GPU and improving the efficiency of retrieving data.

[0208] Step 803: The retrieval device obtains a first operating parameter of the target retrieval algorithm and the best performance of the retrieval data, where the first operating parameter is the operating parameter used by the target retrieval algorithm among the multiple operating parameters when the performance of the retrieval data is the best.

[0209] Since the retrieval device has obtained the performance of the target retrieval algorithm using each operating parameter to retrieve data, the retrieval device selects the best performance from the performance of the retrieval data corresponding to each operating parameter, and uses the operating parameter corresponding to the best performance as the first operating parameter of the target retrieval algorithm.

[0210] The target retrieval algorithm is one of the multiple retrieval algorithms. For each of the other retrieval algorithms in the multiple retrieval algorithms, each of the other retrieval algorithms is used as the target retrieval algorithm and the operations of the above steps 802 and 803 are performed respectively, so as to obtain the first operating parameters of each of the multiple retrieval algorithms and the best performance of the retrieval data. Then, step 804 is performed.

[0211] Step 804: The retrieval device selects a retrieval algorithm with the best performance in retrieving data and satisfying the first condition from the multiple retrieval algorithms as a first retrieval algorithm, and stores m, the first retrieval algorithm and the first operating parameter of the first retrieval algorithm in a second corresponding relationship.

[0212] In step 804, the retrieval device selects a retrieval algorithm with the best performance for retrieving data from the multiple retrieval algorithms as the first retrieval algorithm, or selects a retrieval algorithm with the best performance for retrieving data exceeding a performance threshold from the multiple retrieval algorithms as the first retrieval algorithm.

[0213] For a numerical range greater than or equal to 1 and less than or equal to H, an integer is selected from the unselected integers in the numerical range as m, and then the process of steps 801 to 804 is performed again. After each integer in the data range is selected, the first search algorithm and the first operating parameter corresponding to each integer in the numerical range are stored in the second corresponding relationship.

[0214] In some embodiments, in step 804, the retrieval device may also store the correspondence between m and the first retrieval algorithm in a second correspondence relationship.

[0215] In an embodiment of the present application, the retrieval device selects an integer m, obtains m third feature vectors, obtains the best performance of each retrieval algorithm in retrieving data from multiple retrieval algorithms based on the m third feature vectors, selects the retrieval algorithm whose best performance in retrieving data meets the first condition from the multiple retrieval algorithms as the first retrieval algorithm, and stores m and the first retrieval algorithm in correspondence in the second correspondence relationship. In this way, when the retrieval device receives a retrieval request including n feature vectors of the first data, the first retrieval algorithm whose performance in retrieving data using the n feature vectors meets the first condition is obtained from the second correspondence relationship based on n, and the first retrieval algorithm is used to retrieve data, which can improve the efficiency of retrieving data.

[0216] For the above Figure 4The method 400 shown in FIG. 4 is a method for implementing the method 400, and the method 400 is applied to the field of data reasoning. Figure 1 The device 100 shown in the figure is a device 100, and the global memory in the GPU of the computing device 100 stores an intelligent model, which is used to infer data. Fig.10 The method for inferring data implemented in this example is method 1000 for inferring data, which includes the following process from step 101 to step 108.

[0217] Step 101: A CPU of a computing device receives a first reasoning request, where the first reasoning request includes second data to be reasoned.

[0218] There may be multiple clients sending first reasoning requests to the computing device, and the CPU of the computing device may receive the first reasoning requests sent by multiple clients, that is, the CPU of the computing device can receive multiple first reasoning requests and save the multiple first reasoning requests to the first task queue of the CPU of the computing device.

[0219] Step 102: The CPU of the computing device sends a first reasoning request.

[0220] In step 102, the CPU of the computing device may start multiple threads, and for any one of the multiple threads, the thread dequeues a first reasoning request from the first task queue and sends the dequeued first reasoning request. Each thread dequeues a first reasoning request from the first task queue and sends the dequeued first reasoning request, so that multiple first reasoning requests may be sent.

[0221] Step 103: The proxy module of the computing device intercepts the first reasoning request and caches the first reasoning request.

[0222] Since each thread started in the CPU of the computing device sends a first reasoning request, the proxy module of the computing device can intercept the first reasoning request sent by each thread, thereby intercepting multiple first reasoning requests and caching the multiple first reasoning requests in the second task queue.

[0223] Step 104: The proxy module of the computing device obtains a plurality of first reasoning requests from the cached first reasoning requests.

[0224] In step 104 , the agent module of the computing device dequeues a plurality of first reasoning requests from the second task queue.

[0225] Optionally, during implementation, when the number of first inference requests included in the second task queue exceeds M, M first inference requests are dequeued from the second task queue, where M is an integer greater than 1 and M is the maximum number of second data that can be inferred simultaneously by the GPU of the computing device. When the number of first inference requests included in the second task queue does not exceed M, each first inference request included in the second task queue is dequeued.

[0226] In some embodiments, the proxy module of the computing device may periodically obtain the multiple first reasoning requests, or obtain the multiple first reasoning requests when the GPU of the computing device is idle.

[0227] After the GPU of the computing device completes reasoning on the data, the proxy module of the computing device receives a reasoning response sent by the GPU of the computing device. When receiving the reasoning response, the proxy module of the computing device determines that the GPU of the computing device is idle.

[0228] Step 105: The proxy module of the computing device sends a second reasoning request to the GPU of the computing device, where the second reasoning request includes a plurality of second data, where the plurality of second data is the second data included in each first reasoning request in the plurality of first reasoning requests.

[0229] The proxy module of the computing device reads the second data included in each first reasoning request, obtains a plurality of second data, and generates a second reasoning request including the plurality of second data.

[0230] Step 106: The GPU of the computing device receives the second inference request, reads the intelligent model stored in the global memory, and infers the multiple second data based on the intelligent model.

[0231] The intelligent model stored in the global memory can be a physical recognition model, an information processing model, or anomaly detection model, etc.

[0232] In step 106, the GPU of the computing device receives a second reasoning request, reads multiple second data included in the second reasoning request, reads the intelligent model stored in the global memory based on the triggering of the second reasoning request, and performs reasoning on each of the multiple second data based on the intelligent model.

[0233] If the CPU of the computing device sends multiple first inference requests to the GPU of the computing device, each time the GPU of the computing device receives a first inference request, it reads the intelligent model stored in the global memory based on the received first inference request, and infers the second data included in the first inference request based on the intelligent model. In this way, the GPU of the computing device needs to read the global memory to infer each second data, and it takes a long time to read the intelligent model in the global memory each time, so that the time for inferring each second data is long.

[0234] However, in this step 106, since the second data request includes multiple second data, the GPU of the computing device reads the intelligent model from the global memory based on the second reasoning request, and then performs reasoning on each second data in the second reasoning request based on the intelligent model. In this way, the GPU of the computing device can perform reasoning on multiple second data by reading the global memory once, thereby reducing the number of times the global memory is read and improving the efficiency of reasoning the second data.

[0235] Next, an example of an intelligent model is given. It is assumed that the intelligent model is an object recognition model, the multiple second data are multiple pictures, and the GPU of the computing device recognizes the object in each of the multiple pictures based on the physical recognition model.

[0236] In some embodiments, the proxy module of the computing device performs reasoning on each second data respectively, and may obtain a reasoning result corresponding to each second data. After obtaining the reasoning result corresponding to each second data, the following step 107 is further executed.

[0237] Step 107: The GPU of the computing device sends a second reasoning response to the proxy module of the computing device, where the second reasoning response includes multiple reasoning results, and the multiple reasoning results include the reasoning result corresponding to each second data in the multiple second data.

[0238] In some embodiments, the order of the multiple second data in the second reasoning request is the same as the order of the reasoning results corresponding to the multiple second data in the second reasoning response. For example, the reasoning result corresponding to the first second data in the second reasoning response corresponds to the first second data in the second reasoning request, the reasoning result corresponding to the second second data in the second reasoning response corresponds to the second second data in the second reasoning request, the reasoning result corresponding to the third second data in the second reasoning response corresponds to the third second data in the second reasoning request, and so on.

[0239] The multiple second data included in the second reasoning request correspond one-to-one to the multiple threads, and the multiple reasoning results included in the second reasoning response correspond one-to-one to the multiple threads.

[0240] Step 108: The proxy module of the computing device receives the second reasoning response, and sends a plurality of reasoning results included in the second reasoning response to the CPU of the computing device.

[0241] A plurality of threads in a CPU of a computing device includes a first thread, the plurality of threads including a plurality of threads sending the plurality of first inference requests.

[0242] In step 108, a first reasoning result is obtained from multiple reasoning results included in the second reasoning response, where the first reasoning result is an reasoning result obtained by the GPU of the computing device to reason about the second data included in the first reasoning request sent by the first thread, and a first reasoning response is sent to the first thread included in the CPU of the computing device, where the first reasoning response includes the first reasoning result.

[0243] In some embodiments, the proxy module of the computing device determines the second data corresponding to each reasoning result based on the order of each reasoning result included in the second reasoning response. Based on the second data corresponding to each reasoning result, the thread corresponding to each reasoning result is determined, and the first reasoning response is sent to each thread. The first reasoning response sent to the first thread includes the reasoning result corresponding to the first thread.

[0244] A first thread in the CPU of the computing device receives a first reasoning response including a first reasoning result, and sends the first reasoning response to a first client. The first reasoning request sent by the first client is the first reasoning request dequeued by the first thread from the first task queue.

[0245] In an embodiment of the present application, the proxy module of the device obtains multiple first reasoning requests and sends a second reasoning request to the GPU of the device, where the second reasoning request includes multiple second data, and the multiple second data are the second data included in each first reasoning request in the multiple first reasoning requests. The GPU of the computing device receives the second reasoning request, reads the intelligent model stored in the global memory based on the second reasoning request, and infers the multiple second data included in the second reasoning request based on the intelligent model. In this way, the GPU of the computing device can infer the multiple second data included in the second reasoning request by reading the global memory once, thereby reducing the number of times the global memory is read and improving the efficiency of reasoning data.

[0246] See also Fig.11 The present application embodiment provides a device 1100 for processing data, and the device 1100 is applied to a computing device, for example, the device 1100 is applied to Figure 1 The computing device 100 shown, or the apparatus 1100 is applied to Figure 2 or Figure 3 The retrieval device in the network architecture 200 shown, or the device 1100 is applied to Figure 4 The computing device of the method 400, or the apparatus 1100 is applied to Figure 6 The method 600 or Figure 8 The retrieval device in the method 800, or the apparatus 1100 is applied to Fig.10The computing device in the method 1000 shown. The computing device includes a central processing unit (CPU) and a graphics processing unit (GPU), the GPU includes a global memory, and the global memory stores at least one first data. The device 1100 includes:

[0247] The processing unit 1101 is used to obtain a plurality of first processing requests, where the plurality of first processing requests are requests that the CPU needs to send to the GPU, and each first processing request includes second data to be processed;

[0248] The sending unit 1102 is used to send a second processing request to the GPU, where the second processing request includes multiple second data, and the multiple second data are the second data included in each first processing request. The second processing request is used to request the GPU to read at least one first data stored in the global memory, and process the multiple second data based on the at least one first data.

[0249] Optionally, the detailed implementation process of the processing unit 1101 obtaining multiple first processing requests can be found in Figure 4 For relevant contents of step 404 of the method 400, see Figure 6 The relevant contents of step 606 of the method 600 shown in FIG. Fig.10 Step 104 of the illustrated method 1000 will not be described in detail herein.

[0250] Optionally, the detailed implementation process of the sending unit 1102 sending the second processing request to the GPU is shown in Figure 4 For relevant contents of step 405 of the method 400, see Figure 6 The relevant contents of step 607 of the method 600 shown in FIG. Fig.10 Step 105 of the illustrated method 1000 will not be described in detail herein.

[0251] Optionally, the processing unit 1101 is configured to:

[0252] The multiple first processing requests are dequeued from a task queue, where the task queue is used to store the first processing requests that the CPU needs to send to the GPU.

[0253] Optionally, the detailed implementation process of the processing unit 1101 dequeuing the plurality of first processing requests from the task queue is shown in Figure 4 For relevant contents of step 404 of the method 400, see Figure 6 The relevant contents of step 606 of the method 600 shown in FIG. Fig.10 Step 104 of the illustrated method 1000 will not be described in detail herein.

[0254] Optionally, the processing unit 1101 is configured to:

[0255] When the number of first processing requests included in the task queue exceeds M, M first processing requests are dequeued from the task queue, where M is an integer greater than 1, and M is the maximum number of second data that the GPU can process simultaneously;

[0256] When the number of the first processing requests included in the task queue does not exceed M, each first processing request included in the task queue is dequeued.

[0257] Optionally, the processing unit 1101 is further configured to:

[0258] Intercept the first processing request sent by the CPU to the GPU;

[0259] The first intercepted processing request is saved in the task queue.

[0260] Optionally, the detailed implementation process of the processing unit 1101 intercepting the first processing request sent by the CPU to the GPU is shown in Figure 4 For relevant contents in step 403 of the method 400, see Figure 6 The relevant contents of step 605 of the method 600 shown in FIG. Fig.10 Step 103 of the method 1000 is not described in detail here.

[0261] Optionally, the detailed implementation process of the processing unit 1101 storing the intercepted first processing request in the task queue is shown in Figure 4 For relevant contents in step 403 of the method 400, see Figure 6 The relevant contents of step 605 of the method 600 shown in FIG. Fig.10 Step 103 of the method 1000 is not described in detail here.

[0262] Optionally, the device 1100 further includes a receiving unit 1103,

[0263] A receiving unit 1103 is configured to receive a plurality of processing results sent by the GPU, where the plurality of processing results include a processing result obtained by the GPU processing each second data among the plurality of second data;

[0264] The sending unit 1102 is further configured to send the multiple processing results to the CPU.

[0265] Optionally, the detailed implementation process of receiving the multiple processing results sent by the GPU by the receiving unit 1103 can be found in Figure 4 For relevant contents of step 408 of the method 400, see Figure 6 The relevant contents of step 609 of the method 600 shown in FIG. Fig.10 Step 108 of the illustrated method 1000 will not be described in detail herein.

[0266] Optionally, the detailed implementation process of the sending unit 1102 sending the multiple processing results to the CPU is shown in Figure 4 For relevant contents of step 408 of the method 400, see Figure 6 The relevant contents of step 610 of the method 600 are shown in FIG. Fig.10 Step 108 of the illustrated method 1000 will not be described in detail herein.

[0267] Optionally, the multiple first processing requests are processing requests sent by multiple threads in the CPU, the multiple threads include the first thread, and the processing unit 1101 is further configured to:

[0268] Acquire a first processing result from the multiple processing results, where the first processing result is a processing result obtained by the GPU processing second data included in the first processing request sent by the first thread;

[0269] The sending unit 1102 is used to:

[0270] The first processing result is sent to the first thread.

[0271] Optionally, the detailed implementation process of the processing unit 1101 obtaining the first processing result can be found in Figure 4 For relevant contents of step 408 of the method 400, see Figure 6 The relevant contents of step 610 of the method 600 are shown in FIG. Fig.10 Step 108 of the illustrated method 1000 will not be described in detail herein.

[0272] Optionally, the detailed implementation process of the sending unit 1102 sending the first processing result to the first thread is shown in Figure 4 For relevant contents of step 408 of the method 400, see Figure 6 The relevant contents of step 610 of the method 600 are shown in FIG. Fig.10 Step 108 of the illustrated method 1000 will not be described in detail herein.

[0273] Optionally, the multiple first processing requests are all retrieval requests for requesting to retrieve data, and the second processing request is used to request the GPU to read at least one first data stored in the global memory, and retrieve data from the at least one first data based on each second data in the multiple second data.

[0274] Optionally, the multiple first processing requests are all inference requests for requesting inference data, at least one first data stored in the global memory is an intelligent model, and the second processing request is used to request the GPU to read the intelligent model stored in the global memory, and to infer each of the multiple second data through the intelligent model.

[0275] Among them, the processing unit 1101, the sending unit 1102 and the receiving unit 1103 can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the processing unit 1101 is introduced below by taking the processing unit 1101 as an example. Similarly, the implementation of the sending unit 1102 and the receiving unit 1103 can refer to the implementation of the processing unit 1101.

[0276] As an example of a software functional unit, the processing unit 1101 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the processing unit 1101 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code can be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code can be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Among them, usually a region can include multiple AZs.

[0277] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.

[0278] As an example of a hardware functional unit, the processing unit 1101 may include at least one computing device, such as a server, etc. Alternatively, the processing unit 1101 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0279] The multiple computing devices included in the processing unit 1101 can be distributed in the same region or in different regions. The multiple computing devices included in the processing unit 1101 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the processing unit 1101 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0280] It should be noted that, in other embodiments, the processing unit 1101 can be used to execute any step of the method provided in any of the above embodiments, the sending unit 1102 can be used to execute any sending step of the method provided in any of the above embodiments, and the receiving unit 1103 can be used to execute any receiving step of the method provided in any of the above embodiments. The steps that the processing unit 1101, the sending unit 1102, and the receiving unit 1103 are responsible for implementing can be specified as needed, and the processing unit 1101, the sending unit 1102, and the receiving unit 1103 respectively implement different steps of the method provided in any of the above embodiments to realize all functions of the device 1100 for processing data.

[0281] In an embodiment of the present application, the processing unit obtains multiple first processing requests and merges the multiple first processing requests into a first second processing request. Since the second processing request includes multiple second data, the multiple second data are the second data included in each of the multiple first processing requests, and the sending unit sends the second processing request to the GPU. After receiving the second processing request, the GPU reads at least one first data stored in the global memory, and processes the multiple second data based on the at least one first data, so that the GPU can process multiple second data by reading the global memory once, thereby reducing the number of times the global memory is read to improve the efficiency of processing data.

[0282] See also Fig.12 , the present application embodiment provides a computing device 1200. For example, the computing device 1200 may be Figure 1 The computing device 100 shown, alternatively, is Figure 2 or Figure 3 The retrieval device in the network architecture 200 shown, or, Figure 4 The computing device of the method 400 is, or is Figure 6 The method 600 or Figure 8 The retrieval device in the method 800 shown, or, Fig.10 A computing device in method 1000 is shown.

[0283] like Fig.12 As shown, the computing device 1200 includes: a bus 1202, a processor 1204, a memory 1206, and a communication interface 1208. The processor 1204, the memory 1206, and the communication interface 1208 communicate through the bus 1202. The computing device 1200 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 1200.

[0284] The bus 1202 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12 The bus 1204 may include a path for transmitting information between various components of the computing device 1200 (eg, the memory 1206, the processor 1204, and the communication interface 1208).

[0285] The processor 1204 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0286] The memory 1206 may include a volatile memory, such as a random access memory (RAM). The processor 1204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0287] See also Fig.12 , the memory 1206 stores executable program codes, and the processor 1204 executes the executable program codes to respectively implement the functions of the processing unit 1101, the sending unit 1102, and the receiving unit 1103 in the device 800 shown in the figure, thereby implementing the method provided by any of the above embodiments. That is, the memory 1206 stores instructions for executing the method provided by any of the above embodiments. Or,

[0288] The communication interface 1203 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1200 and other devices or a communication network.

[0289] The embodiment of the present application also provides a cluster for processing data. The cluster for processing data includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.

[0290] like Fig.13 As shown, the data processing cluster includes at least one computing device 1200. The memory 1206 in one or more computing devices 1200 in the data processing cluster may store the same instructions for executing the method provided in any of the above embodiments.

[0291] In some possible implementations, the memory 1206 of one or more computing devices 1200 in the data processing cluster may also store partial instructions for executing the above data management method. In other words, a combination of one or more computing devices 1200 may jointly execute instructions for executing the method provided in any of the above embodiments.

[0292] In some possible implementations, one or more computing devices in a cluster processing data may be connected via a network, which may be a wide area network or a local area network. Fig.14 A possible implementation is shown. Fig.14 As shown, two computing devices 1200A and 1200B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device.

[0293] In this type of possible implementation, the memory 1206 in the computing device 1200A stores the execution Fig.11 Instructions for the functions of the processing unit 1101 in the illustrated embodiment. Meanwhile, the memory 1206 in the computing device 1200B stores instructions for executing the functions of the processing unit 1101 in the illustrated embodiment. Fig.14 Instructions for the functions of the sending unit 1102 and / or the receiving unit 1103 in the illustrated embodiment.

[0294] It should be understood that Fig.14 The functions of the computing device 1200A shown in FIG. 1200A may also be completed by multiple computing devices 1200. Similarly, the functions of the computing device 1200B may also be completed by multiple computing devices 1200.

[0295] The present application embodiment also provides another data processing cluster. The connection relationship between the computing devices in the data processing cluster can be similarly referred to as Fig.14 The connection mode of the cluster for processing data is different in that the memory 1206 in one or more computing devices 1200 in the cluster for processing data may store the same instructions for executing the method provided in any of the above embodiments.

[0296] In some possible implementations, the memory 1206 of one or more computing devices 1200 in the data processing cluster may also store partial instructions for executing the method provided in any of the above embodiments. In other words, a combination of one or more computing devices 1200 may jointly execute instructions for executing the method provided in any of the above embodiments.

[0297] The present application also provides a computer program product including instructions. The computer program product may be a software or program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the method provided in any of the above embodiments.

[0298] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the method provided in any of the above embodiments.

[0299] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0300] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method of processing data, It is characterized in that The method is applied to a computing device, the computing device includes a central processing unit (CPU) and a graphics processing unit (GPU), the GPU includes a global memory, the global memory stores at least one first data, and the method includes: Acquire a plurality of first processing requests, where the plurality of first processing requests are requests that the CPU needs to send to the GPU, and each first processing request includes second data to be processed; A second processing request is sent to the GPU, where the second processing request includes a plurality of second data, where the plurality of second data are the second data included in each first processing request, and the second processing request is used to request the GPU to read the at least one first data stored in the global memory, and process the plurality of second data based on the at least one first data.

2. The method according to claim 1, It is characterized in that The obtaining of multiple first processing requests includes: The multiple first processing requests are dequeued from a task queue, where the task queue is used to store the first processing requests that the CPU needs to send to the GPU.

3. The method according to claim 2, It is characterized in that The dequeuing the plurality of first processing requests from the task queue comprises: When the number of first processing requests included in the task queue exceeds M, M first processing requests are dequeued from the task queue, where M is an integer greater than 1, and M is the maximum number of second data that the GPU can process simultaneously; When the number of the first processing requests included in the task queue does not exceed M, each first processing request included in the task queue is dequeued.

4. The method according to claim 2 or 3, It is characterized in that The method further comprises: intercepting a first processing request sent by the CPU to the GPU; The intercepted first processing request is stored in the task queue.

5. The method according to any one of claims 1 to 4, It is characterized in that The method further comprises: receiving a plurality of processing results sent by the GPU, wherein the plurality of processing results include a processing result obtained by the GPU processing each second data among the plurality of second data; The plurality of processing results are sent to the CPU.

6. The method according to claim 5, It is characterized in that The multiple first processing requests are processing requests sent by multiple threads in the CPU, the multiple threads include a first thread, and the method further includes: Acquire a first processing result from the multiple processing results, where the first processing result is a processing result obtained by the GPU processing second data included in the first processing request sent by the first thread; The sending the plurality of processing results to the CPU comprises: The first processing result is sent to the first thread.

7. The method according to any one of claims 1 to 6, It is characterized in that The multiple first processing requests are all retrieval requests for requesting to retrieve data, and the second processing request is used to request the GPU to read the at least one first data stored in the global memory, and retrieve data from the at least one first data based on each second data in the multiple second data.

8. The method according to any one of claims 1 to 6, It is characterized in that The multiple first processing requests are all inference requests for requesting inference data, the at least one first data stored in the global memory is an intelligent model, and the second processing request is used to request the GPU to read the intelligent model stored in the global memory, and to infer each of the multiple second data through the intelligent model.

9. A device for processing data, It is characterized in that The device is applied to a computing device, the computing device includes a central processing unit (CPU) and a graphics processing unit (GPU), the GPU includes a global memory, the global memory stores at least one first data, and the device includes: a processing unit, configured to obtain a plurality of first processing requests, where the plurality of first processing requests are requests that the CPU needs to send to the GPU, and each first processing request includes second data to be processed; A sending unit is used to send a second processing request to the GPU, the second processing request includes multiple second data, the multiple second data are the second data included in each first processing request, and the second processing request is used to request the GPU to read the at least one first data stored in the global memory, and process the multiple second data based on the at least one first data.

10. The device according to claim 9, It is characterized in that The processing unit is used for: The multiple first processing requests are dequeued from a task queue, where the task queue is used to store the first processing requests that the CPU needs to send to the GPU.

11. The device according to claim 10, It is characterized in that The processing unit is used for: When the number of first processing requests included in the task queue exceeds M, M first processing requests are dequeued from the task queue, where M is an integer greater than 1, and M is the maximum number of second data that the GPU can process simultaneously; When the number of the first processing requests included in the task queue does not exceed M, each first processing request included in the task queue is dequeued.

12. The device according to claim 10 or 11, It is characterized in that The processing unit is further used for: intercepting a first processing request sent by the CPU to the GPU; The intercepted first processing request is stored in the task queue.

13. The device according to any one of claims 9 to 12, It is characterized in that The device further comprises a receiving unit, The receiving unit is configured to receive a plurality of processing results sent by the GPU, wherein the plurality of processing results include a processing result obtained by the GPU processing each second data among the plurality of second data; The sending unit is further used to send the multiple processing results to the CPU.

14. The device according to claim 13, It is characterized in that The multiple first processing requests are processing requests sent by multiple threads in the CPU, the multiple threads include a first thread, and the processing unit is further used to: Acquire a first processing result from the multiple processing results, where the first processing result is a processing result obtained by the GPU processing second data included in the first processing request sent by the first thread; The sending unit is used for: The first processing result is sent to the first thread.

15. The device according to any one of claims 9 to 14, It is characterized in that The multiple first processing requests are all retrieval requests for requesting to retrieve data, and the second processing request is used to request the GPU to read the at least one first data stored in the global memory, and retrieve data from the at least one first data based on each second data in the multiple second data.

16. The device according to any one of claims 9 to 14, It is characterized in that The multiple first processing requests are all inference requests for requesting inference data, the at least one first data stored in the global memory is an intelligent model, and the second processing request is used to request the GPU to read the intelligent model stored in the global memory, and to infer each of the multiple second data through the intelligent model.

17. A cluster for processing data, It is characterized in that The cluster includes at least one computing device, each of the at least one computing device includes at least one processor and at least one memory, and the at least one memory stores computer-readable instructions; the at least one processor executes the computer-readable instructions so that the cluster executes the method according to any one of claims 1 to 8.

18. A computer storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

19. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.