A data processing method, device, apparatus, and machine readable storage medium

By determining the number of algorithm handles to be created based on the number of kernels in the processing device, and by rationally allocating processing resources, the problem of resource waste is solved and the processing efficiency of the algorithm is improved.

CN113849310BActive Publication Date: 2025-11-11HANGZHOU HIKFIRE TECH LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111136459.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-27
Publication Date
2025-11-11
Estimated Expiration
2041-09-27

AI Technical Summary

Technical Problem

When a large number of machine learning algorithms are deployed on processing equipment, the unreasonable use of resources leads to resource waste and inefficiency.

Method used

The number of algorithm handles created is determined based on the number of cores in the processing device. Each algorithm handle identifies a set of processing resources, and these resources are used appropriately to execute the target algorithm.

Benefits of technology

This achieves efficient utilization of processing equipment resources, avoids resource waste, and improves the processing efficiency of the algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113849310B_ABST
    Figure CN113849310B_ABST
Patent Text Reader

Abstract

This application provides a data processing method, apparatus, device, and machine-readable storage medium. The method includes: determining a target algorithm for processing target data; determining unoccupied algorithm handles among the created algorithm handles; wherein the number of created algorithm handles is determined based on the number of cores of the processing device, each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core; invoking the processing resources corresponding to the unoccupied algorithm handles to execute the target algorithm to process the target data and obtain the algorithm processing result. Through the technical solution of this application, the resources of the processing device can be used rationally, avoiding resource waste and effectively utilizing the resources of the processing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data processing method, apparatus, device, and machine-readable storage medium. Background Technology

[0002] Machine learning is a pathway to achieving artificial intelligence. It is an interdisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory, among others. Machine learning studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structures to continuously improve their performance. Machine learning places great emphasis on algorithm design, enabling computers to automatically learn patterns from data and use these patterns to predict unknown data.

[0003] Machine learning has been widely used in fields such as deep learning, data mining, computer vision, natural language processing, biometrics, search engines, medical diagnosis, speech and handwriting recognition, etc.

[0004] With the rapid development of machine learning technology, an increasing number of algorithms (such as machine learning algorithms) are being deployed on processing devices. These algorithms can perform the same or different functions. However, when a large number of algorithms are deployed on processing devices, there is currently no reasonable way to determine how these algorithms should utilize the processing device's resources. In other words, resource waste and inefficient resource utilization are problems that arise when these algorithms use resources. Summary of the Invention

[0005] This application provides a data processing method applied to a processing device, the method comprising:

[0006] Determine the target algorithm for processing the target data;

[0007] Identify the unused algorithm handles among the created algorithm handles; wherein the number of algorithm handles created is determined based on the number of cores of the processing device, each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core;

[0008] The processing resources corresponding to the unoccupied algorithm handle are invoked to execute the target algorithm, thereby processing the target data and obtaining the algorithm processing result.

[0009] In one possible implementation, the number of algorithm handles created is the same as the number of cores in the processing device, and each algorithm handle corresponds one-to-one with each core.

[0010] For example, determining the unused algorithm handles among the created algorithm handles includes:

[0011] Based on the recorded algorithm and algorithm handle allocation relationship, if it is determined that the target algorithm does not have an allocated algorithm handle, then the unused algorithm handles among the created algorithm handles are identified.

[0012] In one possible implementation, the method further includes:

[0013] If it is determined that the target algorithm has an allocated algorithm handle, and it is determined that the processing resources corresponding to the allocated algorithm handle have not been released, then the target algorithm is executed using the processing resources corresponding to the allocated algorithm handle to process the target data and obtain the algorithm processing result.

[0014] In one possible implementation, the method further includes: updating the state of the algorithm handle corresponding to the processing resource invoked when executing the target algorithm to be occupied;

[0015] After executing the target algorithm to process the target data and obtain the algorithm processing result, the method further includes: if it is determined that the execution of the target algorithm has ended, updating the status of the occupied algorithm handle to unoccupied and releasing the processing resources corresponding to the algorithm handle.

[0016] For example, determining the target algorithm for processing the target data includes:

[0017] Determine the target service type corresponding to the target data, and select an algorithm that supports the target service type from the algorithms supported by the processing device as the target algorithm; or,

[0018] Determine the data channel identifier corresponding to the target data, and select the algorithm corresponding to the data channel identifier from the algorithms supported by the processing device as the target algorithm.

[0019] In one possible implementation, the method further includes:

[0020] Determine the data channel identifier corresponding to the target data and establish a correspondence between the target data and the data channel identifier; wherein, the data channel identifier is used to distinguish the data channel that transmits the target data and the corresponding algorithm processing result;

[0021] Based on the correspondence between the target data and the data channel identifier, the correspondence between the algorithm processing result corresponding to the target data and the data channel identifier is determined;

[0022] Based on the correspondence between the algorithm processing result and the data channel identifier, the algorithm processing result is transmitted through the data channel corresponding to the data channel identifier.

[0023] In one possible implementation, if there are at least two identical target algorithms, and the target algorithm includes at least two sub-networks, the step of calling the processing resources corresponding to the unoccupied algorithm handle to execute the target algorithm includes:

[0024] Select a first target algorithm to be executed from the at least two target algorithms;

[0025] The first sub-network is traversed from at least two sub-networks of the first target algorithm, and the target data is input into the first sub-network; the processing resources corresponding to the unoccupied first algorithm handle are invoked to execute the first sub-network to process the target data and obtain intermediate results;

[0026] Continue by selecting a second target algorithm to be executed from the at least two target algorithms; wherein the second target algorithm is different from or the same as the first target algorithm;

[0027] The second subnetwork is derived from at least two layers of the second target algorithm, wherein the second subnetwork is a subnetwork at a different layer than the first subnetwork; the intermediate result is input into the second subnetwork; the processing resource corresponding to the unused second algorithm handle is invoked to execute the second subnetwork to process the intermediate result and obtain the algorithm processing result.

[0028] This application provides a data processing apparatus, configured in a processing device, the apparatus comprising:

[0029] The determination module is used to determine the target algorithm for processing the target data.

[0030] The selection module is used to determine the unused algorithm handles among the created algorithm handles; wherein, the number of algorithm handles created is determined based on the number of cores of the processing device, each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core;

[0031] The processing module is used to call the processing resources corresponding to the unoccupied algorithm handle, execute the target algorithm, process the target data, and obtain the algorithm processing result.

[0032] In one possible implementation, the number of algorithm handles created is the same as the number of cores in the processing device, and each algorithm handle corresponds one-to-one with each core;

[0033] Specifically, when the selection module determines the unoccupied algorithm handles among the created algorithm handles, it is used to: based on the recorded algorithm and algorithm handle allocation relationship, if it is determined that the target algorithm does not have an allocated algorithm handle, then determine the unoccupied algorithm handles among the created algorithm handles;

[0034] The processing module is further configured to, if it is determined that the target algorithm has an allocated algorithm handle and the processing resources corresponding to the allocated algorithm handle have not been released, then use the processing resources corresponding to the allocated algorithm handle to execute the target algorithm to process the target data and obtain the algorithm processing result.

[0035] The processing module is further configured to update the status of the algorithm handle corresponding to the processing resource called when executing the target algorithm to be occupied; and, after executing the target algorithm to process the target data and obtain the algorithm processing result, if it is determined that the execution of the target algorithm has ended, update the status of the occupied algorithm handle to be unoccupied and release the processing resource corresponding to the algorithm handle.

[0036] Specifically, when determining the target algorithm for processing the target data, the determining module is used to: determine the target service type corresponding to the target data, and select an algorithm that supports the target service type from the algorithms supported by the processing device as the target algorithm; or, determine the data channel identifier corresponding to the target data, and select an algorithm corresponding to the data channel identifier from the algorithms supported by the processing device as the target algorithm.

[0037] The determining module is further configured to determine a data channel identifier corresponding to the target data and establish a correspondence between the target data and the data channel identifier; wherein the data channel identifier is used to distinguish the data channels transmitting the target data and the corresponding algorithm processing results; based on the correspondence between the target data and the data channel identifier, a correspondence between the algorithm processing results corresponding to the target data and the data channel identifier is determined; the processing module is further configured to transmit the algorithm processing results through the data channel corresponding to the data channel identifier based on the correspondence between the algorithm processing results and the data channel identifier;

