Data processing method, device, electronic device and storage medium
By grouping and allocating memory resources to the process nodes of the computing task, the memory usage problem caused by the large number of process nodes is solved, and the execution performance of the computing task is improved.
Patent Information
- Application Number
- CN202111225008.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-20
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2041-10-20
AI Technical Summary
In computing tasks, the flowchart contains more process nodes that occupy a large amount of memory resources, resulting in a degradation of device operation performance.
By obtaining the configuration information of the computing task, constructing a task flow chart, grouping process nodes, allocating memory resources, and realizing memory resource reuse in process nodes.
It saves memory resources consumed during the execution of computing tasks and improves the operating performance of the device when executing computing tasks.
Smart Images

Figure CN114327856B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art
[0002] Currently, developers can implement process deployment in computing tasks by configuring flowcharts. For example, the execution flowchart of a model computing task based on an AI (Artificial Intelligence) model can be configured to call the corresponding AI model for task processing. However, when processing tasks according to a flowchart, if the flowchart contains more process nodes, a large amount of memory resources will be occupied, resulting in reduced device performance when executing computing tasks. Therefore, how to save memory resources consumed during the execution of computing tasks has become an urgent problem to be solved. Summary of the invention
[0003] The embodiments of the present application provide a data processing method, device, electronic device and storage medium, which can save memory resources consumed during the execution of computing tasks, thereby improving the operating performance of the device when executing computing tasks.
[0004] On the one hand, an embodiment of the present application provides a data processing method, the method comprising:
[0005] Obtain configuration information of a computing task; the configuration information includes N task nodes that execute the computing task and the data flow between the N task nodes, where N is a positive integer;
[0006] Constructing a task flow chart of the computing task according to the N task nodes and the data flow between the N task nodes; the flow nodes in the task flow chart include the N task nodes;
[0007] Traversing the process nodes in the task flow graph, and grouping the process nodes in the task flow graph according to the traversal result to obtain M process node groups; M is a positive integer, and one process node group contains at least one process node of the task flow graph;
[0008] Allocate memory resources to each process node group in the M process node groups;
[0009] According to the memory resources respectively allocated to each process node group, task processing is performed on the process nodes in each process node group to obtain the task calculation result of the calculation task.
[0010] On the one hand, an embodiment of the present application provides a data processing device, the device comprising:
[0011] An acquisition module is used to acquire configuration information of a computing task; the configuration information includes N task nodes that execute the computing task and the data flow between the N task nodes, where N is a positive integer;
[0012] A construction module, used for constructing a task flow chart of a computing task according to N task nodes and data flows between the N task nodes; the flow nodes in the task flow chart include N task nodes;
[0013] A grouping module, used for traversing the process nodes in the task flow chart, and grouping the process nodes in the task flow chart according to the traversal results to obtain M process node groups; M is a positive integer, and one process node group contains at least one process node of the task flow chart;
[0014] An allocation module, used for allocating memory resources to each process node group in the M process node groups;
[0015] The processing module is used to perform task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group, so as to obtain the task calculation result of the calculation task.
[0016] On the one hand, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute some or all of the steps in the above method.
[0017] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program includes program instructions, which, when executed by a processor, are used to execute some or all of the steps in the above method.
[0018] Accordingly, according to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program comprising program instructions, the program instructions being stored in a computer-readable storage medium. A processor of a computer device reads the program instructions from the computer-readable storage medium, and the processor executes the program instructions, so that the computer device performs the data processing method provided above.
[0019] In the embodiment of the present application, the configuration information of the computing task can be obtained, and the task flow chart of the computing task can be constructed according to the data flow between N task nodes and N task nodes, the process nodes in the task flow chart are traversed, and the process nodes in the task flow chart are grouped according to the traversal results to obtain M process node groups, and memory resources are allocated to each process node group in the M process node groups. According to the memory resources respectively allocated to each process node group, task processing is performed on the process nodes in each process node group to obtain the task calculation result of the computing task. By implementing the method proposed above, the process nodes in the task flow chart can be grouped, and memory resources can be allocated to each process node group, so that the allocated memory resources can be reused in each process node group, thereby saving the memory resources consumed in the execution of the computing task, and improving the equipment operation performance when executing the computing task. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0021] Figure 1a A schematic diagram of an application architecture provided for an embodiment of the present application;
[0022] Figure 1b A schematic diagram of an application architecture provided for an embodiment of the present application;
[0023] Figure 2 A flowchart of a data processing method provided in an embodiment of the present application;
[0024] Figure 3 A schematic diagram of a branch node provided in an embodiment of the present application;
[0025] Figure 4a A schematic diagram of a scenario for grouping task flow charts provided in an embodiment of the present application;
[0026] Figure 4b A schematic diagram of a scenario for grouping task flow charts provided in an embodiment of the present application;
[0027] Figure 5 A flowchart of a data processing method provided in an embodiment of the present application;
[0028] Figure 6 A schematic diagram of a cyclic task processing scenario provided in an embodiment of the present application;
[0029] Figure 7a A schematic diagram of a computing task processing scenario provided in an embodiment of the present application;
[0030] Figure 7b A schematic diagram of a computing task processing scenario provided in an embodiment of the present application;
[0031] Figure 7c A schematic diagram of a computing task processing scenario provided in an embodiment of the present application;
[0032] Figure 7d A schematic diagram of a computing task processing scenario provided in an embodiment of the present application;
[0033] Figure 8 A schematic diagram of a data processing framework provided in an embodiment of the present application;
[0034] Figure 9a A schematic diagram of a model-based task flow chart provided in an embodiment of the present application;
[0035] Figure 9b A schematic diagram of a model-based task flow chart provided in an embodiment of the present application;
[0036] Fig.10 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0037] Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0039] The data processing method proposed in the embodiment of the present application is implemented in an electronic device, which can be a server or a terminal. Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this.
[0040] The embodiments of the present application relate to the field of artificial intelligence technology. Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making. For example, the technical solution of this application can realize the process deployment of relevant AI models in this technical field.
[0041] The embodiments of the present application may involve technical fields related to cloud technology, such as the field of cloud computing technology, in which cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, expanded at any time, and paid for by use. As a basic capability provider for cloud computing, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices. For example, the technical solution of the present application can realize task processing of process nodes through computing devices in the cloud computing resource pool.
[0042] In some embodiments, see Figure 1a , Figure 1a The following is a schematic diagram of an application architecture provided in an embodiment of the present application. The data processing method proposed in the present application can be executed through the application architecture. Figure 1a As shown, Figure 1aIt may include an electronic device and at least one computing device (here it is set to 3 computing devices, but there is no actual limit on the number of computing devices). The electronic device may construct a task flow chart of the computing task according to the configuration information of the computing task, and group the process nodes in the task flow chart to obtain M process node groups, and determine a target computing device in at least one computing device (set to be the second computing device), and allocate memory resources to each process node group according to the memory resources of the target computing device. Subsequently, the electronic device may perform task processing on the process nodes in each process node group according to the memory resources allocated to each process node group in the target computing device, and obtain the task calculation result of the computing task. Therefore, based on Figure 1a , the electronic device and the computing device are different devices. Optionally, the computing device may be a terminal device or a server.
[0043] In some embodiments, if the computing device is one, the computing device may be another device independent of the electronic device, or may be the same device as the electronic device. Figure 1b As shown, after the electronic device generates a task flow chart and obtains M process node groups based on the task flow chart, it can allocate memory resources to each process node group based on the electronic device's own memory resources, so as to perform task processing on the process nodes in each process node group according to the memory resources allocated to each process node group in the electronic device to obtain the task calculation results.
[0044] Understandably, Figure 1a and Figure 1b It is only an exemplary representation of the possible application architecture of the technical solution of the present application, and does not limit the specific architecture of the technical solution of the present application, that is, the technical solution of the present application can also provide other forms of application architecture.
[0045] Optionally, in some embodiments, the electronic device can execute the data processing method according to actual business needs to save memory resources consumed during the execution of computing tasks. The technical solution of the present application can be applied to any process deployment scenario for executing computing tasks, that is, the electronic device can group the task flow chart of the computing task, allocate memory resources to each process node group in the obtained M process node groups, and perform task processing for the computing task on the process nodes in each process node group according to the allocated memory resources.
[0046] For example, the technical solution of the present application can be applied to the process deployment scenario of executing AI model computing tasks. If the AI model is an image processing model, the image processing model can be called according to the memory resources allocated to each process node group to perform image processing on the initial image of the AI model computing task, and the task calculation result corresponding to the AI model computing task is obtained, that is, the image after the initial image is processed. For another example, the technical solution of the present application can be applied to the process deployment scenario of executing data analysis tasks. If the data analysis task includes processes such as indicator data processing and indicator data analysis, the memory resources allocated to each process node group can be used to perform task processing on the indicator data corresponding to the input data of the process nodes in each process node group, and the analysis result (i.e., task calculation result) on the indicator data can be obtained.
[0047] Optionally, the data involved in this application, such as configuration information of computing tasks, can be stored in a database, or can be stored in a blockchain, such as through a blockchain distributed system, which is not limited in this application.
[0048] It is understood that the above scenarios are only examples and do not constitute a limitation on the application scenarios of the technical solutions provided in the embodiments of the present application. The technical solutions of the present application can also be applied to other scenarios. For example, it is known to those skilled in the art that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0049] Based on the above description, the present application embodiment proposes a data processing method, which can be executed by the electronic device mentioned above. Figure 2 , Figure 2 A flow chart of a data processing method provided in an embodiment of the present application. Figure 2 As shown, the process of the data processing method of the embodiment of the present application may include the following:
[0050] S201. Obtain configuration information of a computing task.
[0051] The configuration information may include N task nodes that execute computing tasks and the data flow between the N task nodes, where N is a positive integer.
[0052] In one possible implementation, the computing task may be any data processing task, for example, it may be an image processing task based on an image processing model, that is, it is used to call the image processing model to process the input initial image to obtain the processed image; it may also be an indicator data analysis task, that is, it is used to analyze the input indicator data to obtain the indicator data analysis result, etc. There is no restriction on the computing task here. Accordingly, the N task nodes in the computing task are task nodes configured for executing specific steps in the computing task, and the method for executing the specific steps is defined in the task node. For example, an image processing task based on an image processing model may include a task node for calling the image processing model, that is, the task node defines a method for calling the image processing model to process the input data of the task node.
[0053] It can also be understood that the N task nodes are determined according to the execution process in the computing task. For example, the execution process in the computing task includes feature extraction steps, feature fusion steps and feature prediction steps. A corresponding task node can be defined for each of the aforementioned steps. The task node contains a specific method for executing the corresponding step. Therefore, after the data is input into the task node, the task node will output the task processing result obtained after executing the indicated steps (i.e., performing task processing) on the input data.
[0054] In some embodiments, assume that N task nodes include the i-th task node and the j-th task node, i is not equal to j, and i and j are both positive integers less than or equal to N; the configuration information of the computing task may include a data flow direction from the i-th task node to the j-th task node, and the data flow direction is used to indicate that the task processing result of the i-th node is the input of the j-th task node.
[0055] Optionally, the configuration personnel (such as developers) can write a configuration file through the execution process of the computing task (also known as the functional modules required for the computing task). Therefore, the configuration information can be compiled from the configuration file, or it can be generated by the configuration personnel by configuring N task nodes according to the node configuration interface provided by the electronic device.
[0056] S202: construct a task flow chart of the computing task according to the N task nodes and the data flow between the N task nodes.
[0057] Among them, the process nodes in the task flow chart include N task nodes.
[0058] In some embodiments, the electronic device can obtain N task nodes based on the definition of the computing task according to the configuration information, and the N task nodes can have different functions, such as feature extraction function, feature prediction function, etc. In the task flow chart constructed by the electronic device according to the data flow between the N task nodes and the N task nodes, different task nodes are connected by input streams and output streams, that is, if there is a data flow from the i-th task node to the j-th task node, then the output stream of the i-th task node is the input stream of the j-th task node, and the input stream of each task node can be an input queue (also known as an input data buffer), which can store multiple data sets (i.e., input data) flowing in with different timestamps. The task node can have one or more data flows pointing to other task nodes. In particular, if the task node does not have a data flow pointing to the task node, the task node is a source node, that is, there is no input stream, only a node with an output stream, and the source node does not have input data, but the source node can be task processed to output data, for example, the task processing corresponding to the source node is to generate a random number, then the random number (task processing result) can be obtained by task processing the source node and output to the post-task node of the source node.
[0059] In addition, after one or more data sets to be processed are processed in turn according to the task flow chart, the input stream enters the task node and performs the task processing indicated by the task node (i.e., performs calculations on the input data that flows in), obtains the task processing result, and the output stream flows into the subsequent task node, so that pipeline operation can be realized. Also, after the task flow chart is constructed, the task flow chart can be visualized and sent to the configuration personnel (such as developers) corresponding to the configuration information for confirmation, which can improve the observability of the computing task, and when the configuration information of the computing task needs to be modified, the electronic device can only update the task node to be modified in the task flow chart, which can improve the update efficiency of the execution process of the computing task. Through the task flow chart, the dependency relationship between N task nodes, i.e., the predecessor task node and the successor task node of the task node, can be determined, and the subsequent process node grouping operation can be performed according to the dependency relationship.
[0060] S203, traversing the process nodes in the task flow chart, and grouping the process nodes in the task flow chart according to the traversal result to obtain M process node groups.
[0061] Wherein, M is a positive integer, a process node group includes at least one process node of the task flow chart, and the process nodes in the task flow chart include N task nodes.
[0062] In one possible implementation, the process node in the task flow chart includes a branch node, N task nodes include the kth task node, and the branch node is generated when the configuration information includes the data flow direction of the kth task node pointing to multiple task nodes in the N task nodes, and the input and output of the branch node are the task processing results of the kth task node, and the output of the branch node is the input of multiple task nodes. That is, the branch node can refer to a task node with multiple data flows pointing to other task nodes. The branch node can include a method for judging the task processing result of the input kth task node to determine the incoming task node, such as the branch node can be the task processing result obtained to be passed to each task node in the multiple task nodes, or it can be passed to the node to be passed in that meets the preset conditions in the multiple task nodes, and the node to be passed in can be one or more task nodes in the multiple task nodes. For example, the preset condition is that when the value indicated in the task processing result is greater than or equal to the preset threshold, the task processing result is passed to task node 1, and when the indicated value is less than the preset threshold, the task processing result is passed to task node 2.
[0063] For example, Figure 3 As shown, Figure 3 A branch node schematic diagram is provided for an embodiment of the present application, wherein, if the k-th task node has a data flow pointing to multiple task nodes, a branch node will be generated for determining to which task node the task processing result of the k-th task node flows, that is, the branch node of the k-th task node is connected to the multiple task nodes, and the branch node points to the multiple task nodes.
[0064] Therefore, the electronic device traverses the process nodes in the task flow chart, and groups the process nodes in the task flow chart according to the traversal results to obtain M process node groups. Specifically, the process nodes in the task flow chart are traversed in turn. If a branch node is traversed, a target task node among multiple task nodes is added to the first process node group. If a task node other than multiple task nodes among N task nodes is traversed, all the traversed task nodes are added to the first process node group, and the task nodes other than the target task node among the multiple task nodes are determined as independent task nodes, and a second process node group to which the independent task nodes belong is generated. The first process node group and the second process node group are determined as M process node groups. That is, the electronic device can adopt the idea of depth-first search (DFS), and use the task nodes included in the longest path traversed in the task flow chart as the first process node group. If the task nodes included in the longest path have one or more branch nodes, then the task nodes connected to each branch node except those added to the first process node group (i.e., the task nodes other than the target task node among the multiple task nodes connected to the branch node) are sequentially used as independent task nodes, and a second process node group to which the independent task nodes belong is generated. And within each process node group, the electronic device will not perform task processing on the process nodes in the same process node group at the same time.
[0065] In some embodiments, there may be one or more independent task nodes, and each independent task node may generate a second process node group to which it belongs. The process and principle of generating the second process node group to which each independent task node belongs are the same. Therefore, the process of generating a second process node group to which an independent task node belongs is used as an example for explanation. Specifically, the electronic device generates the second process node group to which the independent task node belongs by taking the independent task node as the target starting point, and traversing the task flow chart with the target starting point in sequence, obtaining the longest path starting from the target starting point as the target path, and taking the task nodes contained in the target path as the second process node group. If the target path contains a branch node, the remaining task nodes are grouped according to the above-mentioned grouping method when traversing to the branch node, thereby obtaining M process node groups corresponding to the task flow chart.
[0066] For example, Figure 4a-4b As shown, Figure 4a-4b A schematic diagram of a scenario for grouping task flow charts provided in an embodiment of the present application, wherein: Figure 4a (1) is a task flow chart. The nodes in the task flow chart are traversed in sequence, and the task nodes contained in the longest traversed path are added to the first process node group, such as Figure 4a(2); In the longest path, if there is a branch node 1, the task nodes connected to the branch node 1 except the task nodes added to the first process node group are taken as independent task nodes, that is, task node 3 is taken as an independent task node, and task node 3 is taken as the target starting point. Figure 4b (1)( Figure 4b (1) is the part of the task flow chart except the first process node group) and starts traversing to obtain the target path starting with task node 3 as the second process node group to which task node 3 belongs, such as Figure 4b (2) as shown; in the target path, there is a branch node 2, then according to the above method, the task nodes connected to the branch node 2 except the task nodes added to the second process node group are taken as independent task nodes, that is, task node 7 is taken as an independent task node, and traversal is performed with task node 7 as the target starting point to obtain the second process node group to which task node 7 belongs, and the second process node group to which task node 7 belongs includes task node 7; thereby, M process node groups corresponding to the task flow chart are obtained.
[0067] Optionally, grouping the process nodes in the task flow chart may be grouping each process node, or grouping the process nodes with specified functions based on the functions of the process nodes. For example, an image processing task based on an image processing model includes R process nodes, and the R process nodes include W task nodes that call the image processing model. That is, the R process nodes may be grouped, or only the W task nodes that call the image processing model may be grouped.
[0068] S204. Allocate memory resources to each of the M process node groups.
[0069] In some embodiments, after obtaining M process node groups, the electronic device can allocate memory resources to each process node group, and the process nodes within each process node group reuse the allocated memory resources, thereby saving memory resource overhead when executing computing tasks, improving device memory resource utilization, and avoiding the problem of reduced device operating performance due to a large amount of memory resources being occupied during execution.
[0070] In one possible implementation, the electronic device allocates memory resources to each process node group specifically by determining the amount of memory resources required to be allocated to each process node group based on the amount of node memory resources corresponding to each process node in each process node group, and allocates memory resources to each process node group according to the amount of memory resources required to be allocated to each process node group. The specific implementation process of allocating memory resources to each process node group can refer to the relevant description in the following steps S504-S506. Optionally, before allocating memory resources, the electronic device will additionally generate a memory allocation node (which may be called MemoryAllocator) in the task flow chart. The memory allocation node is a source node. When the electronic device inputs a new timestamp data set into the task flow chart, the target computing device can be selected and memory resources can be allocated through the memory allocation node.
[0071] S205 . According to the memory resources respectively allocated to each process node group, task processing is performed on the process nodes in each process node group to obtain task calculation results of the calculation tasks.
[0072] In one possible implementation, when the electronic device performs task processing on the process nodes in each process node group, the same memory resources are shared within a process node group, and the process nodes of a process node group have dependencies but do not run at the same time, so the memory resources are accessed by a process node in the process node group at the same time. After performing task processing on the process nodes in the task flow chart in turn, the final task processing result is output, and the final task processing result is the task calculation result of the computing task. It can be understood that performing task processing on the process node is to perform the data processing method indicated by the process node on the data in the process node (task node) to obtain the corresponding task processing result. The data in the process node can be data transmitted by the electronic device, or it can be the task processing result input by the preceding task node, or it can be data existing in the process node itself.
[0073] In some embodiments, the above-mentioned computing tasks may be computing tasks applied to AI models such as image recognition, natural language processing, and recommendation algorithms. Configuration personnel may deploy and configure configuration information for defining multiple task nodes according to the processing flow of the computing tasks, and the electronic device may implement rapid deployment of the computing task flow based on the configuration information. For example, the computing task may be an image processing task based on an image processing model, and the electronic device performs task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group, and obtains the task calculation result of the computing task, which may specifically be to obtain the initial image of the image processing task, call the image processing model to perform image processing on the initial image according to the memory resources respectively allocated to each process node group, obtain the image after the image processing of the initial image, and determine the image after the image processing of the initial image as the task calculation result of the image processing task.
[0074] In the embodiment of the present application, the electronic device can obtain the configuration information of the computing task, construct the task flow chart of the computing task according to the data flow between N task nodes and N task nodes, traverse the process nodes in the task flow chart, and group the process nodes in the task flow chart according to the traversal results to obtain M process node groups, allocate memory resources to each process node group in the M process node groups, and perform task processing on the process nodes in each process node group according to the memory resources allocated to each process node group, so as to obtain the task calculation result of the computing task. By implementing the method proposed above, the process nodes in the task flow chart can be grouped, and memory resources can be allocated to each process node group, so that the allocated memory resources can be reused in each process node group, thereby saving the memory resources consumed in the execution of the computing task, and improving the equipment operation performance when executing the computing task.
[0075] See also Figure 5 , Figure 5 The following is a flow chart of a data processing method provided in an embodiment of the present application, which can be executed by the electronic device mentioned above. Figure 5 As shown, the process of the data processing method in the embodiment of the present application may include the following:
[0076] S501. Obtain configuration information of a computing task.
[0077] In some embodiments, N task nodes include the vth task node and the uth task node, and both v and u are positive integers less than or equal to N. If the configuration information includes loop calculation configuration information between the vth task node and the uth task node, then the task processing result of the uth task node within the loop calculation times indicated by the loop calculation configuration information is the input of the vth task node. Therefore, within the loop times, the task processing result of the uth task node is the input of the vth task node, and after performing loop task processing for the specified loop times, the task processing result of the uth task node is the input of the task nodes connected to the uth task node except the ith task node.
[0078] Therefore, the u-th task node has at least two data flows pointing to other task nodes, that is, a corresponding branch node will be generated to assist in realizing the cyclic task processing function of the computing task. That is, the number of cycles can be determined by the branch node, such as directly specifying the number of cycles in the branch node in the configuration information, or configuring the loop condition, that is, when the task processing result of the u-th task node meets the loop condition, the branch node connected to the u-th task node continues to pass the task processing result to the v-th task node until the task processing result does not meet the loop condition. Optionally, the v-th task node and the u-th task node can be the same task node or different task nodes. Based on the task flow chart, if there are multiple repeated task processings in the computing task (such as cyclic task processing or multiple identical task nodes), node reuse can be achieved by defining multiple corresponding task nodes or corresponding data flows, improving the reuse rate of the task node implementation code, and reducing the workload of the execution process deployment.
[0079] For example, Figure 6 As shown, Figure 6A schematic diagram of a scenario of cyclic task processing provided for an embodiment of the present application, wherein the vth task node and the uth task node are the same task node, the vth task node includes two input streams, in a cycle, the vth task node obtains a first data set as input from the first input stream, and obtains a second data set as input from the second input stream, and performs task processing indicated by the vth task node on the first data set and the second data set in the vth task node to obtain the task processing result of the vth task node and pass it into a branch node, the branch node determines that the task processing result meets the loop condition, and then passes the task processing result into the second input stream as the second data set input at this time, and then the vth task node continues to perform task processing on the first data set in the previous first input stream and the second data set in the second input stream at this time, to obtain the task processing result of the vth task node and pass it into the branch node, the branch node determines whether to continue the cyclic task processing, and if the branch node determines not to perform the cyclic task processing, it outputs it through the output stream of the branch node.
[0080] In some embodiments, based on Figure 6 There are two types of input streams for task nodes in implementing cyclic task processing. One type of input stream is Figure 6 The first input stream in the loop, that is, the data set for task processing in the loop is the same data set, that is, in a loop, the same input data set is always used (such as Figure 6 The first data set in the input stream is taken out only after the cycle ends. Another input stream type is Figure 6 The second input stream in the loop, that is, the data set for task processing in the loop is a different data set, that is, in a loop, the re-input data set (such as Figure 6 The second data set in the task flow chart). Therefore, the input stream type of the first input stream is also a storage input stream, and the input stream type of the second input stream is also called a cyclic input stream. The cyclic input stream is the input stream when there is repeated input in a task node. After generating the task flow chart, the electronic device can traverse the input stream of the task flow chart, determine the type of the input stream, and identify the input stream to determine how to obtain the data set in the input stream of the task node when executing the computing task.
[0081] S502: construct a task flow chart of the computing task according to the N task nodes and the data flow between the N task nodes.
[0082] S503, traversing the process nodes in the task flow chart, and grouping the process nodes in the task flow chart according to the traversal results to obtain M process node groups. The specific implementation of steps S502-S503 can refer to the relevant description of steps S202-S203, which will not be repeated here.
[0083] S504, obtaining the total amount of memory resources of the M process node groups, and obtaining the remaining amount of memory resources of each computing device in at least one computing device.
[0084] In some embodiments, the electronic device obtains the total amount of memory resources of the M process node groups by defining the amount of memory resources required to execute the computing task in a configuration file, and determining the amount of memory resources required to execute the computing task as the total amount of memory resources; or it may be determined according to the process nodes in each process node group, and the sum of the amount of memory resources required for each process node group is used as the total amount of memory resources. Figure 1a If the at least one computing device and the electronic device are not the same device and there are multiple computing devices, the electronic device can obtain the remaining amount of memory resources of each computing device. For example, the electronic device can obtain the remaining amount of memory resources by querying the current load information of each computing device. It can be understood that if there is only one computing device, the computing device is the target computing device. Optionally, the type of the computing device can be a CPU (central processing unit), an NPU (Neural-network Processing Unit) or a DSP (Digital Signal Processor). There is no limitation on the specific type of the computing device, and the electronic device can be a device for multiple operating systems.
[0085] S505: Determine a target computing device from at least one computing device according to the remaining amount of memory resources and the total amount of memory resources.
[0086] In one possible implementation, the electronic device determines the target computing device from at least one computing device based on the remaining amount of memory resources and the total amount of memory resources. Specifically, the electronic device determines a set of candidate computing devices whose remaining amount of memory resources is greater than or equal to the total amount of memory resources from at least one computing device based on the total amount of memory resources, and obtains the candidate computing device with the smallest remaining amount of memory resources from the set of candidate computing devices as the target computing device. Before executing a computing task to perform task processing on a data set of an input task flow chart, selecting the computing device with the smallest current load as the target computing device can achieve dynamic adjustment of the computing device and further improve the overall execution efficiency of the computing task. Optionally, the electronic device determines the target computing device based on a computing device scheduler, that is, the remaining amount of memory resources of each computing device is obtained through the computing device scheduler, and the target computing device is determined based on the remaining amount of memory resources and the total amount of memory resources.
[0087] Optionally, when an electronic device acquires multiple data sets and inputs them into a task flow chart, a corresponding target computing device may be determined for each data set, so that memory resources are allocated to the corresponding data set in the target computing device, that is, when memory resources are allocated to each process node group, different data sets may be allocated different memory resources, so that the multiple data sets occupy independent memory resources. For example, when an electronic device inputs data set 1 and data set 2 into a task flow chart, the electronic device determines the target computing device 1 corresponding to data set 1, and allocates memory resources used by data set 1 to each process node group of the task flow chart in the target computing device, and determines the target computing device 2 corresponding to data set 2, and allocates memory resources used by data set 2 to each process node group of the task flow chart in the target computing device. Target computing device 1 and target computing device 2 may be the same computing device or different computing devices.
[0088] S506. Allocate memory resources to each process node group according to the memory resources of the target computing device.
[0089] In one possible implementation, any one of the M process node groups is represented as a target process node group. The electronic device allocates memory resources to each process node group according to the memory resources of the target computing device. Specifically, it can be to obtain the node memory resource amount corresponding to each process node in the target process node group, determine the maximum value of the node memory resource amount corresponding to each process node in the target process node group as the target memory resource amount, and allocate the target process node group the memory resources indicated by the target memory resource amount according to the target computing device. The node memory resource amount corresponding to each process node can be obtained from the configuration information.
[0090] In some embodiments, when the electronic device allocates memory resources to each process node group in the target computing device, it will obtain the memory address of the memory resources allocated in the target computing device. The electronic device can store the memory address of the memory resources corresponding to each process node group, and generate a memory pointer for pointing to the corresponding memory resource based on the memory address, and each process node group corresponds to a memory pointer. Subsequently, when the electronic device performs task processing on the process nodes in each process node group according to the memory resources allocated to each process node group, the memory pointer corresponding to the process node group can point to the memory address of the allocated memory resource to access the memory resource to perform task processing on the process nodes in the process node group.
[0091] S507 . According to the memory resources respectively allocated to each process node group, task processing is performed on the process nodes in each process node group to obtain task calculation results of the calculation tasks.
[0092] In a possible implementation, the electronic device can implement multi-threaded task processing through a thread scheduler to improve the utilization rate of device resources. Therefore, the electronic device can perform task processing on the process nodes in each process node group according to the memory resources respectively allocated for each process node group, which can be specifically, generating a corresponding computing subtask for each process node in the task flow chart, adding the computing subtask corresponding to each process node to the subtask queue, and sequentially allocating computing threads to each computing subtask in the subtask queue based on the thread scheduler, and executing each computing subtask respectively according to the computing threads allocated to each computing subtask and the memory resources allocated to the process node group to which the process node corresponding to each computing subtask belongs. Wherein, when generating the corresponding computing subtask for the process node, after a data set is passed in the input stream of the process node, the electronic device generates the computing subtask to which the data set belongs according to the passed in data set and the process node, and when the input stream of the process node stores multiple data sets passed in with different timestamps, the computing subtask to which each data set belongs is generated respectively according to each data set and the process node.
[0093] In some embodiments, the electronic device can obtain idle computing threads from the computing thread pool through a thread scheduler, and take out computing subtasks from the subtask queue in turn based on the thread scheduler, and allocate idle computing threads to the taken out computing subtasks. In the computing threads allocated for each computing subtask, according to the memory resources allocated to the process node group to which the process node corresponding to the computing subtask belongs, the target computing device is called to execute the computing subtask. The computing subtask is to perform task processing on the process node corresponding to the computing subtask for the data set in the computing subtask, and obtain the data processing result after the task processing of the data set, and the data processing result is the task processing result of the process node for the data set. The number of computing threads in the computing thread pool can be determined according to the configuration information, for example, it can be specifically determined from the configuration information The maximum number of threads corresponding to the task node is used as the number of computing threads.
[0094] Specifically, if the task flow chart contains a source node, when the electronic device inputs a new timestamp data set into the task flow chart, it will generate computing subtasks corresponding to all source nodes in the task flow chart. It can be one computing subtask for one source node or one computing subtask for all source nodes.
[0095] For example, see Figure 7a-7d , Figure 7a-7d A schematic diagram of a computing task processing scenario provided in an embodiment of the present application, wherein:
[0096] (1) Figure 7a , task node 2 in the task flow chart is a branch node and task node 3 is a source node, the electronic device inputs a data set [1.1] with a timestamp of 1 and a data set [2.1] with a timestamp of 2 into the task flow chart, the computing device assigned to the data set [1.1] is the target computing device 1, that is, the target computing device 1 is used to perform the computing subtask of the data set containing the timestamp 1, the computing device assigned to the data set [2.1] is the target computing device, that is, the target computing device 2 is used to perform the computing subtask of the data set containing the timestamp 2, the electronic device allocates the memory resources corresponding to the data set [1.1] to each process node group in the task flow chart on the target computing device 1, and allocates the memory resources corresponding to the data set [2.1] to each process node group in the task flow chart on the target computing device 2;
[0097] (2) The electronic device generates computing subtask 1 according to data set [1.1] and task node 1, and adds it to the subtask queue; generates computing subtask 2 according to data set [2.1] and task node 1, and adds it to the subtask queue; generates computing subtask 3 for timestamp 1 for task node 3, and generates computing subtask 4 for timestamp 2 for task node 3; wherein the task processing result obtained by executing computing subtask 3 is the data set of timestamp 1, and the task processing result obtained by executing computing subtask 4 is the data set of timestamp 2; based on the timestamp, target computing device 1 is used when computing subtask 1 and computing subtask 3 are executed, and target computing device 1 is used when computing subtask 2 and computing subtask 4 are executed;
[0098] (3) The electronic device sequentially allocates computing threads to each computing subtask in the subtask queue based on the thread scheduler, and assumes that computing thread 1 is allocated to computing subtask 1, and executes computing subtask 1 in computing thread 1 according to the memory resources corresponding to the data set [1.1] allocated to the process node group to which task node 1 in computing subtask 1 belongs, i.e., calls target computing device 1 to perform task processing on task node 1 for data set [1.1], and obtains a task processing result (set to data set [1.2]), and the timestamp of the task processing result is also 1; wherein, after the target computing device performs task processing, it can return a processing completion prompt message to the electronic device; therefore, the timestamp of the task processing result obtained by performing task processing on the data set with the same timestamp is also the timestamp of the data set; accordingly, if computing thread is allocated to computing subtask 2 based on the thread scheduler and computing task 2 is executed, the task processing result obtained is data set [2.2];
[0099] (4) Figure 7bAfter the electronic device receives the prompt information of the completion of the processing of the computing subtask 1, it transfers the task data result of the computing subtask 1 to the task node 2 in the computing thread 1. The input stream of the task node 2 contains the data set [1.2]. The electronic device generates the computing subtask 5 according to the data set [1.2] and the task node 2, and adds it to the subtask queue. At this time, the work of the computing thread 1 is completed, and the electronic device releases the computing thread 1. Other assigned computing threads perform subsequent work. When the computing subtask 5 is subsequently executed, the corresponding target computing device 1 is called; accordingly, the input stream of the task node 2 contains the data set [2.2]. The computing subtask is generated according to the data set [2.2] and the task node 2. Task 6 is added to the subtask queue, and the corresponding target computing device 2 is called when computing subtask 6 is subsequently executed; and the electronic device executes computing subtask 3 based on target computing device 1 in computing thread 3, obtains the task processing result (data set [1.0]) of timestamp 1, and passes it into input stream 3 of task node 5; and the electronic device allocates computing thread 4 to computing subtask 4, and executes computing subtask 4 based on target computing device 2 in computing thread 4; it can be understood that, for the electronic device, the task processing result in the computing task processing process is actually stored in the memory resources allocated by the target computing device, and the electronic device schedules the target computing device to perform task processing according to the instructions of the task flow chart;
[0100] (5) Figure 7c , in computing thread A, when the electronic device detects that there is a data set with a timestamp of 1 in input stream 2 of task node 5 (set as data set [1.3]), and the task node 5 requires data sets in three input streams, if there is no data set with a timestamp of 1 in input stream 1 at this time (set as data set [1.4]), then a computing subtask cannot be generated for the task node 5, and the work of computing thread A is completed, and the electronic device releases the computing thread A; Figure 7d If, in computing thread B, the electronic device passes the data set [1.4] output by task node 4 into the input stream 1 of task node 5, and if the data set is detected in all three input streams and the timestamps of the data sets in each input stream are the same, then a computing subtask is generated based on the data sets in the three input streams and task node 5, the work of computing thread B is completed, and the electronic device releases computing thread B.
[0101] In one possible implementation, the above-mentioned computing task may be a processing task based on an AI model, the configuration information of the computing task includes the model address of the called model, the computing device calls the model based on the model address to process data, and the task flow chart of the computing task includes a task node for calling the model, and the task node for calling the model can also be called a model inference node, which can be implemented based on TNN (a model inference engine). The model inference node based on TNN can improve the model calculation efficiency, and based on the technical solution described above, the process deployment of multiple deep learning frameworks based on the model can also be realized through ONNX (Open Neural Network Exchange) format technology.
[0102] For example, Figure 8 As shown, based on the above description, Figure 8 A data processing framework schematic diagram is provided for an embodiment of the present application, wherein: (1) an electronic device can construct a task flow chart for a computing task to implement pipeline execution of the computing task; (2) the electronic device may include multiple functional objects, such as a process node in a task flow chart, an input stream queue (also known as a data buffer) for storing a data set, a thread scheduler for implementing multi-threaded task processing, and a computing device scheduler for determining a target computing device, etc.; (3) the process nodes included in the task flow chart may be of multiple types, such as a model inference node, a branch node, a memory allocation node, and a tensor processing node, etc.; (4) the model inference node may use a TNN inference engine or an OpenCV inference engine for image recognition and other processing; (5) the device type of the electronic device and / or the computing device may be a CPU, a GPU, or an NPU, etc.; (6) the computing task may be a computing task based on an AI model, that is, the application scenario may be a scenario involving an AI model, such as an image recognition scenario, a natural language processing scenario, or a recommendation algorithm scenario, etc.
[0103] For example, Figure 9a-9b As shown, Figure 9a-9b A schematic diagram of a model-based task flow chart provided in an embodiment of the present application, wherein, Figure 9a The task flow chart is an AI data processing flow for facial image animation. The electronic device initializes the task flow chart according to the instructions of the configuration information, such as initializing the relevant parameters of the process nodes in the task flow chart and initializing the computing threads in the thread pool. Then, the task flow chart can be grouped and resources can be allocated. Therefore:
[0104] (1) The electronic device may perform task processing on task node 1 (which may be called GeneratePTS) according to the memory resources allocated to the process node group where the task node 1 is located to obtain a task processing result. Specifically, the task processing may be obtaining face registration data according to the input face image. The task node 1 includes a model inference node, and the model inference node may be a TNNInference node (a neural network inference node based on TNN);
[0105] (2) The electronic device may perform task processing on task node 2 (which may be called ImagePreprocess) according to the memory resources allocated to the process node group where task node 2 is located to obtain a task processing result. Specifically, the task processing may be image preprocessing according to the input face image and face registration data.
[0106] (3) The electronic device may perform task processing on the task node 3 (which may be called GenerateStyleCodes) according to the memory resources allocated to the process node group where the task node 3 is located to obtain a task processing result. Specifically, the task processing may be to generate a target vector as an output. The task node 3 is a source node.
[0107] (4) The electronic device can perform task processing on task node 4 (which can be called ProcessFacebodyImage) according to the memory resources allocated to the process node group where the task node 4 is located to obtain a task processing result. The task processing can specifically process the image data input by the previous task node and has a loop function, that is, loop processing the image data and finally outputting a preliminary animation stylized face image. The task node 4 includes a model inference node;
[0108] (5) The electronic device may perform task processing on task node 5 (which may be called ProcessFaceImage) according to the memory resources allocated to the process node group where task node 5 is located to obtain a task processing result. Specifically, the task processing may be to extract and process the pixel data of the face part in the input image data to output preliminary animation stylized image data of the face part. The task node 5 has a loop function and will loop call the model inference node. The specific loop flow chart of the task node 5 can be found in Figure 9b ;
[0109] (6) The electronic device may perform task processing on the task node 6 (which may be called CalculateMask) according to the memory resources allocated to the process node group where the task node 6 is located to obtain a task processing result. Specifically, the task processing may be calculating the input data and inputting the target data.
[0110] (7) The electronic device can perform task processing on task node 7 (which can be called Merge) according to the memory resources allocated to the process node group where the task node 7 is located to obtain a task processing result. The task processing can specifically be to merge all input data and output a complete facial animation stylized image.
[0111] In the embodiment of the present application, the electronic device can obtain the configuration information of the computing task, construct the task flow chart of the computing task according to the data flow direction between N task nodes and N task nodes, traverse the process nodes in the task flow chart, and group the process nodes in the task flow chart according to the traversal results to obtain M process node groups, obtain the total amount of memory resources of the M process node groups, and obtain the remaining amount of memory resources of each computing device in at least one computing device, determine the target computing device from at least one computing device according to the remaining amount of memory resources and the total amount of memory resources, allocate memory resources to each process node group according to the memory resources of the target computing device, and perform task processing on the process nodes in each process node group according to the memory resources allocated to each process node group, and obtain the task calculation result of the computing task. By implementing the method proposed above, the process nodes in the task flow chart can be grouped, and memory resources can be allocated to each process node group, so that the allocated memory resources can be reused in each process node group, thereby saving the memory resources consumed during the execution of the computing task, and improving the device operation performance when executing the computing task.
[0112] See also Fig.10 , Fig.10 This is a schematic diagram of the structure of a data processing device provided in this application. It should be noted that: Fig.10 The data processing device shown is used to execute the application Figure 2 and Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown, and the specific technical details are not disclosed. Please refer to the present application for details. Figure 2 and Figure 5 The data processing device 1000 may include: an acquisition module 1001, a construction module 1002, a grouping module 1003, an allocation module 1004, and a processing module 1005. Among them:
[0113] The acquisition module 1001 is used to acquire the configuration information of the computing task; the configuration information includes N task nodes that execute the computing task and the data flow between the N task nodes, where N is a positive integer;
[0114] A construction module 1002 is used to construct a task flow chart of a computing task according to N task nodes and data flows between the N task nodes; the flow nodes in the task flow chart include N task nodes;
[0115] The grouping module 1003 is used to traverse the process nodes in the task flow chart, and group the process nodes in the task flow chart according to the traversal result to obtain M process node groups; M is a positive integer, and one process node group contains at least one process node of the task flow chart;
[0116] An allocation module 1004 is used to allocate memory resources to each process node group in the M process node groups;
[0117] The processing module 1005 is used to perform task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group, so as to obtain the task calculation result of the calculation task.
[0118] In one possible implementation, N task nodes include the i-th task node and the j-th task node, i is not equal to j, and both i and j are positive integers less than or equal to N; the configuration information includes the data flow direction from the i-th task node to the j-th task node, and the data flow direction is used to indicate that the task processing result of the i-th task node is the input of the j-th task node; the N task nodes include the v-th task node and the u-th task node, and both v and u are positive integers less than or equal to N. If the configuration information includes the loop calculation configuration information between the v-th task node and the u-th task node, then the task processing result of the u-th task node is the input of the v-th task node within the number of loop calculations indicated by the loop calculation configuration information.
[0119] In a possible implementation, when the allocation module 1004 is used to allocate memory resources to each process node group in the M process node groups, it is specifically used to:
[0120] Get the total amount of memory resources of M process node groups;
[0121] Obtaining a remaining amount of memory resources of each computing device in at least one computing device;
[0122] Determine a target computing device from at least one computing device according to the remaining amount of memory resources and the total amount of memory resources;
[0123] Memory resources are allocated to each process node group according to the memory resources of the target computing device.
[0124] In a possible implementation, it is characterized in that any one of the M process node groups is represented as a target process node group;
[0125] When the allocation module 1004 is used to allocate memory resources to each process node group according to the memory resources of the target computing device, it is specifically used to:
[0126] Get the node memory resource amount corresponding to each process node in the target process node group;
[0127] The maximum value of the node memory resource amounts corresponding to each process node of the target process node group is determined as the target memory resource amount;
[0128] Memory resources indicated by the target memory resource amount are allocated to the target process node group according to the target computing device.
[0129] In a possible implementation, the process node in the above task flow diagram includes a branch node, and the N task nodes include a k-th task node. The branch node is generated when the configuration information includes a data flow direction of the k-th task node pointing to multiple task nodes in the N task nodes. The input and output of the branch node are the task processing results of the k-th task node, and the output of the branch node is the input of multiple task nodes.
[0130] The grouping module 1003 is used to traverse the process nodes in the task flow chart and group the process nodes in the task flow chart according to the traversal results to obtain M process node groups, which is specifically used for:
[0131] Traverse the process nodes in the task flow chart one by one;
[0132] If the branch node is traversed, the target task node among the multiple task nodes is added to the first process node group; if the task nodes other than the multiple task nodes among the N task nodes are traversed, all the traversed task nodes are added to the first process node group;
[0133] Determine the task nodes other than the target task node among the multiple task nodes as independent task nodes;
[0134] Generate a second process node group to which the independent task node belongs;
[0135] The first process node grouping and the second process node grouping are determined to be M process node groups.
[0136] In a possible implementation, when the processing module 1005 is used to perform task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group, it is specifically used to:
[0137] Generate corresponding computing subtasks for each process node in the task flow chart;
[0138] Add the computational subtask corresponding to each process node to the subtask queue;
[0139] Based on the thread scheduler, each computing subtask in the subtask queue is assigned a computing thread in turn;
[0140] Each computing subtask is executed separately according to the computing thread allocated to each computing subtask and the memory resources allocated to the process node group to which the process node corresponding to each computing subtask belongs.
[0141] In one possible implementation, the computing task is an image processing task based on an image processing model;
[0142] The processing module 1005 is used to perform task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group to obtain the task calculation result of the calculation task, specifically for:
[0143] Get the initial image for the image processing task;
[0144] Calling the image processing model to process the initial image according to the memory resources respectively allocated to each process node group, so as to obtain an image after the image processing of the initial image;
[0145] An image obtained by performing image processing on the initial image is determined as a task calculation result of the image processing task.
[0146] In the embodiment of the present application, the acquisition module acquires the configuration information of the computing task; the construction module constructs the task flow chart of the computing task according to the data flow between N task nodes and N task nodes; the grouping module traverses the process nodes in the task flow chart, and groups the process nodes in the task flow chart according to the traversal results to obtain M process node groups; the allocation module allocates memory resources to each process node group in the M process node groups; the processing module performs task processing on the process nodes in each process node group according to the memory resources allocated to each process node group, and obtains the task calculation result of the computing task. By implementing the above-mentioned device, the process nodes in the task flow chart can be grouped, and memory data can be allocated to each process node group, so that each process node group can reuse the allocated memory resources, thereby saving the memory resources consumed during the execution of the computing task, and improving the equipment operation performance when executing the computing task.
[0147] Each functional module in each embodiment of the present application can be integrated into one module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules, which is not limited in the present application.
[0148] See also Fig.11 , Fig.11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.11 As shown, the electronic device 1100 includes: at least one processor 1101 and a memory 1102. Optionally, the electronic device may further include a network interface. The processor 1101, the memory 1102 and the network interface may exchange data, the network interface is controlled by the processor 1101 to send and receive messages, the memory 1102 is used to store a computer program, the computer program includes program instructions, and the processor 1101 is used to execute the program instructions stored in the memory 1102. The processor 1101 is configured to call the program instructions to execute the above method.
[0149] Among them, the memory 1102 may include a volatile memory (volatile memory), such as a random-access memory (RAM); the memory 1102 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a solid-state drive (SSD), etc.; the memory 1102 may also include a combination of the above types of memory.
[0150] The processor 1101 may be a central processing unit (CPU). In one embodiment, the processor 1101 may also be a graphics processing unit (GPU). The processor 1101 may also be a combination of a CPU and a GPU.
[0151] In a possible implementation, the memory 1102 is used to store program instructions, and the processor 1101 may call the program instructions to perform the following steps:
[0152] Obtain configuration information of a computing task; the configuration information includes N task nodes that execute the computing task and the data flow between the N task nodes, where N is a positive integer;
[0153] Constructing a task flow chart of the computing task according to the N task nodes and the data flow between the N task nodes; the flow nodes in the task flow chart include the N task nodes;
[0154] Traversing the process nodes in the task flow graph, and grouping the process nodes in the task flow graph according to the traversal result to obtain M process node groups; M is a positive integer, and one process node group contains at least one process node of the task flow graph;
[0155] Allocate memory resources to each process node group in the M process node groups;
[0156] According to the memory resources respectively allocated to each process node group, task processing is performed on the process nodes in each process node group to obtain the task calculation result of the calculation task.
[0157] In one possible implementation, N task nodes include the i-th task node and the j-th task node, i is not equal to j, and both i and j are positive integers less than or equal to N; the configuration information includes the data flow direction from the i-th task node to the j-th task node, and the data flow direction is used to indicate that the task processing result of the i-th task node is the input of the j-th task node; the N task nodes include the v-th task node and the u-th task node, and both v and u are positive integers less than or equal to N. If the configuration information includes the loop calculation configuration information between the v-th task node and the u-th task node, then the task processing result of the u-th task node is the input of the v-th task node within the number of loop calculations indicated by the loop calculation configuration information.
[0158] In a possible implementation, when the processor 1101 is used to allocate memory resources to each process node group in the M process node groups, it is specifically used to:
[0159] Get the total amount of memory resources of M process node groups;
[0160] Obtaining a remaining amount of memory resources of each computing device in at least one computing device;
[0161] Determine a target computing device from at least one computing device according to the remaining amount of memory resources and the total amount of memory resources;
[0162] Memory resources are allocated to each process node group according to the memory resources of the target computing device.
[0163] In a possible implementation, it is characterized in that any one of the M process node groups is represented as a target process node group;
[0164] When the processor 1101 is used to allocate memory resources to each process node group according to the memory resources of the target computing device, it is specifically used to:
[0165] Get the node memory resource amount corresponding to each process node in the target process node group;
[0166] The maximum value of the node memory resource amounts corresponding to each process node of the target process node group is determined as the target memory resource amount;
[0167] Memory resources indicated by the target memory resource amount are allocated to the target process node group according to the target computing device.
[0168] In a possible implementation, the process node in the above task flow diagram includes a branch node, and the N task nodes include a k-th task node. The branch node is generated when the configuration information includes a data flow direction of the k-th task node pointing to multiple task nodes in the N task nodes. The input and output of the branch node are the task processing results of the k-th task node, and the output of the branch node is the input of multiple task nodes.
[0169] When the processor 1101 is used to traverse the process nodes in the task flow chart and group the process nodes in the task flow chart according to the traversal result to obtain M process node groups, it is specifically used to:
[0170] Traverse the process nodes in the task flow chart one by one;
[0171] If the branch node is traversed, the target task node among the multiple task nodes is added to the first process node group; if the task nodes other than the multiple task nodes among the N task nodes are traversed, all the traversed task nodes are added to the first process node group;
[0172] Determine the task nodes other than the target task node among the multiple task nodes as independent task nodes;
[0173] Generate a second process node group to which the independent task node belongs;
[0174] The first process node grouping and the second process node grouping are determined to be M process node groups.
[0175] In a possible implementation, when the processor 1101 is used to perform task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group, it is specifically used to:
[0176] Generate corresponding computing subtasks for each process node in the task flow chart;
[0177] Add the computational subtask corresponding to each process node to the subtask queue;
[0178] Based on the thread scheduler, each computing subtask in the subtask queue is assigned a computing thread in turn;
[0179] Each computing subtask is executed separately according to the computing thread allocated to each computing subtask and the memory resources allocated to the process node group to which the process node corresponding to each computing subtask belongs.
[0180] In one possible implementation, the computing task is an image processing task based on an image processing model;
[0181] When the processor 1101 is used to perform task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group to obtain the task calculation result of the calculation task, it is specifically used to:
[0182] Get the initial image for the image processing task;
[0183] Calling the image processing model to process the initial image according to the memory resources respectively allocated to each process node group, so as to obtain an image after the image processing of the initial image;
[0184] An image obtained by performing image processing on the initial image is determined as a task calculation result of the image processing task.
[0185] In a specific implementation, the above-described device, processor 1101, memory 1102, etc. can execute the implementation method described in the above-mentioned method embodiment, and can also execute the implementation method described in the embodiment of the present application, which will not be repeated here.
[0186] A computer (readable) storage medium is also provided in an embodiment of the present application, and the computer storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by the processor, the processor can execute some or all of the steps performed in the above method embodiment. Optionally, the computer storage medium can be volatile or non-volatile. The computer-readable storage medium can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc.; the data storage area can store data created according to the use of the blockchain node, etc.
[0187] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0188] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer storage medium, which can be a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0189] The above disclosure is only part of the embodiments of the present application, which certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiments and equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, It is characterized in that The method comprises: Obtain configuration information of a computing task; the configuration information includes N task nodes that execute the computing task and data flows between the N task nodes, where N is a positive integer; Constructing a task flow chart of the computing task according to the N task nodes and the data flow between the N task nodes; the flow nodes in the task flow chart include the N task nodes; Traversing the process nodes in the task flow chart, and grouping the process nodes in the task flow chart according to the traversal results to obtain M process node groups; M is a positive integer, and one process node group includes at least one process node of the task flow chart; wherein the task nodes included in the longest path traversed in the task flow chart constitute a first process node group, and when there are branch nodes in the task nodes included in the longest path, the task nodes connected by the branch nodes except the task nodes in the first process node group are independent task nodes, and the independent task nodes are used to constitute a second process node group, and the M process node groups include the first process node group and the second process node group; Allocating memory resources to each process node group in the M process node groups; wherein any one of the M process node groups is a target process node group, and the memory resources allocated to the target process node group are memory resources indicated by a target memory resource amount, and the target memory resource amount is a maximum value of the node memory resource amounts corresponding to each process node in the target process node group; According to the memory resources respectively allocated to each process node group, task processing is performed on the process nodes in each process node group to obtain the task calculation result of the calculation task.
2. The method according to claim 1, It is characterized in that The N task nodes include the i-th task node and the j-th task node, i is not equal to j, and both i and j are positive integers less than or equal to N; the configuration information includes the data flow direction from the i-th task node to the j-th task node, and the data flow direction is used to indicate that the task processing result of the i-th task node is the input of the j-th task node; the N task nodes include the v-th task node and the u-th task node, v and u are both positive integers less than or equal to N, and if the configuration information includes the loop calculation configuration information between the v-th task node and the u-th task node, then the task processing result of the u-th task node is the input of the v-th task node within the number of loop calculations indicated by the loop calculation configuration information.
3. The method according to claim 1, It is characterized in that The allocating memory resources to each process node group in the M process node groups includes: Obtain the total amount of memory resources of the M process node groups; Obtaining a remaining amount of memory resources of each computing device in at least one computing device; Determine a target computing device from the at least one computing device according to the remaining amount of the memory resource and the total amount of the memory resource; Memory resources are allocated to each process node group according to the memory resources of the target computing device.
4. The method according to claim 3, It is characterized in that The allocating memory resources to each process node group according to the memory resources of the target computing device includes: Memory resources indicated by the target memory resource amount are allocated to the target process node group according to the memory resources of the target computing device.
5. The method according to claim 1, It is characterized in that The process nodes in the task flow chart include a branch node, the N task nodes include a k-th task node, the branch node is generated when the configuration information includes a data flow direction in which the k-th task node points to multiple task nodes in the N task nodes, the input and output of the branch node are the task processing result of the k-th task node, and the output of the branch node is the input of the multiple task nodes; The traversing the process nodes in the task flow chart and grouping the process nodes in the task flow chart according to the traversal result to obtain M process node groups includes: Traversing the process nodes in the task flow chart in sequence; If the branch node is traversed, the target task node among the multiple task nodes is added to the first process node group; if the task nodes other than the multiple task nodes among the N task nodes are traversed, all the traversed task nodes are added to the first process node group; Determine the task nodes other than the target task node among the multiple task nodes as independent task nodes; Generate a second process node group to which the independent task node belongs; The first process node group and the second process node group are determined as the M process node groups.
6. The method according to claim 1, It is characterized in that The performing task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group includes: Generate a corresponding computing subtask for each process node in the task flow chart; Add the computing subtask corresponding to each process node to the subtask queue; Allocate a computing thread to each computing subtask in the subtask queue in turn based on a thread scheduler; Each computing subtask is executed separately according to the computing thread allocated to each computing subtask and the memory resources allocated to the process node group to which the process node corresponding to each computing subtask belongs.
7. The method according to claim 1, It is characterized in that The computing task is an image processing task based on an image processing model; The step of performing task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group to obtain the task calculation result of the calculation task includes: Acquire an initial image of the image processing task; Calling the image processing model to perform image processing on the initial image according to the memory resources respectively allocated to each process node group, so as to obtain an image after the image processing of the initial image; An image obtained by performing image processing on the initial image is determined as the task calculation result of the image processing task.
8. A data processing device, It is characterized in that The device comprises: An acquisition module, used to acquire configuration information of a computing task; the configuration information includes N task nodes that execute the computing task and data flows between the N task nodes, where N is a positive integer; A construction module, used for constructing a task flow chart of the computing task according to the N task nodes and the data flow between the N task nodes; the flow nodes in the task flow chart include the N task nodes; A grouping module, used for traversing the process nodes in the task flow chart, and grouping the process nodes in the task flow chart according to the traversal results to obtain M process node groups; M is a positive integer, and one process node group includes at least one process node of the task flow chart; wherein the task nodes included in the longest path traversed in the task flow chart constitute a first process node group, and when there are branch nodes in the task nodes included in the longest path, the task nodes connected by the branch nodes except the task nodes in the first process node group are independent task nodes, and the independent task nodes are used to constitute a second process node group, and the M process node groups include the first process node group and the second process node group; an allocation module, configured to allocate memory resources to each process node group in the M process node groups; wherein any one of the M process node groups is a target process node group, and the memory resources allocated to the target process node group are memory resources indicated by a target memory resource amount, and the target memory resource amount is a maximum value of the node memory resource amounts corresponding to each process node in the target process node group; The processing module is used to perform task processing on the process nodes in each process node group according to the memory resources respectively allocated to each process node group, so as to obtain the task calculation result of the calculation task.
9. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 7.
11. A computer program product, It is characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Task allocation method and device and computer readable storage medium
CN110458407A
Heterogeneous calculation method and device, electronic equipment and storage medium
CN113377439A