Periodic directed acyclic graph parallel scheduling method
Through the periodic directed acyclic graph parallel scheduling method, parallel calculation is performed using the node update sequence, which solves the problem of low calculation efficiency of periodic directed acyclic graph in the prior art, and improves the calculation speed and parallelism.
Patent Information
- Application Number
- CN202411230161.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-22
AI Technical Summary
The prior art is difficult to effectively utilize the processor core to accelerate the calculation process of periodic directed acyclic graphs, because the parallel scheduling method of non-periodic directed acyclic graphs can only be scheduled for the calculation process of nodes within a single period and cannot be fully utilized. Dependencies between nodes.
A periodic directed acyclic graph parallel scheduling method is proposed, including initialization steps and calculation steps, by setting simulation parameters, generating node update sequence, initializing node status, simulation time advancement, selecting nodes to be updated, parallel computing and waiting for all nodes Complete and judge the end of the simulation to ensure parallel calculations between nodes.
By scheduling the node's calculation process according to the update order of nodes, the coupling relationship between nodes is weakened, the calculation speed and parallelism of the periodic directed acyclic graph are improved, and a more efficient calculation process is achieved.
Smart Images

Figure CN119003131A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to, and in particular to, a periodic directed acyclic graph parallel scheduling method. Background Art
[0002] Modeling and simulation software plays a vital role in modern engineering, science and other fields by providing a virtual test platform to help users analyze and optimize in a safe and efficient environment. Models in modeling and simulation software are often expressed in the form of periodic directed acyclic graphs. The scheduling method for periodic directed acyclic graphs has a decisive influence on the computational efficiency of modeling and simulation software.
[0003] Since the nodes of a periodic directed acyclic graph have dependencies both within and between cycles, the parallel scheduling method for a non-periodic directed acyclic graph can only schedule the calculation process of the nodes within a single cycle, and it is difficult to use a large number of processor cores to accelerate the calculation process of the periodic directed acyclic graph. Summary of the invention
[0004] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a periodic directed acyclic graph parallel scheduling method.
[0005] The objective of the present invention is achieved through the following technical solutions:
[0006] The method comprises a periodic directed acyclic graph initialization step and a periodic directed acyclic graph calculation step located after the periodic directed acyclic graph initialization step.
[0007] The periodic directed acyclic graph initialization step includes: a simulation parameter setting sub-step, a node update sequence generation sub-step and a node state initialization sub-step.
[0008] The periodic directed acyclic graph calculation step includes: a simulation time advancement sub-step, a node selection sub-step, a parallel calculation sub-step of the nodes to be updated, a sub-step of waiting for all nodes to be updated to complete calculation, and a simulation end judgment sub-step.
[0009] 1. A periodic directed acyclic graph parallel scheduling method, characterized in that:
[0010] (1) Initialization of periodic directed acyclic graph;
[0011] (1.1) Set the periodic directed acyclic graph simulation parameters;
[0012] (1.2) Generate node update order according to the periodic directed acyclic graph topology structure;
[0013] (1.3) Initialize node status according to simulation parameters;
[0014] (2) Periodic directed acyclic graph computation;
[0015] (2.1) Periodic directed acyclic graph simulation time advancement;
[0016] (2.2) Select the nodes to be updated according to the simulation time and node update order;
[0017] (2.3) Parallel calculation of nodes to be updated;
[0018] (2.4) Wait for all nodes to be updated to complete calculation;
[0019] (2.5) Determine whether the simulation has ended based on the simulation parameters and the current simulation time.
[0020] 2. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the periodic directed acyclic graph simulation parameter setting method in the step (1.1) is as follows:
[0021] Set the processor core, memory and other computing resources used in the calculation process; set the unit cycle time and number of simulation cycles of the periodic directed acyclic graph, that is, the simulation step size and the total simulation time; at the same time, set the calculation parameters of the internal nodes of the periodic directed acyclic graph, such as the initial state, node type, node algorithm and other node parameters.
[0022] 3. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the method for generating the node update order in the step (1.2) is as follows:
[0023] First, traverse all nodes of the periodic directed acyclic graph and find all special nodes that do not depend on other predecessor nodes; then, set the update order of these nodes based on the current global update order variable, temporarily remove these nodes from the periodic directed acyclic graph, and update the value of the global update order variable; finally, repeat the process of searching and assigning update order for such special nodes until the update order of all nodes has been set.
[0024] 4. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the method for initializing the node state in the step (1.3) is as follows:
[0025] According to the simulation parameters of the periodic directed acyclic graph and the types and dependencies of its internal nodes, the initial simulation state of the node is set. The node state can be deterministic or non-deterministic satisfying a certain probability distribution, so as to prepare for the subsequent calculation process.
[0026] 5. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the periodic directed acyclic graph simulation time advancement method in step (2.1) is as follows:
[0027] First, before the calculation of the periodic directed acyclic graph begins, the global simulation time is initialized; then, at the beginning of the calculation of each cycle, the current global simulation time is obtained, combined with the simulation step information set in the simulation parameters, the global simulation time corresponding to the next state is calculated, and the global simulation time information is updated.
[0028] 6. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the method for selecting the node to be updated in step (2.2) is as follows:
[0029] First, according to the node update order in the preparation stage, the maximum node update order is obtained; then, combined with the simulation step size, number of calculation cycles and other information in the simulation parameters, according to the global simulation time and node update order information in the calculation process, specific nodes are selected as nodes to be updated.
[0030] 7. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the method of parallel calculation of the nodes to be updated in step (2.3) is as follows:
[0031] First, based on the number of nodes to be updated, the corresponding computing resources are applied, and the computing tasks corresponding to the nodes to be updated are assigned to the computing cores; then, these computing cores can parallelly compute the computing tasks corresponding to each node, including data input, data calculation, and data output of the nodes to be updated. When the computing core completes the computing tasks corresponding to the nodes to be updated, it can recycle its own computing resources or help other computing cores complete the corresponding computing tasks.
[0032] 8. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the method of waiting for all nodes to be updated to complete calculation in step (2.4) is as follows:
[0033] When the selected node to be updated starts calculating, the global scheduler blocks the simulation time and waits for the calculation of all nodes to be updated to be completed; when a node to be updated completes its corresponding calculation task, it will notify the global scheduler that the calculation has been completed; when the global scheduler receives the calculation completion message of all nodes to be updated, it enters the next sub-step of the calculation process.
[0034] 9. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: the method for judging whether the simulation is finished in the step (2.5) is as follows:
[0035] Based on the set simulation parameters and the current global simulation time, calculate whether the calculation termination condition has been reached; when the calculation termination condition has not been reached, enter the simulation time advancement sub-step of the next cycle; when the calculation termination condition is reached, exit the calculation process and complete the calculation task of the periodic directed acyclic graph.
[0036] The beneficial effects of the above technical solution of the present invention are as follows:
[0037] In the above scheme, in the preparation stage of the periodic directed acyclic graph, the method first sets the global simulation parameters, generates the update order of the internal nodes of the periodic directed acyclic graph, and initializes all nodes; then in the calculation stage, the simulation time is advanced based on the simulation step, and the nodes to be updated are selected according to the global simulation time; then the nodes to be updated are calculated in parallel, and the calculation of all the nodes to be updated is waited for; finally, whether the calculation is completed is determined based on the global simulation time, and if the calculation is not completed, the simulation time advancement step is continued, and the calculation process of the periodic directed acyclic graph is terminated after the calculation is completed. In the calculation process of the periodic directed acyclic graph, the present invention schedules the calculation process of the node according to the update order of the node, so that the successor node does not need to wait for the calculation result of the current cycle of the preceding node, and all nodes in the periodic directed acyclic graph can be calculated in parallel. By scheduling the calculation process of the nodes of the periodic directed acyclic graph, the coupling relationship between the nodes is weakened, and the parallelism of the calculation process of the periodic directed acyclic graph is improved under the premise of ensuring the accuracy of the calculation, thereby greatly improving the calculation speed of the periodic directed acyclic graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A flowchart of a periodic directed acyclic graph parallel scheduling method of the present invention;
[0039] Figure 2 A schematic diagram of a periodic directed acyclic graph of an exemplary embodiment of the present invention
[0040] Figure 3 A schematic diagram of a periodic directed acyclic graph scheduling result of an exemplary embodiment of the present invention DETAILED DESCRIPTION
[0041] First of all, it should be noted that the method of the following exemplary embodiment is based on the parallel computing requirements of the periodic directed acyclic graph, and aims to improve the parallelism of the simulation algorithm by scheduling the computing process, thereby improving the computing speed of the periodic directed acyclic graph. To this end, a parallel scheduling algorithm designed specifically for the periodic directed acyclic graph is proposed.
[0042] Among them, the periodic directed acyclic graph is a special variant of the directed acyclic graph. The nodes in the periodic directed acyclic graph not only have dependencies between nodes within a single cycle, but also have corresponding dependencies between cycles. When calculating, a single node needs to combine the calculation results of the previous node in the current cycle with its own internal state in the historical cycle to calculate the state change of the current cycle.
[0043] 1. Periodic Directed Acyclic Graph Initialization
[0044] (1.1) Setting the simulation parameters of the periodic directed acyclic graph
[0045] For example Figure 2 The periodic directed acyclic graph shown contains N=8 nodes, so N processor cores are applied for calculation, and the memory and other resources required in the calculation process are applied; at the same time, the unit cycle time ΔT of the periodic directed acyclic graph and the number of simulation cycles M, that is, the simulation step size and the total simulation time, are set; in addition, the calculation parameters of the internal nodes of the periodic directed acyclic graph are also set, such as the initial state of the node, the type of computing task corresponding to the node, and other node parameters.
[0046] (1.2) Generate node update order
[0047] First, set the global update order variable global_order to 1, traverse all nodes of the periodic directed acyclic graph, and find all nodes with in-degree 0, that is, nodes that do not depend on the previous node; then, use the value of global_order as the update order of these nodes, and temporarily remove these nodes from the periodic directed acyclic graph, and increase the value of global_order itself by 1; finally, repeat the process of finding and assigning update order for nodes with in-degree 0 until all nodes have set the update order. Figure 2 In the case shown, the update order corresponding to each node is indicated in the lower right corner of the node.
[0048] (1.3) Initialize node status
[0049] According to the simulation parameters of the periodic directed acyclic graph and the types and dependencies of its internal nodes, the initial simulation state of each node is set. The state of the node can be a deterministic state or a non-deterministic state that satisfies a certain probability distribution.
[0050] 2. Periodic Directed Acyclic Graph Computation
[0051] (2.1) Periodic Directed Acyclic Graph Simulation Time Advancement
[0052] During the calculation of the periodic directed acyclic graph, the initial value of the global simulation time time is 0. At the beginning of each cycle of calculation, the current global simulation time is obtained. Combining the simulation step size ΔT set in the simulation parameters, the global simulation time corresponding to the next state is calculated as time = time + ΔT, and the global simulation time information is updated.
[0053] (2.2) Select the nodes to be updated according to the simulation time and the node update order
[0054] According to the node update order situation in the preparation stage, record the maximum node update order max_order, calculate the number of cycles M, and the simulation step size ΔT; according to the value of the global simulation time time during the calculation process, divide the calculation process of the periodic directed acyclic graph into three stages: 0 < time < max_order·ΔT, max_order·ΔT ≤ time ≤ M·ΔT, and M·ΔT < time < M·ΔT + max_order·ΔT; in the stage of 0 < time < max_order·ΔT, select the node with the update order d satisfying as the node to be updated; in the stage of max_order·ΔT ≤ time ≤ M·ΔT, select all the nodes in the periodic directed acyclic graph as the nodes to be updated; in the stage of M·ΔT < time < M·ΔT + max_order·ΔT, select the node with the update order d satisfying as the node to be updated.
[0055] (2.3) Calculate the nodes to be updated in parallel
[0056] First, based on the number of nodes to be updated selected, apply for the corresponding number of computing cores, and allocate the computing tasks corresponding to the nodes to be updated to these computing cores; then, these computing cores can calculate the computing tasks corresponding to each node in parallel, and complete the data input, data calculation, and data output of the nodes to be updated in parallel on multiple computing cores. For the periodic directed acyclic graph as shown in Figure 2 , its parallel computing process is as shown in Figure 3 . At the simulation time t j satisfying t max_order ≤ time ≤ t M in the j-th cycle, all the nodes in the periodic directed acyclic graph can be calculated in parallel.
[0057] (2.4) Wait for all the nodes to be updated to complete the calculation
[0058] When the selected nodes to be updated start parallel calculation on multiple computing cores, the global scheduler blocks the simulation time and waits for the calculation of all nodes to be updated to be completed; when all the selected nodes to be updated have completed their corresponding calculation tasks, they enter the next sub-step of the calculation process.
[0059] (2.5) Determine whether the simulation is finished based on the simulation parameters and the current simulation time
[0060] Based on the current global simulation time time, the number of calculation cycles M and the simulation step length ΔT are set, it is possible to calculate whether the simulation is finished; in the periodic directed acyclic graph parallel scheduling algorithm proposed in the present invention, the termination condition of the calculation is time≥M·ΔT+max_order·ΔT; when the calculation termination condition is not met, the simulation time advancement sub-step of the next cycle will continue; when the calculation termination condition is met, the calculation process is exited and the calculation task of the periodic directed acyclic graph is completed.
[0061] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A periodic directed acyclic graph parallel scheduling method, characterized in that: (1) Initialization of periodic directed acyclic graph; (1.1) Set the periodic directed acyclic graph simulation parameters; (1.2) Generate node update order according to the periodic directed acyclic graph topology structure; (1.3) Initialize node status according to simulation parameters; (2) Periodic directed acyclic graph computation; (2.1) Periodic directed acyclic graph simulation time advancement; (2.2) Select the nodes to be updated according to the simulation time and node update order; (2.3) Parallel calculation of nodes to be updated; (2.4) Wait for all nodes to be updated to complete calculation; (2.5) Determine whether the simulation has ended based on the simulation parameters and the current simulation time.
2. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: The method for setting the periodic directed acyclic graph simulation parameters in step (1.1) is as follows: Set the processor core, memory and other computing resources used in the calculation process; set the unit cycle time and number of simulation cycles of the periodic directed acyclic graph; at the same time, set the calculation parameters of the internal nodes of the periodic directed acyclic graph, such as initial state, node type, node algorithm and other node parameters.
3. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: The method for generating the node update sequence in step (1.2) is as follows: First, traverse all nodes of the periodic directed acyclic graph and find all special nodes that do not depend on other predecessor nodes; then, set the update order of these nodes and temporarily remove these nodes from the periodic directed acyclic graph; finally, repeat the process of finding and assigning the update order of such special nodes until the update order of all nodes has been set.
4. The method for parallel scheduling of a periodic directed acyclic graph according to claim 1, characterized in that: The method for initializing the node status in step (1.3) is as follows: According to the simulation parameters of the periodic directed acyclic graph and the types and dependencies of its internal nodes, the initial simulation state of the node is set. The node state can be deterministic or non-deterministic satisfying a certain probability distribution, so as to prepare for the subsequent calculation process.
5. The method for parallel scheduling of a periodic directed acyclic graph according to claim 1, characterized in that: The periodic directed acyclic graph simulation time advancement method in step (2.1) is as follows: First, before the calculation of the periodic directed acyclic graph begins, the global simulation time is initialized; then, in the calculation phase of each cycle, the current global simulation time is obtained, combined with the simulation step information set in the simulation parameters, the global simulation time corresponding to the next state is calculated, and the global simulation time information is updated.
6. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: The method for selecting the node to be updated in step (2.2) is as follows: First, according to the node update order in the preparation stage, the maximum node update order is obtained; then, combined with the simulation step size, number of calculation cycles and other information in the simulation parameters, according to the global simulation time and node update order information in the calculation process, specific nodes are selected as nodes to be updated.
7. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: The method for parallel calculation of nodes to be updated in step (2.3) is as follows: First, based on the number of nodes to be updated, the corresponding computing resources are applied for, and the computing tasks corresponding to the nodes to be updated are assigned to the computing cores; then, these computing cores can calculate the computing tasks corresponding to each node in parallel, including data input, data calculation and data output of the nodes to be updated.
8. The method for parallel scheduling of periodic directed acyclic graphs according to claim 1, characterized in that: The method of waiting for all nodes to be updated to complete calculation in step (2.4) is as follows: When the selected node to be updated starts calculating, the global scheduler blocks the simulation time and waits for the calculation of all nodes to be updated to be completed; when the calculation of all nodes to be updated is completed, it enters the next sub-step of the calculation process.
9. A periodic directed acyclic graph parallel scheduling method according to claim 1, characterized in that: The method for determining whether the simulation is finished in the step (2.5) is as follows: based on the set simulation parameters and the current global simulation time, calculating whether the calculation termination condition is reached; When the calculation termination condition is not reached, the simulation time advancement substep of the next cycle is entered; When the calculation termination condition is reached, the calculation process is exited and the calculation task of the periodic directed acyclic graph is completed.
Citation Information
Cited By
Intelligent robot control algorithm scheduling method and system based on dynamic directed acyclic graph
CN120697030A
Intelligent robot control algorithm scheduling method and system based on dynamic directed acyclic graph
CN120697030B