[0038] If at least two identical target algorithms exist, and each target algorithm comprises at least two sub-networks, the processing module, when executing the target algorithm by calling the processing resources corresponding to the unoccupied algorithm handle, specifically performs the following steps: selecting a first target algorithm to be executed from the at least two target algorithms; traversing the first sub-network from the at least two sub-networks of the first target algorithm and inputting the target data into the first sub-network; calling the processing resources corresponding to the unoccupied first algorithm handle and executing the first sub-network to process the target data and obtain an intermediate result; continuing to select a second target algorithm to be executed from the at least two target algorithms; wherein the second target algorithm is different from or the same as the first target algorithm; traversing the second sub-network from the at least two sub-networks of the second target algorithm, wherein the second sub-network is a sub-network of a different layer from the first sub-network; inputting the intermediate result into the second sub-network; and calling the processing resources corresponding to the unoccupied second algorithm handle and executing the second sub-network to process the intermediate result and obtain the algorithm processing result.

[0039] This application provides an electronic device, including: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the above-described data processing method.

[0040] This application provides a machine-readable storage medium storing machine-executable instructions that can be executed by a processor; wherein the processor is used to execute the machine-executable instructions to implement the above-described data processing method.

[0041] As can be seen from the above technical solutions, in this embodiment, the number of algorithm handles created can be determined based on the number of cores in the processing device. Each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core. Based on this, multiple algorithms can rationally call the processing resources (such as kernels) corresponding to the algorithm handles, thereby making reasonable use of the processing device's resources, avoiding resource waste, and effectively utilizing the processing device's resources. With minimal resource consumption of the processing device, the utilization rate of algorithm performance is maximized, improving the processing efficiency of the algorithm. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments of this application or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings of the embodiments of this application.

[0043] Figure 1 This is a flowchart illustrating a data processing method according to one embodiment of this application;

[0044] Figure 2 This is a schematic diagram of the target data processing flow in one embodiment of this application;

[0045] Figure 3 This is a schematic diagram of the target data processing flow in one embodiment of this application;

[0046] Figure 4 This is a schematic diagram of the target data processing flow in one embodiment of this application;

[0047] Figure 5 This is a schematic diagram of the structure of a data processing device according to one embodiment of this application. Detailed Implementation

[0048] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the application. The singular forms “a,” “the,” and “the” as used in this application and claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to any and all possible combinations comprising one or more of the associated listed items.

[0049] It should be understood that although the terms first, second, third, etc., may be used to describe various information in embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" may also be interpreted as "when," "when," or "in response to a determination."

[0050] This application proposes a data processing method that can be applied to a processing device. The processing device may include multiple cores and support multiple algorithms; the type of processing device is not limited. Taking an intelligent processing device as an example, the algorithms supported by the processing device can be machine learning algorithms (such as deep learning algorithms, neural network algorithms, etc.) or other types of algorithms. This embodiment does not limit the algorithms supported by the processing device.

[0051] For example, the processing device (such as an intelligent processing device) can be a device that uses an intelligent chip to implement an algorithm (such as a machine learning algorithm). There is no limitation on the type of processing device, as long as it can implement the algorithm. In this embodiment, the processing device can refer to an intelligent chip, that is, the function of the processing device is implemented by an intelligent chip.

[0052] Intelligent chips, also known as Artificial Intelligence (AI) chips, can be defined as chips capable of running algorithms. For example, chips specifically designed to accelerate algorithms are called AI chips. AI chips can also be called AI accelerators or computing cards, and are modules specifically designed to handle the massive computational tasks in artificial intelligence applications. AI chips include, but are not limited to, GPUs (Graphics Processing Units), FPGAs (Field-Programmable Gate Arrays), and ASICs (Application Specific Integrated Circuits).

[0053] To implement the algorithm, the processing device needs various types of resources, such as kernel resources and memory resources. In addition to kernel resources and memory resources, the processing device also needs other types of resources. There are no restrictions on the types of resources. For ease of description, kernel resources and memory resources will be used as examples below.

[0054] For example, a processing device may include multiple cores, which are the processing cores used to implement algorithms. A processing device is typically configured with multiple cores, and these cores execute algorithms in parallel. That is, the processing device can execute multiple algorithms at the same time, thereby improving the processing performance and efficiency of the processing device.

[0055] When the processing device supports a machine learning algorithm, the machine learning algorithm can also be called an artificial intelligence algorithm, such as a deep learning algorithm. Examples include machine learning algorithms for facial recognition (i.e., the business type supported by the machine learning algorithm is facial recognition), machine learning algorithms for license plate recognition (i.e., the business type supported by the machine learning algorithm is license plate recognition), machine learning algorithms for electric bicycle detection (i.e., the business type supported by the machine learning algorithm is electric bicycle detection), and machine learning algorithms for fireworks detection (i.e., the business type supported by the machine learning algorithm is fireworks detection). Of course, the above are just a few examples of machine learning algorithms, and there is no limitation on the type of machine learning algorithm.

[0056] In practical applications, an algorithm can also be referred to as an algorithm channel. That is, an algorithm (such as a machine learning algorithm) is an algorithm channel. In other words, there can be an equivalent relationship between an algorithm and an algorithm channel. For example, suppose the processing device supports four algorithm channels. Then, the four algorithm channels represent four algorithms. For instance, algorithm channel 1 is used to implement face recognition, algorithm channel 2 is used to implement license plate recognition, algorithm channel 3 is used to implement electric bicycle detection, and algorithm channel 4 is used to implement smoke detection.

[0057] For example, the processing device can connect to multiple front-end devices (such as network cameras, analog cameras, etc.). These front-end devices can capture video images and send them to the processing device, which can use these video images as target data for algorithms. Based on this, the processing device can use algorithms to process the target data (such as artificial intelligence processing), obtain the algorithm processing result corresponding to the target data, and return the algorithm processing result corresponding to the target data to the front-end devices.

[0058] When there are a large number of front-end devices, one front-end device can correspond to one data channel, meaning there is a one-to-one correspondence between front-end devices and data channels. This indicates that video images (i.e., target data) are transmitted to the processing device through the data channel. For example, assuming the processing device is connected to 20 front-end devices, then the 20 front-end devices correspond to 20 data channels. Front-end device 1 corresponds to data channel 1, ..., front-end device 20 corresponds to data channel 20. Based on this, data channel 1 is used to transmit the video images captured by front-end device 1 to the processing device, data channel 2 is used to transmit the video images captured by front-end device 2 to the processing device, and so on. Data channel 20 is used to transmit the video images captured by front-end device 20 to the processing device.

[0059] In one possible implementation, algorithm handles can be implemented using numbering. One algorithm handle can correspond to a set of processing resources (such as kernel resources and memory resources), meaning there is a one-to-one correspondence between the algorithm handle and the processing resources. The algorithm can be implemented based on this set of processing resources, i.e., the algorithm is executed by calling this set of processing resources. In the embodiments of this application, algorithm handles can be reused for multiple algorithms to achieve efficient utilization of processing resources in the processing device.

[0060] For example, algorithm 1 corresponds to algorithm handle 1, algorithm handle 1 corresponds to processing resource 1, and processing resource 1 includes kernel 1 and memory block 1 (which is a memory resource). Based on this, when algorithm 1 needs to be executed, the processing resource 1 corresponding to algorithm handle 1 needs to be called to execute algorithm 1. That is to say, kernel 1 can execute algorithm 1 to process the target data. During the processing, memory block 1 needs to be accessed.

[0061] In one existing implementation, the processing device can create multiple algorithm handles, and the number of algorithm handles created is the same as the number of algorithms, with a one-to-one correspondence between the algorithm handle and the algorithm. For example, assuming the processing device supports 8 algorithms, the processing device can create 8 algorithm handles, with algorithm 1 corresponding to algorithm handle 1, algorithm 2 corresponding to algorithm handle 2, ..., and algorithm 8 corresponding to algorithm handle 8.

[0062] Since eight algorithm handles are created, each of these eight handles needs to correspond to eight sets of processing resources (such as kernel resources and memory resources), meaning there is a one-to-one correspondence between the algorithm handles and processing resources. If the processing device includes four kernels, then the eight sets of processing resources share four kernels; if the processing device includes six kernels, then the eight sets of processing resources share six kernels, and so on. The following example will be based on a processing device with four kernels.

[0063] Since the processing device includes 4 cores, meaning that 8 sets of processing resources share 4 cores, then algorithm handle 1 can correspond to kernel 1 and memory block 1, algorithm handle 2 can correspond to kernel 1 and memory block 2, algorithm handle 3 can correspond to kernel 2 and memory block 3, algorithm handle 4 can correspond to kernel 2 and memory block 4, algorithm handle 5 can correspond to kernel 3 and memory block 5, algorithm handle 6 can correspond to kernel 3 and memory block 6, algorithm handle 7 can correspond to kernel 4 and memory block 7, and algorithm handle 8 can correspond to kernel 4 and memory block 8.

[0064] In the above approach, if the target data includes target data 1 processed by algorithm 1, target data 2 processed by algorithm 2, target data 3 processed by algorithm 3, and target data 4 processed by algorithm 4, then algorithm 1 can use kernel 1 corresponding to algorithm handle 1 to process target data 1. However, since kernel 1 corresponding to algorithm handle 2 is already occupied, target data 2 cannot be processed, and the memory resources of memory block 2 are wasted. Similarly, algorithm 3 can use kernel 2 corresponding to algorithm handle 3 to process target data 3. However, since kernel 2 corresponding to algorithm handle 4 is already occupied, target data 4 cannot be processed, and the memory resources of memory block 4 are wasted. In addition, the kernel resources of kernels 3 and 4 are wasted, and the memory resources of memory blocks 5, 6, 7, and 8 are also wasted.

[0065] In summary, there are problems such as wasted kernel and memory resources and ineffective resource utilization. Even with available kernel resources, target data 2 and target data 4 cannot be processed in a timely manner.

[0066] Unlike the methods described above, in this embodiment, the algorithm handle can be decoupled from the algorithm. Instead of creating a handle for each algorithm, the number of algorithm handles created is independent of the number of algorithms. The algorithm handle and algorithm are not in one-to-one correspondence, and the algorithm handle does not represent an algorithm label; that is, the algorithm handle is not a unique identifier for the algorithm. In this embodiment, one algorithm handle still corresponds to a set of processing resources (such as kernel resources and memory resources). Therefore, the algorithm handle can be understood as a handle for a processing resource, used to represent a unique identifier for that resource. Algorithm handles can be implemented using a numbering system; for example, an algorithm handle is a number related to a processing resource. For instance, algorithm handle 1 corresponds to processing resource 1, and processing resource 1 includes kernel 1 and memory block 1 (which is a memory resource); algorithm handle 2 corresponds to processing resource 2, and processing resource 2 includes kernel 2 and memory block 2, and so on.

[0067] In the case of decoupling the algorithm handle from the algorithm, in the embodiments of this application, the processing device can create multiple algorithm handles, and the number of algorithm handles created is determined based on the number of cores of the processing device. Each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core.

[0068] For example, the number of algorithm handles created is the same as the number of cores in the processing device, and each algorithm handle corresponds one-to-one with each core. Of course, in practical applications, the number of algorithm handles created can differ from the number of cores in the processing device; for example, the number of algorithm handles created may be less than the number of cores in the processing device. Algorithm handles identify processing resources, and the processing resources identified by created algorithm handles do not need to be duplicated, such as duplicate kernel calls or duplicate memory calls. Therefore, by reusing algorithm handles, orderly and efficient utilization of processing resources can be achieved.

[0069] For example, suppose the processing device supports 8 algorithms and includes 4 kernels. The processing device can create 4 algorithm handles instead of 8. Obviously, there is no one-to-one correspondence between algorithms and algorithm handles, but there is a one-to-one correspondence between kernels and algorithm handles.

[0070] Since four algorithm handles are created and the processing device has four kernels, the four algorithm handles need to correspond to four sets of processing resources (such as kernel resources and memory resources), and these four sets of processing resources correspond exactly to the four kernels. For example, algorithm handle 1 corresponds to kernel 1 and memory block 1, algorithm handle 2 corresponds to kernel 2 and memory block 2, algorithm handle 3 corresponds to kernel 3 and memory block 3, and algorithm handle 4 corresponds to kernel 4 and memory block 4.

[0071] In the above approach, if the target data includes target data 1 processed by algorithm 1, target data 2 processed by algorithm 2, target data 3 processed by algorithm 3, and target data 4 processed by algorithm 4, then algorithm 1 can use kernel 1 corresponding to algorithm handle 1 to process target data 1, algorithm 2 can use kernel 2 corresponding to algorithm handle 2 to process target data 2, algorithm 3 can use kernel 3 corresponding to algorithm handle 3 to process target data 3, and algorithm 4 can use kernel 4 corresponding to algorithm handle 4 to process target data 4. Obviously, in the above approach, there are no problems such as wasted kernel resources and memory resources, or ineffective resource utilization. The target data can be processed in a timely manner. In other words, the resources of the processing device can be used reasonably, resource waste can be avoided, and resources can be used effectively.

[0072] In the above approach, Algorithm 1 can use kernel 1 corresponding to algorithm handle 1 to process target data 1, or it can use kernel 2 (or kernel 3, or kernel 4) corresponding to algorithm handle 2 (or algorithm handle 3, or algorithm handle 4) to process target data 1. Similarly, Algorithm 2 can also use the kernels corresponding to each algorithm handle to process target data 2, and so on. Since the kernels corresponding to each algorithm handle can be used to process the target data, resources can be used efficiently, avoiding resource waste.

[0073] The technical solutions of the embodiments of this application will be described below with reference to specific examples.

[0074] This application proposes a data processing method that can be applied to a processing device including multiple cores, and the processing device supports multiple algorithms. In practical applications, the number of cores can be greater than the number of algorithms, the number of cores can be equal to the number of algorithms, or the number of cores can be less than the number of algorithms.

[0075] When the number of kernels is less than or equal to the number of algorithms, in this embodiment of the application, the number of algorithm handles created is determined based on the number of kernels of the processing device. For example, the number of algorithm handles created is the same as the number of kernels of the processing device, and each algorithm handle corresponds one-to-one with each kernel.

[0076] When the number of kernels is greater than the number of algorithms, in one possible implementation, the number of algorithm handles created is determined based on the number of kernels in the processing device. For example, the number of algorithm handles created is the same as the number of kernels in the processing device, and each algorithm handle corresponds one-to-one with each kernel. In another possible implementation, the number of algorithm handles created is determined based on the number of algorithms in the processing device. For example, the number of algorithm handles created is the same as the number of algorithms, and each algorithm handle corresponds one-to-one with each algorithm.

[0077] See Figure 1The diagram shown is a flowchart of a data processing method, which may include:

[0078] Step 101: Determine the target algorithm for processing the target data.

[0079] For example, after obtaining target data (such as video images), the front-end device can send the target data to the processing device, which then obtains the target data, i.e., the data that needs to be processed by an algorithm.

[0080] After obtaining the target data, the processing device can select a target algorithm from all algorithms supported by the processing device based on the target business type corresponding to the target data and the business type supported by the algorithm. That is, the target business type corresponding to the target data and the business type supported by the target algorithm can be the same. For example, assuming the target business type corresponding to the target data is face recognition, that is, face recognition needs to be performed on the target data, and Algorithm 1 is the algorithm used to implement face recognition, then the target algorithm can be Algorithm 1.

[0081] For example, in step 101, the target algorithm can be selected from all algorithms supported by the processing device in the following manner. Of course, the following methods are just a few examples and are not limited thereto, as long as the target business type corresponding to the target data is the same as the business type supported by the target algorithm.

[0082] Method 1: Determine the target service type corresponding to the target data, and select the algorithm that supports the target service type from the algorithms supported by the processing device (such as all algorithms) as the target algorithm.

[0083] For example, after obtaining the target data, the first step is to determine the target business type corresponding to the target data. For instance, a mapping relationship between business types and data channels can be pre-configured. After obtaining target data from a certain data channel, the business type corresponding to that data channel is determined as the target business type corresponding to the target data. Alternatively, the target data can carry information about the target business type, and the target business type can be parsed from the target data. Of course, the above are just examples of determining the target business type, and there are no restrictions on this method.

[0084] The types of services supported by each algorithm can be determined. For example, the algorithm's configuration information includes the types of services it supports, and these types can be parsed from the configuration information. Of course, the above is just an example of determining the types of services supported by an algorithm, and there are no restrictions on this method of determination.

[0085] Based on the target business type corresponding to the target data, and the business type supported by each algorithm, an algorithm that supports the target business type can be selected from all algorithms as the target algorithm. For example, if the target business type is face recognition, and algorithm 1 is used to implement face recognition, then the target algorithm can be algorithm 1.

[0086] Method 2: Determine the data channel identifier corresponding to the target data, and select the algorithm corresponding to the data channel identifier from the algorithms supported by the processing device (such as all algorithms) as the target algorithm.

[0087] For example, a mapping relationship between data channels and algorithms is established based on the business types corresponding to the data channels and the business types supported by the algorithms, as shown in Table 1. Clearly, for data channels and algorithms with a mapping relationship, the business type corresponding to the data channel and the business type supported by the algorithm can be the same.

[0088] For example, suppose that the business type corresponding to data channel 1 and data channel 2 is face recognition (that is, the target data received from data channel 1 and data channel 2 needs to be face recognized), and the business type supported by algorithm 1 is face recognition, then establish a mapping relationship between data channel 1, data channel 2 and algorithm 1. Suppose that the business type corresponding to data channel 3 is license plate recognition, and the business type supported by algorithm 2 is license plate recognition, then establish a mapping relationship between data channel 3 and algorithm 2, and so on.

[0089] Table 1

[0090] Data Channel algorithm Data Channel 1, Data Channel 2 Algorithm 1 Data Channel 3 Algorithm 2 … …

[0091] Based on this, after obtaining the target data, we can first determine the target data channel corresponding to the target data. For example, after obtaining the target data from a certain data channel, we can take that data channel as the target data channel corresponding to the target data. Then, by looking up the mapping relationship shown in Table 1, we can obtain the algorithm corresponding to that target data channel and take that algorithm as the target algorithm.

[0092] Step 102: Identify the unused algorithm handles among the created algorithm handles.

[0093] Step 103: Call the processing resources (such as kernel resources and memory resources) corresponding to the unoccupied algorithm handle to execute the target algorithm, so as to process the target data and obtain the algorithm processing result.

[0094] For example, after determining the target algorithm, an unoccupied algorithm handle can be selected from all the created algorithm handles, and the unoccupied algorithm handle can be assigned to the target algorithm, thereby enabling the execution of the target algorithm by calling the processing resources corresponding to the algorithm handle to process the target data.

[0095] By using algorithm handles, the processing resources corresponding to the algorithm handle can be quickly invoked, and the target algorithm can be executed based on the processing resources corresponding to the algorithm handle. This can enable multiple algorithms to rationally invoke the processing resources corresponding to multiple algorithm handles, thereby making reasonable use of the processing device's resources and avoiding resource waste.

[0096] The technical solutions of the embodiments of this application will be described below in conjunction with several specific application scenarios.

[0097] Application Scenario 1: After obtaining the target algorithm, based on the recorded algorithm and algorithm handle allocation relationship, it can be determined whether the target algorithm has an allocated algorithm handle. If the target algorithm does not have an allocated algorithm handle, and there are currently unused algorithm handles, then the unused algorithm handles among the created algorithm handles are identified. That is, an unused algorithm handle is selected from all created algorithm handles and allocated to the target algorithm. Based on this, the processing resources corresponding to the unused algorithm handle can be called to execute the target algorithm to process the target data and obtain the algorithm processing result.

[0098] For example, after executing the target algorithm by calling the processing resource corresponding to the unoccupied algorithm handle, the status of the algorithm handle corresponding to the processing resource called when executing the target algorithm can be updated to occupied, indicating that the processing resource corresponding to this algorithm handle is being occupied and cannot be allocated to other algorithms.

[0099] For example, an allocation relationship can be maintained, which represents the usage relationship between the algorithm and the algorithm handle, and the allocation relationship represents the state of the algorithm handle (such as occupied and unoccupied). See Table 2 for an example of such an allocation relationship. There are no restrictions on the content of this allocation relationship.

[0100] Table 2

[0101] algorithm Algorithm handle state Algorithm 1 Algorithm Handle 2 Already occupied Algorithm 2 Algorithm Handle 4 Already occupied

[0102] As shown in Table 2, when algorithm handle 2 is assigned to algorithm 1, algorithm 1 is currently using the processing resources corresponding to algorithm handle 2, meaning the processing resources corresponding to algorithm handle 2 are currently occupied and cannot be allocated to other algorithms. Similarly, when algorithm handle 4 is assigned to algorithm 2, algorithm 2 is currently using the processing resources corresponding to algorithm handle 4, meaning the processing resources corresponding to algorithm handle 4 cannot be allocated to other algorithms.

[0103] For example, after assigning an algorithm handle to an algorithm, the correspondence between the algorithm and the algorithm handle can be recorded in Table 2, and the state corresponding to the algorithm handle can be updated. See subsequent embodiments for details. After canceling the assignment relationship between the algorithm handle and the algorithm, i.e., reclaiming the algorithm handle assigned to the algorithm, the correspondence between the algorithm and the algorithm handle can be deleted from Table 2. See subsequent embodiments for details.

[0104] In application scenario 1, assuming the target algorithm is algorithm 3, and algorithm 3 does not have any assigned algorithm handles (i.e., algorithm 3 does not occupy any processing resources corresponding to any algorithm handle), an algorithm handle needs to be assigned to algorithm 3. We can then determine if there is an unused algorithm handle among all created algorithm handles (i.e., the processing resources corresponding to that algorithm handle are not occupied). If an unused algorithm handle exists, it is assigned to algorithm 3. That is, one algorithm handle is selected from the unused algorithm handles and assigned to algorithm 3, allowing algorithm 3 to occupy the processing resources corresponding to that algorithm handle. For example, if there is one unused algorithm handle, it is assigned to algorithm 3. If there are at least two unused algorithm handles, one is randomly selected from these at least two and assigned to algorithm 3. In this application scenario, we will use assigning algorithm handle 3 to algorithm 3 as an example.

[0105] After assigning algorithm handle 3 to algorithm 3, the processing resources corresponding to algorithm handle 3 can be called to execute algorithm 3, thereby processing the target data and obtaining the algorithm processing result.

[0106] After assigning algorithm handle 3 to algorithm 3, the correspondence between algorithm 3 and algorithm handle 3 can be recorded, and the status of algorithm handle 3 can be updated to occupied, as shown in Table 3.

[0107] Table 3

[0108] algorithm Algorithm handle state Algorithm 1 Algorithm Handle 2 Already occupied Algorithm 2 Algorithm Handle 4 Already occupied Algorithm 3 Algorithm Handle 3 Already occupied

[0109] Application Scenario 2: After obtaining the target algorithm, the existence of an allocated algorithm handle can be determined based on the recorded algorithm and algorithm handle allocation relationship. If the target algorithm does not have an allocated algorithm handle, and there are currently no unoccupied algorithm handles (i.e., all created algorithm handles are occupied, making it impossible to allocate an algorithm handle for the target algorithm), the target data can be stored in the input queue corresponding to the target algorithm (this input queue is used to store data that needs to be processed by the target algorithm). This continues until an unoccupied algorithm handle is found among all algorithm handles. The unoccupied algorithm handle is then allocated to the target algorithm, thereby calling the processing resources corresponding to the unoccupied algorithm handle to execute the target algorithm to process the target data (i.e., read the target data from the input queue and process the target data) and obtain the algorithm processing result. The specific implementation process can be found in Application Scenario 1 and will not be elaborated here.

[0110] Application Scenario 3: After obtaining the target algorithm, the existence of an allocated algorithm handle can be determined based on the recorded algorithm and algorithm handle allocation relationship. If an allocated algorithm handle exists for the target algorithm, and the processing resources corresponding to the allocated algorithm handle have not been released, the target algorithm can be executed using the processing resources corresponding to the allocated algorithm handle to process the target data and obtain the algorithm processing result.

[0111] In application scenario 3, assuming the target algorithm is algorithm 2, referring to the allocation relationship shown in Table 2, algorithm 2 has an allocated algorithm handle 4, and the state corresponding to algorithm handle 4 is occupied. That is to say, algorithm 2 occupies the processing resource corresponding to algorithm handle 4, and the processing resource corresponding to algorithm handle 4 has not been released. Therefore, there is no need to allocate a new algorithm handle for algorithm 2. Based on this, the processing resource corresponding to algorithm handle 4 can be called to execute algorithm 2, thereby processing the target data and obtaining the algorithm processing result.

[0112] In one possible implementation, for each application scenario, the processing resources corresponding to the algorithm handle can be invoked to execute the target algorithm. For example, the target data can be input to the target algorithm, and the target algorithm can invoke the processing resources (such as the kernel) corresponding to the algorithm handle to process the target data.

[0113] For each algorithm supported by the processing device, the algorithm can correspond to an input queue (which is used to store the data that needs to be processed by the algorithm), that is, there is a one-to-one correspondence between the algorithm and the input queue.

[0114] Based on this, when each target data point needs to be processed by the target algorithm, the target data can be stored in the input queue corresponding to the target algorithm. That is, the input queue can store at least one target data point. The target algorithm calls the processing resource corresponding to the algorithm handle to process the first target data point in the input queue and deletes it from the input queue. After the processing of the target data point is completed, the next target data point in the input queue (which is still the first target data point in the input queue) is processed, and so on, until there is no target data in the input queue, thus completing the processing of all target data.

[0115] In summary, when inputting target data (e.g., target data 1) into the target algorithm, if other target data exists in the input queue of the target algorithm, target data 1 is stored in the input queue of the target algorithm and waits. After the other target data is processed, target data 1 is processed to obtain the algorithm's processing result for target data 1. Conversely, if no other target data exists in the input queue when inputting target data 1 into the target algorithm, no waiting is required, and target data 1 is processed directly.

[0116] In one possible implementation, when the processing resource corresponding to the algorithm handle is invoked to execute the target algorithm, the status of the algorithm handle corresponding to the processing resource invoked when executing the target algorithm is updated to "occupied". This indicates that the processing resource corresponding to this algorithm handle is being occupied and cannot be allocated to other algorithms. See Tables 2 and 3. "Occupied" means that the processing resource corresponding to the algorithm handle is being occupied.

[0117] Furthermore, after executing the target algorithm by calling the processing resource corresponding to the algorithm handle, if it is determined that the target algorithm has finished executing (i.e., there is no target data in the input queue corresponding to the target algorithm, and all target data corresponding to the target algorithm has been processed), the status of the algorithm handle can be updated to unoccupied.

[0118] For example, in application scenario 1, after the target algorithm (i.e., algorithm 3) finishes execution, the state of the algorithm handle 3 corresponding to algorithm 3 can be updated to be unoccupied, as shown in Table 4.

[0119] For example, in application scenario 3, after the target algorithm (i.e., algorithm 2) finishes execution, the state of the algorithm handle 4 corresponding to algorithm 2 can be updated to be unoccupied, as shown in Table 5.

[0120] Table 4

[0121] algorithm Algorithm handle state Algorithm 1 Algorithm Handle 2 Already occupied Algorithm 2 Algorithm Handle 4 Already occupied Algorithm 3 Algorithm Handle 3 Not occupied

[0122] Table 5

[0123] algorithm Algorithm handle state Algorithm 1 Algorithm Handle 2 Already occupied Algorithm 2 Algorithm Handle 4 Not occupied

[0124] For example, after updating the state of the algorithm handle to unoccupied, the processing resources corresponding to the algorithm handle can be released directly. That is, the processing resources corresponding to the algorithm handle are released and can be allocated to other algorithms. In this case, the allocation relationship between the algorithm and the algorithm handle can also be deleted, meaning the algorithm handle becomes an unoccupied algorithm handle, and no algorithm has an allocated algorithm handle. For instance, regarding Table 5, after updating the state of algorithm handle 4 to unoccupied, the processing resources corresponding to algorithm handle 4 are released directly, and the allocation relationship between algorithm 2 and algorithm handle 4 is deleted, as shown in Table 6. Algorithm handle 4 becomes an unoccupied algorithm handle, and the processing resources corresponding to algorithm handle 4 can be allocated to other algorithms. Algorithm 2 does not have an allocated algorithm handle.

[0125] Table 6

[0126] algorithm Algorithm handle state Algorithm 1 Algorithm Handle 2 Already occupied

[0127] For example, after updating the algorithm handle's status to unoccupied, a timer can be set. The timer's duration can be configured empirically and is not limited. If the timer expires, the processing resources corresponding to the algorithm handle can be released, and the allocation relationship between the algorithm and the algorithm handle can be deleted, meaning the algorithm handle becomes an unoccupied algorithm handle.

[0128] It's important to note that before the timer expires, although the algorithm handle is in an unoccupied state (meaning the processing resources corresponding to the algorithm handle are not occupied), these resources are not released and cannot be allocated to other algorithms. Instead, the algorithm handle is reserved for a period of time (the timer's duration). If the target data required for processing by the target algorithm is not obtained within this time, the subsequent timer will time out.

[0129] If target data requiring processing by the target algorithm is obtained within this time period, the timer is deleted, and the implementation process of application scenario 3 is triggered. This means the target algorithm has an allocated algorithm handle, and the processing resources corresponding to that handle have not been released. Therefore, the target algorithm can be executed using the processing resources corresponding to that handle. Furthermore, the status of the algorithm handle can be updated to "occupied," indicating that the processing resources corresponding to this handle are currently occupied and cannot be allocated to other algorithms.

[0130] In one possible implementation, regarding step 103, after executing the target algorithm by calling the processing resource corresponding to the algorithm handle to process the target data and obtain the algorithm processing result, the algorithm processing result can also be sent to the front-end device. For example, front-end device a sends target data 1 to the processing device, and after the processing device obtains the algorithm processing result corresponding to target data 1, it sends the algorithm processing result corresponding to target data 1 back to front-end device a. To implement the above process, the following steps can be used:

[0131] Step S11: Determine the data channel identifier corresponding to the target data and establish a correspondence between the target data and the data channel identifier. For example, the data channel identifier is used to distinguish the data channel transmitting the target data and the corresponding algorithm processing result. The data channel identifier is a unique identifier for the data channel used to receive the target data, and the data channel is the transmission channel between the processing device and the front-end device. That is, the processing device receives the target data through this data channel and sends the algorithm processing result through this data channel.

[0132] For example, after the processing device obtains target data from a certain data channel 1, it can use data channel 1 as the target data channel corresponding to the target data. That is, the data channel identifier corresponding to the target data is the unique identifier of data channel 1, and establish a correspondence between the target data and the unique identifier of data channel 1.

[0133] Step S12: Based on the correspondence between target data and data channel identifiers, determine the correspondence between the algorithm processing result corresponding to the target data and the data channel identifier. For example, since the target data corresponds to the unique identifier of data channel 1, the algorithm processing result corresponding to the target data corresponds to the unique identifier of data channel 1, that is, establish the correspondence between the algorithm processing result and the unique identifier of data channel 1.

[0134] Step S13: Based on the correspondence between the algorithm processing result and the data channel identifier, the algorithm processing result is transmitted through the data channel corresponding to the data channel identifier. For example, after calling the processing resource corresponding to the algorithm handle to execute the target algorithm to process the target data and obtain the algorithm processing result corresponding to the target data (i.e., the result after the target algorithm processes the target data, such as face recognition result, license plate recognition result, etc.), the algorithm processing result is transmitted through data channel 1 based on the correspondence between the algorithm processing result and the data channel identifier, that is, the algorithm processing result is sent to the front-end device through data channel 1.

[0135] In this embodiment, the number of algorithm channels created can also be determined according to the number of kernels. For example, the number of algorithm channels can be the same as the number of kernels. When the number of algorithms supported by the processing device is greater than the number of kernels, the algorithm channels that have already been created can be reused without creating new algorithm channels.

[0136] As can be seen from the above technical solutions, in this embodiment, the number of algorithm handles to be created can be determined based on the number of cores in the processing device. Each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core. Based on this, multiple algorithms can rationally call the processing resources (such as kernels) corresponding to the algorithm handles, thereby rationally using the resources of the processing device, avoiding resource waste, and effectively utilizing the resources of the processing device. The utilization rate of algorithm performance is maximized when the resource consumption of the processing device is minimized, thus improving the processing efficiency of the algorithm. Without wasting resources and ensuring that the number of running paths (i.e., the number of algorithms) is not reduced, algorithms are flexibly allocated according to the number of data channels and resource consumption. The utilization rate of algorithm performance is maximized when resource consumption is minimized, and the algorithm can process data from different data channels, improving processing efficiency. Algorithm handles for different cores are rationally requested for each algorithm based on its resource consumption and processing speed. When the number of algorithms or the number of algorithm channels to be created is greater than the number of cores, based on the technical solution of this embodiment, already created algorithm handles can be reused evenly, or already created algorithm channels can be reused without creating new algorithm channels.

[0137] In one possible implementation, when configuring multiple algorithms, the different algorithms support different service types. For example, algorithm 1 supports service type 1, algorithm 2 supports service type 2, and so on. In this case, there is only one target algorithm for processing the target data. In step 103, the target algorithm is executed by the processing resource corresponding to one algorithm handle to process the target data and obtain the algorithm processing result.

[0138] In another possible implementation, when configuring multiple algorithms, the different algorithms may support the same business type. For example, Algorithm 1 and Algorithm 2 both support business type 1 (i.e., Algorithms 1 and 2 are completely identical, both being machine learning algorithms for facial recognition), Algorithms 3-6 all support business type 2 (i.e., Algorithms 3-6 are completely identical, both being machine learning algorithms for license plate recognition), and so on. In this case, there can be at least two target algorithms for processing the target data; that is, at least one target algorithm can be executed to process the target data and obtain the algorithm processing result.

[0139] When there are at least two target algorithms used to process the target data, the following approach is adopted:

[0140] Case 1: If there are at least two target algorithms, then select one target algorithm from the at least two target algorithms. In step 103, call the processing resources (such as kernel resources and memory resources) corresponding to the algorithm handle to execute the selected target algorithm to process the target data and obtain the algorithm processing result.

[0141] For example, see Figure 2 As shown, Algorithm 1 and Algorithm 2 are identical, both being machine learning algorithms used to implement face recognition. The target data corresponding to data channels 1, 2, 3, and 4 are all target data for face recognition. Therefore, for data channels 1, 2, 3, and 4, the target algorithm corresponding to the target data can be either Algorithm 1 or Algorithm 2. Based on this, assuming Algorithm 1 corresponds to Algorithm Handle 1 (corresponding to Kernel 1) and Algorithm 2 corresponds to Algorithm Handle 2 (corresponding to Kernel 2), then for step 103:

[0142] After obtaining target data 1 from data channel 1, kernel 1 corresponding to algorithm handle 1 can be invoked to execute algorithm 1 to process target data 1, obtain the algorithm processing result of target data 1, and send the algorithm processing result to the front-end device through data channel 1. Alternatively, kernel 2 corresponding to algorithm handle 2 can be invoked to execute algorithm 2 to process target data 1, obtain the algorithm processing result of target data 1, and send the algorithm processing result to the front-end device through data channel 1.

[0143] For example, if the state of algorithm handle 1 is unoccupied and the state of algorithm handle 2 is occupied, then the kernel 1 corresponding to algorithm handle 1 is called to execute algorithm 1 in order to process target data 1.

[0144] Alternatively, if the state of algorithm handle 1 is occupied and the state of algorithm handle 2 is unoccupied, then the kernel 2 corresponding to algorithm handle 2 is called to execute algorithm 2 in order to process target data 1.

[0145] Alternatively, if both algorithm handle 1 and algorithm handle 2 are in the occupied state (and both are in the unoccupied state), then an algorithm (such as algorithm 1) is randomly selected from algorithm 1 and algorithm 2, and kernel 1 corresponding to algorithm handle 1 is called to execute algorithm 1 in order to process target data 1.

[0146] The processing of target data obtained from data channel 2, data channel 3, and data channel 4 is similar to that of target data 1, and will not be repeated here.

[0147] Scenario 2: If there are at least two target algorithms, meaning there are at least two completely identical target algorithms, and each target algorithm includes at least two sub-networks. For example, Algorithm 1 and Algorithm 2 are completely identical. Algorithm 1 includes at least two sub-networks that implement face recognition, and Algorithm 2 includes at least two sub-networks (completely identical to the at least two sub-networks of Algorithm 1) that also implement face recognition. Assuming that the target data corresponding to data channels 1, 2, 3, and 4 all require face recognition, then for data channels 1, 2, 3, and 4, the target algorithm corresponding to the target data of these data channels is either Algorithm 1 or Algorithm 2. Furthermore, assuming that Algorithm 1 corresponds to Algorithm Handle 1 (corresponding to Kernel 1), and Algorithm 2 corresponds to Algorithm Handle 2 (corresponding to Kernel 2).

[0148] See Figure 3 As shown, taking Algorithm 1 and Algorithm 2, both of which include two sub-networks, as an example, Algorithm 1 includes sub-network 11 and sub-network 12, while Algorithm 2 includes sub-network 21 (identical to sub-network 11) and sub-network 22 (identical to sub-network 12). Alternatively, see [link to documentation]. Figure 4 As shown, taking Algorithm 1 and Algorithm 2, both of which include three sub-networks, as an example, Algorithm 1 includes sub-network 11, sub-network 12, and sub-network 13, while Algorithm 2 includes sub-network 21 (identical to sub-network 11), sub-network 22 (identical to sub-network 12), and sub-network 23 (identical to sub-network 13). Regarding the cases where Algorithm 1 and Algorithm 2 include more sub-networks, their implementation process is the same as... Figure 3 or Figure 4 Similarly, this embodiment will not be repeated.

[0149] In the above application scenario, step 103, which involves calling the processing resource corresponding to the algorithm handle to execute the target algorithm, in order to process the target data and obtain the algorithm processing result, may include the following steps:

[0150] Step S21: Select the first target algorithm to be executed from at least two target algorithms.

[0151] For example, after obtaining target data 1 from data channel 1, algorithm 1 or algorithm 2 can be selected as the first target algorithm to be executed. For instance, if the state of algorithm handle 1 corresponding to algorithm 1 is unoccupied, and the state of algorithm handle 2 corresponding to algorithm 2 is occupied, then algorithm 1 is selected as the first target algorithm. If the state of algorithm handle 1 is occupied, and the state of algorithm handle 2 is unoccupied, then algorithm 2 is selected as the first target algorithm. If both algorithm handle 1 and algorithm handle 2 are occupied (and both are unoccupied), then an algorithm (such as algorithm 1) is randomly selected from algorithm 1 and algorithm 2 as the first target algorithm.

[0152] Step S22: Traverse the first sub-network from at least two layers of the first target algorithm and input the target data into the first sub-network. Based on this, call the processing resource corresponding to the unused first algorithm handle (for ease of distinction, the algorithm handle corresponding to the first target algorithm is called the first algorithm handle) to execute the first sub-network to process the target data and obtain intermediate results.

[0153] For example, see Figure 3 or Figure 4 As shown, since the target data 1 needs to be processed through the first-layer sub-network, and algorithm 1 is selected as the first target algorithm, the first-layer sub-network 11 is traversed from at least two layers of the sub-network of algorithm 1 as the first sub-network. Since sub-network 11 belongs to algorithm 1, and algorithm 1 corresponds to algorithm handle 1 (i.e., the first algorithm handle), the processing resource (such as kernel 1) corresponding to algorithm handle 1 is called to execute sub-network 11 to process the target data 1 and obtain intermediate result a.

[0154] It should be noted that Algorithm 1 includes at least two sub-networks. In step S22, only the processing resource corresponding to Algorithm Handle 1 is called to execute sub-network 11, rather than executing all sub-networks of Algorithm 1.

[0155] Step S23: Continue to select a second target algorithm to be executed from at least two target algorithms.

[0156] For example, the second objective algorithm may be different from or the same as the first objective algorithm.

[0157] For example, after obtaining the intermediate result 'a', it is also necessary to determine whether the processing of target data 1 has been completed. If so, the intermediate result 'a' is used as the algorithm processing result corresponding to target data 1. If not, step S23 is executed to select a second target algorithm to be executed from at least two target algorithms.

[0158] See Figure 3 As shown, target data 1 has only passed through the first-layer subnetwork and has not yet passed through the second-layer subnetwork; therefore, the processing of target data 1 is incomplete. Similarly, see... Figure 4 As shown, target data 1 has not yet passed through the sub-networks of the second and third layers; therefore, the processing of target data 1 is not yet complete.

[0159] Regarding step S23, after obtaining the intermediate result 'a', either Algorithm 1 or Algorithm 2 can be used as the second target algorithm to be executed. For example, if the state of Algorithm Handle 1 corresponding to Algorithm 1 is unoccupied, and the state of Algorithm Handle 2 corresponding to Algorithm 2 is occupied, then Algorithm 1 is used as the second target algorithm. If the state of Algorithm Handle 1 is occupied, and the state of Algorithm Handle 2 is unoccupied, then Algorithm 2 is used as the second target algorithm. If the states of both Algorithm Handle 1 and Algorithm Handle 2 are occupied (or unoccupied), then either Algorithm 1 or Algorithm 2 is used as the second target algorithm.

[0160] Step S24: Traverse the second sub-network from at least two layers of the second target algorithm. The second sub-network is a sub-network at a different layer than the first sub-network. Input the intermediate results into the second sub-network. Based on this, call the processing resource corresponding to the unused second algorithm handle (for ease of distinction, the algorithm handle corresponding to the second target algorithm is called the second algorithm handle) to execute the second sub-network to process the intermediate results and obtain the algorithm processing result, that is, the algorithm processing result corresponding to the target data.

[0161] For example, see Figure 3 or Figure 4 As shown, after obtaining the intermediate result 'a', it needs to be processed through a second-layer subnetwork. Assuming Algorithm 2 is selected as the second target algorithm, the second-layer subnetwork 22 is traversed from at least two layers of Algorithm 2's subnetworks. Since subnetwork 22 belongs to Algorithm 2, and Algorithm 2 corresponds to Algorithm Handle 2, the processing resource corresponding to Algorithm Handle 2 is called to execute subnetwork 22 to process the intermediate result 'a' and obtain the intermediate result 'b'.

[0162] For example, after obtaining the intermediate result b, it is also necessary to determine whether the processing of the target data 1 has been completed. If so, the intermediate result b is used as the algorithm processing result corresponding to the target data 1. See [link to relevant documentation]. Figure 3 As shown, target data 1 has passed through the first and second layer subnetworks. Therefore, the processing of target data 1 is complete. Thus, the algorithm processing result corresponding to target data 1 is obtained, namely intermediate result b.

[0163] When determining whether the processing of target data 1 has been completed, if not, proceed to step S25. See also... Figure 4 As shown, target data 1 has not yet passed through the sub-network of the third layer; therefore, the processing of target data 1 is not yet complete.

[0164] Step S25: Continue to select a third target algorithm to be executed from at least two target algorithms.

[0165] For example, the third objective algorithm may be different from or the same as the first objective algorithm. Furthermore, the third objective algorithm may be different from or the same as the second objective algorithm.

[0166] After obtaining the intermediate result b, Algorithm 1 or Algorithm 2 can be used as the third target algorithm to be executed. The implementation method is described in step S23, and will not be repeated here.

[0167] Step S26: Traverse the third subnetwork from at least two layers of the third target algorithm. The third subnetwork is a subnetwork at a different layer from the first subnetwork and a subnetwork at a different layer from the second subnetwork. Input the intermediate results into the third subnetwork. Based on this, call the processing resources corresponding to the unused third algorithm handle (i.e., the algorithm handle corresponding to the third target algorithm) to execute the third subnetwork to process the intermediate results and obtain the algorithm processing result, i.e., the algorithm processing result corresponding to the target data.

[0168] For example, see Figure 4 As shown, after obtaining the intermediate result b, it needs to be processed through a third-layer sub-network. Assuming Algorithm 1 is selected as the third target algorithm, the third-layer sub-network 13 can be obtained by traversing at least two layers of Algorithm 1's sub-networks. Since sub-network 13 belongs to Algorithm 1, and Algorithm 1 corresponds to Algorithm Handle 1, the processing resource corresponding to Algorithm Handle 1 is called to execute sub-network 13 to process the intermediate result b and obtain the intermediate result c.

[0169] After obtaining the intermediate result c, it is necessary to determine whether the processing of target data 1 has been completed. If so, the intermediate result c is used as the algorithm processing result corresponding to target data 1. See also Figure 4 As shown, target data 1 has passed through the first, second, and third layer subnetworks, meaning the processing of target data 1 is complete, yielding the algorithm processing result corresponding to target data 1, i.e., intermediate result c. When determining whether the processing of target data 1 is complete, if not, the above steps are repeated, which will not be elaborated further here.

[0170] In summary, for target data 1 and its intermediate results (such as intermediate result a, intermediate result b, etc.), different processing resources (i.e., kernels) can be used to process the same target data (such as target data 1), thereby improving the processing speed and efficiency. For example, the processing resource corresponding to algorithm handle 1 can be called to process target data 1 and obtain intermediate result a. However, instead of calling the processing resource corresponding to algorithm handle 1 to process intermediate result a, the processing resource corresponding to algorithm handle 2 can be called to process intermediate result a to obtain intermediate result b. This allows different processing resources to be used to process the same target data 1 together.

[0171] In one possible implementation, after obtaining the algorithm processing result corresponding to target data 1, the algorithm processing result can also be sent to the front-end device through the data channel. Regarding how to determine which data channel to return the algorithm processing result to, this embodiment can adopt the following method:

[0172] When the target data 1 is obtained, the data channel identifier corresponding to the target data 1 can also be determined, such as the unique identifier of the data channel 1. In step S22, the target data 1 and the unique identifier of the data channel 1 are input together to the first sub-network. After the processing resource corresponding to the first algorithm handle is called to execute the first sub-network to process the target data 1, the intermediate result a and the unique identifier of the data channel 1 can be obtained.

[0173] In step S24, the intermediate result a and the unique identifier of data channel 1 are input to the second sub-network. After the processing resources corresponding to the second algorithm handle are called to execute the second sub-network to process the intermediate result a, the intermediate result b and the unique identifier of data channel 1 can be obtained.

[0174] against Figure 3 In the application scenario shown, based on the unique identifier of data channel 1, the intermediate result b (i.e. the algorithm processing result corresponding to the target data 1) can be sent to the front-end device through data channel 1.

[0175] against Figure 4 In the application scenario shown, in step S26, the intermediate result b and the unique identifier of data channel 1 are input to the third sub-network. After the processing resource corresponding to the third algorithm handle is invoked to execute the third sub-network to process the intermediate result b, the intermediate result c and the unique identifier of data channel 1 can be obtained. Based on the unique identifier of data channel 1, the intermediate result c (i.e., the algorithm processing result corresponding to target data 1) can be sent to the front-end device through data channel 1.

[0176] The processing of target data obtained from data channel 2, data channel 3, and data channel 4 is similar to that of target data 1, and will not be repeated here.

[0177] Based on the same application concept as the method described above, this application proposes a data processing apparatus configured in a processing device. For details not explained in detail in the following embodiments, please refer to the descriptions in the above embodiments. See also Figure 5 The diagram shown is a structural schematic of a data processing device, which includes:

[0178] Module 51 is used to determine the target algorithm for processing the target data;

[0179] Selection module 52 is used to determine the unoccupied algorithm handles among the created algorithm handles; wherein, the number of algorithm handles created is determined based on the number of cores of the processing device, each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core;

[0180] The processing module 53 is used to call the processing resources corresponding to the unoccupied algorithm handle, execute the target algorithm, process the target data, and obtain the algorithm processing result.

[0181] In one possible implementation, the number of algorithm handles created is the same as the number of cores in the processing device, and each algorithm handle corresponds one-to-one with each core.

[0182] For example, when the selection module 52 determines the unoccupied algorithm handles among the created algorithm handles, it specifically uses the following method: based on the recorded algorithm and algorithm handle allocation relationship, if it is determined that the target algorithm does not have an allocated algorithm handle, then it determines the unoccupied algorithm handles among the created algorithm handles.

[0183] In one possible implementation, the processing module 53 is further configured to, if it is determined that the target algorithm has an allocated algorithm handle and the processing resources corresponding to the allocated algorithm handle have not been released, then use the processing resources corresponding to the allocated algorithm handle to execute the target algorithm to process the target data and obtain the algorithm processing result.

[0184] For example, the processing module 53 is further configured to update the status of the algorithm handle corresponding to the processing resource called when executing the target algorithm to be occupied; after executing the target algorithm to process the target data and obtain the algorithm processing result, if it is determined that the execution of the target algorithm has ended, the status of the occupied algorithm handle is updated to be unoccupied, and the processing resource corresponding to the algorithm handle is released.

[0185] For example, when determining the target algorithm for processing the target data, the determining module 51 is specifically used to: determine the target service type corresponding to the target data, and select an algorithm that supports the target service type from the algorithms supported by the processing device as the target algorithm; or, determine the data channel identifier corresponding to the target data, and select an algorithm corresponding to the data channel identifier from the algorithms supported by the processing device as the target algorithm.

[0186] For example, the determining module 51 is further configured to determine a data channel identifier corresponding to the target data and establish a correspondence between the target data and the data channel identifier; the data channel identifier is used to distinguish the data channels that transmit the target data and the corresponding algorithm processing results; based on the correspondence between the target data and the data channel identifier, the correspondence between the algorithm processing results corresponding to the target data and the data channel identifier is determined; the processing module 53 is further configured to transmit the algorithm processing results through the data channel corresponding to the data channel identifier based on the correspondence between the algorithm processing results and the data channel identifier.

[0187] For example, if there are at least two identical target algorithms, and each target algorithm includes at least two sub-networks, the processing module 53, when calling the processing resources corresponding to the unoccupied algorithm handle to execute the target algorithm, specifically performs the following steps: selecting a first target algorithm to be executed from the at least two target algorithms; traversing the first sub-network from the at least two sub-networks of the first target algorithm and inputting the target data into the first sub-network; calling the processing resources corresponding to the unoccupied first algorithm handle to execute the first sub-network to process the target data and obtain an intermediate result; continuing to select a second target algorithm to be executed from the at least two target algorithms; wherein the second target algorithm is different from or the same as the first target algorithm; traversing the second sub-network from the at least two sub-networks of the second target algorithm, wherein the second sub-network is a sub-network of a different layer from the first sub-network; inputting the intermediate result into the second sub-network; calling the processing resources corresponding to the unoccupied second algorithm handle to execute the second sub-network to process the intermediate result and obtain the algorithm processing result.

[0188] Based on the same application concept as the above method, this application also proposes an electronic device (i.e., the processing device of the above embodiments), which may include: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the data processing method disclosed in the above examples of this application.

[0189] Based on the same concept as the above method, this application also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the data processing method disclosed in the above examples of this application.

[0190] The aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0191] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which can take the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0192] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0193] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0194] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0195] Furthermore, these computer program instructions can also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in the process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0196] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0197] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A data processing method, characterized in that, The method is applied to a processing device, wherein multiple algorithm handles have been pre-created in the processing device. The number of algorithm handles created is determined based on the number of cores in the processing device. Each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core. The number of algorithm handles created is the same as the number of cores in the processing device, and each algorithm handle corresponds one-to-one with each core. The method includes: Determine the target algorithm for processing the target data; wherein, the target algorithm is a machine learning algorithm; Identify any unused algorithm handles among the created algorithm handles; The processing resources corresponding to the unoccupied algorithm handle are invoked to execute the target algorithm, so as to process the target data and obtain the algorithm processing result; The determination of the target algorithm for processing the target data includes: Determine the target service type corresponding to the target data, and select an algorithm that supports the target service type from the algorithms supported by the processing device as the target algorithm; wherein, a mapping relationship between service types and data channels is pre-configured, and after obtaining the target data from the data channel, the service type corresponding to the data channel is determined as the target service type corresponding to the target data; or, Determine the data channel identifier corresponding to the target data, and select the algorithm corresponding to the data channel identifier from the algorithms supported by the processing device as the target algorithm.

2. The method according to claim 1, characterized in that, The process of identifying unused algorithm handles among the created algorithm handles includes: Based on the recorded algorithm and algorithm handle allocation relationship, if it is determined that the target algorithm does not have an allocated algorithm handle, then the unused algorithm handles among the created algorithm handles are identified.

3. The method according to claim 2, characterized in that, The method further includes: If it is determined that the target algorithm has an allocated algorithm handle, and it is determined that the processing resources corresponding to the allocated algorithm handle have not been released, then the target algorithm is executed using the processing resources corresponding to the allocated algorithm handle to process the target data and obtain the algorithm processing result.

4. The method according to claim 1, characterized in that, The method further includes: updating the status of the algorithm handle corresponding to the processing resource called when executing the target algorithm to be occupied; After executing the target algorithm to process the target data and obtain the algorithm processing result, the method further includes: if it is determined that the execution of the target algorithm has ended, updating the status of the occupied algorithm handle to unoccupied and releasing the processing resources corresponding to the algorithm handle.

5. The method according to claim 1, characterized in that, The method further includes: Determine the data channel identifier corresponding to the target data and establish a correspondence between the target data and the data channel identifier; wherein, the data channel identifier is used to distinguish the data channel that transmits the target data and the corresponding algorithm processing result; Based on the correspondence between the target data and the data channel identifier, the correspondence between the algorithm processing result corresponding to the target data and the data channel identifier is determined; Based on the correspondence between the algorithm processing result and the data channel identifier, the algorithm processing result is transmitted through the data channel corresponding to the data channel identifier.

6. The method according to any one of claims 1-5, characterized in that, If at least two identical target algorithms exist, and the target algorithm comprises at least two sub-networks, the step of calling the processing resource corresponding to the unoccupied algorithm handle to execute the target algorithm includes: Select a first target algorithm to be executed from the at least two target algorithms; The first sub-network is traversed from at least two sub-networks of the first target algorithm, and the target data is input into the first sub-network; the processing resources corresponding to the unoccupied first algorithm handle are invoked to execute the first sub-network to process the target data and obtain intermediate results; Continue by selecting a second target algorithm to be executed from the at least two target algorithms; wherein the second target algorithm is different from or the same as the first target algorithm; The second subnetwork is derived from at least two layers of the second target algorithm, wherein the second subnetwork is a subnetwork at a different layer than the first subnetwork; the intermediate result is input into the second subnetwork; the processing resource corresponding to the unused second algorithm handle is invoked to execute the second subnetwork to process the intermediate result and obtain the algorithm processing result.

7. A data processing apparatus, characterized in that, Configured on a processing device, the processing device has pre-created multiple algorithm handles, the number of algorithm handles created is determined based on the number of cores of the processing device, each algorithm handle is used to identify a group of processing resources, and each group of processing resources includes at least one core; The number of algorithm handles created is the same as the number of cores in the processing device, and each algorithm handle corresponds one-to-one with each core; the device includes: A determination module is used to determine the target algorithm for processing the target data; wherein the target algorithm is a machine learning algorithm; The selection module is used to identify unused algorithm handles among the created algorithm handles; The processing module is used to call the processing resources corresponding to the unoccupied algorithm handle, execute the target algorithm, process the target data, and obtain the algorithm processing result; Specifically, when determining the target algorithm for processing the target data, the determining module is used to: Determine the target service type corresponding to the target data, and select an algorithm that supports the target service type from the algorithms supported by the processing device as the target algorithm; wherein, the mapping relationship between service types and data channels is pre-configured, and after obtaining the target data from the data channel, the service type corresponding to the data channel is determined as the target service type corresponding to the target data; or, Determine the data channel identifier corresponding to the target data, and select the algorithm corresponding to the data channel identifier from the algorithms supported by the processing device as the target algorithm.

8. The apparatus according to claim 7, Its features are, in, When the selection module determines the unoccupied algorithm handles among the created algorithm handles, it is specifically used to: based on the recorded algorithm and algorithm handle allocation relationship, if it is determined that the target algorithm does not have an allocated algorithm handle, then determine the unoccupied algorithm handles among the created algorithm handles; The processing module is further configured to, if it is determined that the target algorithm has an allocated algorithm handle and the processing resources corresponding to the allocated algorithm handle have not been released, then use the processing resources corresponding to the allocated algorithm handle to execute the target algorithm to process the target data and obtain the algorithm processing result. The processing module is further configured to update the status of the algorithm handle corresponding to the processing resource called when executing the target algorithm to be occupied; and, after executing the target algorithm to process the target data and obtain the algorithm processing result, if it is determined that the execution of the target algorithm has ended, update the status of the occupied algorithm handle to be unoccupied and release the processing resource corresponding to the algorithm handle. The determining module is further configured to determine a data channel identifier corresponding to the target data and establish a correspondence between the target data and the data channel identifier; wherein the data channel identifier is used to distinguish the data channels transmitting the target data and the corresponding algorithm processing results; based on the correspondence between the target data and the data channel identifier, a correspondence between the algorithm processing results corresponding to the target data and the data channel identifier is determined; the processing module is further configured to transmit the algorithm processing results through the data channel corresponding to the data channel identifier based on the correspondence between the algorithm processing results and the data channel identifier; If at least two identical target algorithms exist, and each target algorithm comprises at least two sub-networks, the processing module, when executing the target algorithm by calling the processing resources corresponding to the unoccupied algorithm handle, specifically performs the following steps: selecting a first target algorithm to be executed from the at least two target algorithms; traversing the first sub-network from the at least two sub-networks of the first target algorithm and inputting the target data into the first sub-network; calling the processing resources corresponding to the unoccupied first algorithm handle and executing the first sub-network to process the target data and obtain an intermediate result; continuing to select a second target algorithm to be executed from the at least two target algorithms; wherein the second target algorithm is different from or the same as the first target algorithm; traversing the second sub-network from the at least two sub-networks of the second target algorithm, wherein the second sub-network is a sub-network of a different layer from the first sub-network; inputting the intermediate result into the second sub-network; and calling the processing resources corresponding to the unoccupied second algorithm handle and executing the second sub-network to process the intermediate result and obtain the algorithm processing result.

9. An electronic device, characterized in that, include: A processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; The processor is configured to execute the machine-executable instructions to implement the method of any one of claims 1-6.

10. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions that can be executed by a processor; wherein the processor is configured to execute the machine-executable instructions to implement the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Method and device for releasing service in Internet protocol multimedia system (IMS)

    CN103068069A