Parallel simulation method, medium and device based on load balancing

By splitting the complex system model and load balancing-based scheduling strategy, a parallel simulation method that efficiently utilizes multi-core and multi-node resources in complex system simulation is realized, and the problems of inefficient efficiency and insufficient resource utilization in the existing technology are solved.

CN119783340APending Publication Date: 2025-04-08CHANGSHA KELIANG TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411834941.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

When handling complex systems and large-scale models, existing parallel simulation technologies are inefficient, insufficient resource utilization, and difficult to scale to multi-core and multi-node environments.

Method used

Several sub-models are obtained by splitting the complex system model, and the sub-model is allocated according to the performance indicator data of each computing node. Priority scheduling strategy, dynamic scheduling strategy and resource conflict avoidance strategy are adopted to determine the execution order and scheduling method of the sub-model to realize parallel simulation of load balancing.

Benefits of technology

It improves simulation speed and resource utilization, reduces data dependence and interaction costs, and enhances the scalability and versatility of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783340A_ABST
    Figure CN119783340A_ABST
Patent Text Reader

Abstract

The present invention relates to a parallel simulation method, medium and device based on load balancing, which obtains several sub-models by splitting a complex system model, obtains performance index data of each computing node, allocates computing nodes corresponding to each sub-model according to the performance index data, determines the execution order and scheduling mode of the sub-models according to the priority scheduling strategy, dynamic scheduling strategy and resource conflict avoidance strategy, and controls the computing nodes corresponding to each sub-model to perform simulation operations according to the execution order and scheduling mode of the sub-models to obtain simulation results. The method solves the problem that the existing technology cannot improve the simulation speed and resource utilization while ensuring the accuracy of the simulation results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial simulation, and in particular to a parallel simulation method, medium and equipment based on load balancing. Background Art

[0002] In the field of industrial simulation software, traditional simulation methods mainly use serial simulation, that is, executing the calculation of each module of the system model in sequence according to the time step. This method is suitable for simple systems, but when dealing with complex systems and large-scale models, the execution time of serial simulation increases exponentially with the increase of model complexity and data volume, resulting in low efficiency. In addition, the serial simulation method has serious deficiencies in the utilization of computing resources, because it only uses a single thread or a single core for calculation, and cannot fully utilize the resources in multi-core processors and distributed computing environments, resulting in resource waste, slow simulation speed and poor model scalability.

[0003] In recent years, in order to overcome these problems, some parallel simulation technologies have emerged, trying to speed up the simulation through multi-threading, multi-core computing and other methods. However, these parallel simulation technologies generally have the following shortcomings:

[0004] 1. High model structure complexity requirements: Existing parallel simulation technologies mostly rely on specific model structures, such as computationally independent and data-independent models. However, most actual industrial models have complex dependencies, making parallel simulation difficult to implement in these scenarios.

[0005] 2. High cost of model segmentation and synchronization: For models with strong coupling relationships, the division of sub-models will lead to a large number of data interaction requirements. Existing parallel technologies are difficult to effectively manage these interactions and synchronizations, which significantly increases the cost of simulation calculations.

[0006] 3. Lack of versatility and scalability: Most parallel simulation methods cannot be effectively expanded to multi-core, multi-node environments, resulting in problems such as low resource utilization and limited performance improvement in complex system simulations.

[0007] Therefore, how to improve it is a technical problem that needs to be solved urgently in this field. Summary of the invention

[0008] Based on this, the purpose of this application is to provide a parallel simulation method, medium and device based on load balancing to solve at least one technical problem mentioned in the above background technology.

[0009] In a first aspect, the present application provides a parallel simulation method based on load balancing, comprising:

[0010] Split the complex system model into several sub-models;

[0011] Obtaining performance indicator data of each computing node to allocate computing nodes corresponding to each sub-model according to the performance indicator data;

[0012] Determine the execution order and scheduling method of sub-models according to priority scheduling strategy, dynamic scheduling strategy and resource conflict avoidance strategy;

[0013] According to the sub-model execution order and scheduling method, the corresponding computing nodes of each sub-model are controlled to perform simulation operations to obtain simulation results.

[0014] Furthermore, the steps of splitting the complex system model into several sub-models include:

[0015] Construct data flow diagrams to obtain data dependencies between submodules in complex system models;

[0016] Obtain the computational complexity of each submodule, and calculate the data coupling degree between the submodules based on the data dependency relationship between the submodules;

[0017] Determine the sub-model boundary based on the data dependency between sub-modules;

[0018] According to the computational complexity, data coupling and sub-model boundaries, the sub-modules are divided into several groups, and each group of sub-modules in the complex system model is split to obtain several sub-models.

[0019] Furthermore, the step of splitting the complex system model into several sub-models also includes:

[0020] Extract the calculation logic of each sub-model to independently encapsulate each sub-model according to the calculation logic;

[0021] According to the data dependency relationship between each sub-module, a data dependency chain is constructed, and data dependency markers are injected into each sub-model;

[0022] The set constants are extracted to the memory of each sub-model, and the data input and output interfaces of each sub-model are constructed to obtain the reconstructed sub-model.

[0023] Furthermore, the step of obtaining performance indicator data of each computing node and allocating computing nodes corresponding to each sub-model according to the performance indicator data includes:

[0024] Obtain performance indicator data of each computing node and build a performance matrix; performance indicator data includes memory size and computing speed;

[0025] Set memory threshold and computational complexity threshold to divide sub-models into memory-intensive sub-models and computation-intensive sub-models;

[0026] Sort the computing nodes in each memory-intensive sub-model and the performance matrix in a set order according to the memory size, and allocate the computing nodes corresponding to each memory-intensive sub-model in sequence according to the order;

[0027] Sort each computationally intensive sub-model in a set order according to computational complexity, and sort the remaining computational nodes in the performance matrix in a set order according to computational speed, and sequentially allocate computational nodes corresponding to each computationally intensive sub-model according to the sorting;

[0028] Furthermore, the priority scheduling strategy is:

[0029] According to the data dependency relationship between sub-models, the independence of each sub-model is obtained, and the sub-model with the highest independence is preferentially scheduled;

[0030] The dynamic scheduling strategy is:

[0031] Calculate the allocation priority index of each computing node, and preferentially allocate the sub-model to be allocated to the computing node with the lowest allocation priority index;

[0032] The resource conflict avoidance strategy is:

[0033] The sub-models of the same computing node are sorted in the set order, and each sub-model is executed in turn.

[0034] Furthermore, according to the sub-model execution order and scheduling mode, the step of controlling the computing nodes corresponding to each sub-model to execute the simulation operation and obtaining the simulation result includes:

[0035] According to the sub-model scheduling method, the sub-models are allocated to each computing node;

[0036] Each computing node initializes the sub-model according to the assigned sub-model;

[0037] A start signal is sent to all computing nodes to perform simulation operations according to the sub-model execution order to obtain simulation results.

[0038] Further, the step of sending a start signal to all computing nodes to perform simulation operations according to the sub-model execution order to obtain simulation results includes:

[0039] Sending a start signal to all computing nodes so that each computing node performs simulation operations on the assigned sub-models according to the sub-model execution order;

[0040] According to the preset synchronization mechanism, synchronization trigger conditions and communication mechanism, each computing node performs simulation calculation synchronously;

[0041] Determine whether each computing node has an exception. If not, leave it unchanged. If so, reschedule each computing node according to the preset exception handling mechanism.

[0042] Furthermore, the exception handling mechanism is:

[0043] Determine whether each computing node has an abnormality. If so, reschedule the sub-model of the computing node. If not, determine whether each computing node has a calculation delay. If not, leave it unchanged. If so, replace the sub-model of the computing node to other computing nodes.

[0044] In a second aspect, the present application further provides a computer storage medium storing an executable program code; the executable program code is used to execute the load balancing-based parallel simulation method described in any one of the first aspects.

[0045] In a third aspect, the present application also provides a terminal device, comprising a memory and a processor; the memory stores program code that can be executed by the processor; the program code is used to execute the load balancing-based parallel simulation method described in any one of the first aspects.

[0046] The present invention provides a parallel simulation method, medium and device based on load balancing. By splitting a complex system model to obtain several sub-models, the model can be divided into relatively independent sub-models under the premise of keeping the system simulation logic intact, so that it can adapt to the needs of parallel computing, reduce data dependence and interaction costs in the splitting process, and then obtain the performance index data of each computing node to allocate the computing nodes corresponding to each sub-model according to the performance index data, make full use of the performance of each computing node, improve the simulation efficiency, and determine the execution order and scheduling mode of the sub-models according to the priority scheduling strategy, dynamic scheduling strategy and resource conflict avoidance strategy, so as to improve the simulation speed and resource utilization. Finally, according to the execution order and scheduling mode of the sub-models, the computing nodes corresponding to each sub-model can be controlled to perform simulation operations to obtain simulation results. The problem that the existing technology cannot improve the simulation speed and resource utilization while ensuring the accuracy of the simulation results is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 Flow chart of a parallel simulation method based on load balancing according to an embodiment of the present invention;

[0048] Figure 2 A schematic diagram of the data dependency relationship between the modules in an embodiment of the present invention;

[0049] Figure 3 A schematic diagram of a system including six modules according to an embodiment of the present invention;

[0050] Figure 4 It is a schematic diagram of the relative independence of each submodule of an embodiment of the present invention. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] It should be noted that if the embodiments of the present invention involve directional indications, such as up, down, left, right, front, back, etc., then the directional indication is only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly. In addition, if the embodiments of the present invention involve descriptions of "first, second", "S1, S2", "step one, step two", etc., then such descriptions are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of indicated technical features or indicating the execution order of the method, etc. Those skilled in the art can understand that anything that does not violate the gist of the invention under the technical concept of the invention should be included in the protection scope of the present invention.

[0053] like Figure 1 As shown, the present invention provides a parallel simulation method based on load balancing:

[0054] S1: Split the complex system model into several sub-models;

[0055] Specifically, it is optional but not limited to obtaining the input and output data dependencies between several sub-modules in the complex system model and the data coupling between the sub-modules through a data flow graph (DFG), so as to divide the sub-modules into several groups, each group of sub-modules corresponding to a sub-model.

[0056] S11: Construct a data flow graph to obtain the data dependency between sub-modules in the complex system model;

[0057] Specifically, it is optional but not limited to modularizing various structures in the complex system model, such as the input layer, convolution layer, and output layer. Each hierarchical structure can be regarded as a module in the data flow graph. According to the forward propagation logic of the model, the connection relationship between the nodes is optionally defined to obtain the data dependency relationship between the sub-modules in the complex system model.

[0058] More specifically, taking the complex system model that only contains input layer, convolution layer and output layer as an example, it is optional to define each layer as a module according to its function. For example, the output layer is defined as an input module, which represents the input of various data; the convolution layer is defined as a calculation module, which represents various calculation operations; the output layer is represented as an output module, which represents the prediction result of the model; and based on the data input and data output relationship between each hierarchical structure, the data dependency relationship between each module is obtained.

[0059] For example, Figure 2 As shown, it can be seen that after part A in the system completes the calculation, it transmits data to parts B and C. Therefore, the system can be optionally split into module A, module B and module C, and the data dependency relationship between the modules can be obtained.

[0060] S12: Obtain the computational complexity of each submodule, and calculate the data coupling degree between the submodules according to the data dependency relationship between the submodules;

[0061] Specifically, it is optional but not limited to estimating the amount of computation for each submodule according to any existing scheme to obtain the computational complexity of each submodule, and then calculating the data coupling degree between the submodules through a coupling degree calculation formula based on the data dependency relationship between the submodules, so as to judge the frequency of data interaction between the submodules according to the data coupling degree between the submodules, thereby determining whether the corresponding submodules need to be divided into the same group.

[0062] Preferably, the coupling degree calculation formula can be optionally expressed as formula 1-1:

[0063]

[0064] Among them, D ij represents the amount of data transferred from module i to module j, D ii , D jj Represents the internal data volume of module i and module j respectively.

[0065] For example, taking the convolution layer as an example, assuming that the input data is a feature map, the computational complexity of the operation module corresponding to the convolution layer can be estimated according to formula 1-2:

[0066] C conv =H out ×W out ×K h ×K w ×C in ×C out 1-2

[0067] Among them, H out , W out is the height and width of the output feature map, K h , Kw is the height and width of the convolution kernel, C in is the number of channels of the input feature map, C out is the number of channels of the output feature map.

[0068] S13: Determine the sub-model boundary according to the data dependency relationship between the sub-modules;

[0069] Specifically, the definition of sub-model boundaries mainly includes the determination of input and output parameters, which is optional but not limited to obtaining data dependencies between sub-modules and determining sub-model boundaries so that each sub-model can be executed independently to ensure the consistency of boundary data.

[0070] For example, assume that modules A, B and C depend on different input data: A depends on input I1, B depends on input I2, and C depends on the output of A and B. Since modules A and B depend on different input data, they can run in parallel, and module C depends on the output of modules A and B to start the calculation steps. Therefore, modules A, B and C belong to different sub-models, so that after the sub-model boundaries are defined, the sub-models can be executed independently to ensure the consistency of the boundary data.

[0071] S14: Divide the sub-modules into several groups according to the computational complexity, data coupling degree and sub-model boundary, and split each group of sub-modules in the complex system model to obtain several sub-models.

[0072] Specifically, after determining the sub-model boundary, the sub-modules can be grouped, and then each group of sub-modules can be split from the complex system model to obtain several sub-models composed of a group of sub-modules. However, the problem of over-division may occur in the grouping process. The more sub-models there are, the higher the parallelism of the model, but at the same time the overhead of data synchronization will increase. Therefore, it is possible to further refine the modules according to the ground-track dichotomy until the divided modules meet the balance requirements or reach an acceptable synchronization cost.

[0073] For example, Figure 3 As shown, there is a system consisting of six modules (AF), and the dependencies between the modules are shown in the figure. It can be optionally divided into two sub-models:

[0074] Sub-model 1: includes A, B, and D, and meets the condition of high data coupling;

[0075] Sub-model 2: includes A, C, E, and F, and meets the load balancing requirements.

[0076] Preferably, the submodules are divided into several groups according to the computational complexity, data coupling degree and submodel boundary, and after reconstructing each group of submodules to obtain the final submodel, each submodel needs to be reconstructed so that each submodel can run independently in parallel computing. Therefore, after step S14, the following steps may be optionally included:

[0077] S141: extracting the calculation logic of each sub-model, and independently encapsulating each sub-model according to the calculation logic;

[0078] Specifically, it is optional but not limited to obtaining the calculation logic of each sub-model, and then independently encapsulating the input parameters, output parameters and calculation functions of each sub-model so that the sub-model can run independently in parallel computing. More specifically, the calculation logic of the sub-model includes the calculation steps of all sub-modules in the sub-model.

[0079] For example, Figure 3 Taking the sub-model 1 shown as an example, assuming that module A depends on input parameter T1 and module D outputs result T2, it is necessary to independently encapsulate the input parameter T1, all calculation steps of modules A, B, and D, and the output result T2.

[0080] S142: construct a data dependency chain according to the data dependency relationship between the sub-modules, and inject a data dependency marker into each sub-model;

[0081] Specifically, it is optional but not limited to building a data dependency chain based on the data dependency relationship between the sub-modules obtained in step S11 to mark the variables in each sub-model that need to interact with other sub-models, mark the data dependency, and inject data dependency markers into each sub-model to facilitate the interaction between the sub-models in the subsequent synchronization process.

[0082] For example, Figure 3 As shown, it can be seen that the output of module D depends on the output result of module B. Since module D and module B belong to the same sub-model, this internal dependency can be optionally encapsulated as local variable storage. Module C depends on the output of module A, but module A belongs to both sub-model 1 and sub-model 2. Therefore, it is necessary to add a dependency tag to the output of module A in sub-model 1 for the interaction between sub-model 1 and sub-model 2 in the subsequent synchronization process.

[0083] S143: extracting the set constants into the memory of each sub-model, and constructing the data input and output interface of each sub-model to obtain the reconstructed sub-model.

[0084] Specifically, after each sub-model is independently encapsulated and dependency markers are injected, it is also necessary to optimize the code structure of each sub-model to improve the performance of each sub-model. Optionally but not limited to, constants that are frequently called are set as predefined constants and extracted into the memory of each sub-model to avoid frequent calls, improve performance and efficiency. Then, the interface functions of each sub-model are refactored to provide standard input and output interfaces for each sub-model, making each sub-model easier to integrate and call, thus completing the reconstruction of the sub-model.

[0085] S2: Obtain the performance metric data of each computing node to allocate the corresponding computing node for each sub-model according to the performance metric data;

[0086] Specifically, during the simulation operation process, it is necessary to allocate computing resources for each sub-model. Since the computational complexity and memory of each sub-model are different, and the performance metric data of each computing node is also different, therefore, optionally but not limited to, obtaining the performance metric data of each computing node, and then allocating the corresponding computing node for each sub-model according to the performance metric data; the performance metric data includes information such as the number of CPU cores, memory size, and computing speed.

[0087] Preferably, the steps of obtaining the performance metric data of each computing node, constructing a performance matrix, and allocating the corresponding computing node for each sub-model according to the performance matrix may include:

[0088] S21: Obtain the performance metric data of each computing node and construct a performance matrix; the performance metric data includes memory size and computing speed;

[0089] Specifically, optionally but not limited to obtaining the performance metric data such as the number of CPU cores, memory size, and computing speed of all computing nodes and representing it in the form of a performance matrix to save retrieval time when allocating computing nodes for each sub-model later. It should be noted that the performance matrix is only a storage representation form, and it may also be represented in any existing storage forms such as arrays and tables.

[0090] More specifically, the performance matrix may be represented as Equation 2-1:

[0091]

[0092] where M is the performance matrix, CPU i , Mem i , Speed i are respectively the number of CPU cores, memory size, and computing speed of the i-th computing node, 0 < i ≤ n, and n is the number of computing nodes.

[0093] Exemplarily, assuming there are four computing nodes, the performance matrix may be represented as Equation 2-2:

[0094]

[0095] Among them, each row of data in the matrix represents the number of CPU cores, memory size and computing speed (main frequency) of a computing node.

[0096] S22: setting a memory threshold and a computational complexity threshold, and dividing the sub-models into memory-intensive sub-models and computation-intensive sub-models;

[0097] Specifically, it is optional but not limited to setting a memory threshold and a computational complexity threshold, and a sub-model with memory greater than the memory threshold is regarded as a memory-intensive sub-model, and a sub-model with computational complexity greater than the computational complexity threshold is regarded as a computationally intensive sub-model; the memory threshold and the computational complexity threshold are arbitrarily set by technical personnel in this field.

[0098] S23: sorting the computing nodes in each memory-intensive sub-model and the performance matrix in a set order according to the memory size, and sequentially allocating the computing nodes corresponding to each memory-intensive sub-model according to the order;

[0099] Specifically, it is optional but not limited to sorting the computing nodes in each memory-intensive sub-model and the performance matrix in a set order according to the memory size, and then allocating corresponding computing nodes to each memory-intensive sub-model one by one according to the sorting result. More specifically, it is preferred to sort the computing nodes in the memory-intensive sub-model and the performance matrix in order from large to small memory.

[0100] S24: sorting each computationally intensive sub-model in a set order according to computational complexity, and sorting the remaining computational nodes in the performance matrix in a set order according to computational speed, and sequentially allocating computational nodes corresponding to each computationally intensive sub-model according to the sorting;

[0101] Specifically, it is optional but not limited to sorting each computationally intensive sub-model according to computational complexity in a set order, and sorting the computational nodes in the performance matrix that are not assigned to the sub-model according to processing speed in a set order, and then assigning corresponding computational nodes to each computationally intensive sub-model one by one according to the sorting result. More specifically, it is preferred to sort the computationally intensive sub-models and the remaining computational nodes in the performance matrix in descending order of computational complexity and processing speed.

[0102] S3: Determine the execution order and scheduling method of the sub-models according to the priority scheduling strategy, dynamic scheduling strategy and resource conflict avoidance strategy;

[0103] Specifically, it is optional but not limited to pre-setting priority scheduling strategies, dynamic scheduling strategies and resource conflict avoidance strategies to determine the execution order and scheduling method of sub-models according to the strategies to maximize resource utilization and avoid task contention among multiple sub-models during parallel scheduling, that is, multiple sub-models assigned to the same computing node compete for the computing resources of the computing node to avoid resource conflicts. At this time, the sub-model is assigned to each computing node as a task to perform subsequent simulation operations. Therefore, the sub-model assigned to each computing node will be referred to as a sub-model in the future.

[0104] Preferably, the priority scheduling strategy is:

[0105] S31: Obtain the independence of each sub-model according to the data dependency relationship between the sub-models, and preferentially schedule the sub-model with the highest independence;

[0106] For example, suppose the data dependency relationship between the sub-models is as follows Figure 4 As shown, it can be seen that sub-model D depends on the data output of sub-models B and sub-model C, sub-models B and sub-model C depend on the data output of sub-model A, and sub-model A does not depend on the input data of other sub-models. Therefore, relatively speaking, sub-model A has the highest independence.

[0107] The dynamic scheduling strategy is:

[0108] S32: Calculate the allocation priority index of each computing node, and preferentially allocate the sub-model to be allocated to the computing node with the lowest allocation priority index;

[0109] Specifically, it is optional but not limited to real-time monitoring of the resource usage of each computing node to calculate the allocation priority index of each computing node according to the dynamic scheduling formula, so as to allocate the unallocated sub-models of the unallocated computing nodes to the computing nodes with the lowest allocation priority index in real time to maximize resource utilization.

[0110] Preferably, the dynamic scheduling formula can be optionally expressed as Formula 3-1:

[0111]

[0112] Among them, Priority i is the allocation priority index of computing node i, Load i is the load of the current sub-model on computing node i, Available_Resources i is the currently available resources on computing node i.

[0113] For example, assuming that the current load of computing node 1 is 60% and the available resources are 40%, then:

[0114]

[0115] The load of computing node 2 is 30% and the available resources are 70%, then:

[0116]

[0117] Therefore, the new sub-model is scheduled to computing node 2 first, because computing node 2 has a lower priority index, which means that the node is more idle.

[0118] The resource conflict avoidance strategy is:

[0119] S33: Sort the sub-models of the same computing node according to a set order, and execute each sub-model in turn.

[0120] Specifically, it is optional but not limited to sorting the sub-models assigned to the same computing node in a set order, locking the resources through a resource locking mechanism (Resource Locking), and subsequent sub-models can only obtain resources after the previous sub-model is unlocked; the set order is arbitrarily set by technical personnel in this field.

[0121] Preferably, the setting order can be selected to be sorted in the order from first to last according to the sub-models assigned to the same computing node, or can be sorted in the order from easy to difficult according to the computational complexity of the sub-models.

[0122] S4: According to the sub-model execution order and scheduling method, control the corresponding computing nodes of each sub-model to perform simulation operations to obtain simulation results.

[0123] S41: Allocate the sub-model to each computing node according to the sub-model scheduling method;

[0124] Specifically, it is optional but not limited to the main scheduler to allocate each sub-model to each computing node in turn according to the sub-model scheduling method determined in step S3. When each computing node receives the allocated sub-model, it needs to feedback confirmation to the main scheduler so that the main scheduler can track the task status and check the available resource status of each computing node to ensure that it can carry the simulation task to be started; the available resources of the computing node include CPU, memory, network, etc.

[0125] S42: Each computing node initializes the sub-model according to the assigned sub-model;

[0126] Specifically, each computing node may load the required parameters and data from the database according to the assigned sub-model, allocate memory space for each sub-model, initialize the data structure, and establish an interface for communication between sub-models to achieve data exchange in parallel execution.

[0127] Preferably, the step of initializing the sub-model according to the assigned sub-model by each computing node may optionally include:

[0128] S421: Each computing node loads the parameters and initial state data of the corresponding sub-model; the parameters and initial state data include information such as time step, initial conditions, model constants, etc.;

[0129] Specifically, you can choose to load all the parameters and initial state data required for the sub-model from a configuration file or database, including time step, initial conditions, model constants and other information.

[0130] S422: Each computing node allocates memory space for the corresponding sub-model and initializes the data structure of each corresponding sub-model;

[0131] Specifically, it is optional to allocate necessary memory space for each sub-model, which includes allocating memory for variables, arrays and caches, and initializing data structures, that is, assigning initial values ​​to various parameters of the sub-model.

[0132] S423: Establish a communication interface for each computing node.

[0133] Specifically, a shared memory area or a message queue may be optionally set in each computing node to establish a communication interface between sub-models, thereby achieving data exchange in parallel execution.

[0134] S43: Send a start signal to all computing nodes to perform simulation operations according to the sub-model execution order to obtain simulation results.

[0135] Specifically, the main scheduler may broadcast a start signal to all computing nodes, so that all computing nodes execute the assigned sub-models and perform simulation operations, thereby obtaining simulation results.

[0136] Preferably, the step of sending a start signal to all computing nodes to perform a simulation operation and obtain a simulation result may optionally include:

[0137] S431: Sending a start signal to all computing nodes, so that each computing node performs simulation operations on the assigned sub-models according to the sub-model execution order;

[0138] S432: according to the preset synchronization mechanism, synchronization triggering condition and communication mechanism, each computing node is caused to synchronously perform simulation calculation;

[0139] Specifically, the preset synchronization mechanism, synchronization trigger conditions and communication mechanism are optional but not limited to, and the main scheduler broadcasts the start signal to all computing nodes, so that all computing nodes perform simulation operations on the assigned sub-models according to the sub-model execution order. At the same time, in order to ensure that each sub-model is calculated according to the correct timing and logical relationship, the preset synchronization mechanism and synchronization trigger conditions are adopted, so that all sub-models are calculated at the same time step, thereby ensuring that the data of each sub-model is updated at the same time point, and ensuring that the output of each sub-model can correctly affect the input of other related sub-models, thereby improving the accuracy of the simulation results; the preset synchronization mechanism, optional including lock-step synchronization (Lock-stepSynchronization), asynchronous synchronization (Asynchronous Synchronization), event-driven synchronization (Event-Driven Synchronization) and other common synchronization mechanisms; the synchronization trigger conditions, optional including time step trigger, state change trigger, external event trigger and other common trigger conditions.

[0140] Preferably, the preset synchronization mechanism includes:

[0141] 1. Lock-step Synchronization

[0142] Specifically, under the lock-step synchronization mechanism, all sub-models are calculated at the same time step, ensuring that the output of each sub-model is updated at the same time point to ensure that all dependencies can be updated in a timely manner.

[0143] For example, suppose there are two sub-models A and B, and the output of A is used as the input of B. Under the lock-step synchronization mechanism, A and B both calculate and update the results at 0.01 seconds, ensuring that B uses the output of A at 0.01 seconds for calculation.

[0144] 2. Asynchronous Synchronization

[0145] Specifically, the asynchronous synchronization mechanism allows each sub-model to be updated based on its own calculation completion status without waiting for other models, which can improve calculation efficiency, but requires specific trigger conditions to ensure data consistency.

[0146] For example, suppose sub-model A takes 1 second to calculate, while sub-model B only takes 0.5 seconds to calculate. Under the asynchronous mechanism, B can be completed in 0.5 seconds and start calculating the next step without having to wait for A to complete.

[0147] 3. Event-Driven Synchronization

[0148] Specifically, in the event-driven synchronization mechanism, the update of the sub-model is based on the triggering of specific events, such as data changes or the arrival of time nodes, which is suitable for systems with frequent dynamic changes.

[0149] For example, if the calculation of sub-model D depends on the output of sub-model C, the update of sub-model D can be triggered according to the change of a state variable of sub-model C (for example, the temperature exceeds a threshold) to ensure that the calculation of D is based on the latest state of C.

[0150] Further preferably, the synchronization triggering condition includes:

[0151] 1. Time step trigger

[0152] Specifically, when the preset time step is reached, all sub-models are updated synchronously, which is suitable for a stable simulation environment and ensures that each sub-model is calculated at a fixed time point.

[0153] The optional expression is as formula 4-1:

[0154] t=t 0 +n×Δt(n∈N)4-1

[0155] For example, it is optional to set synchronization every 0.01 seconds, and when t=0.01, 0.02, 0.03, etc., all sub-models are updated.

[0156] 2. State change trigger

[0157] Specifically, when some key state variables of a sub-model change, the related sub-models are triggered to update, which is suitable for situations with frequent changes in dynamic systems.

[0158] For example, if the pressure value of sub-model A is greater than 1000 Pa, sub-model B is triggered to update its temperature calculation.

[0159] 3. External event trigger

[0160] Specifically, when an external event (such as user input or sensor data update) is received, the sub-model is triggered to perform synchronous update, which is suitable for application scenarios of real-time monitoring and control.

[0161] For example, when the sensor detects new temperature data, the calculation of the control sub-model is immediately updated to ensure that the system responds promptly.

[0162] Further preferably, the specific steps of the communication mechanism may optionally include:

[0163] S4321: define the data interface of each sub-model;

[0164] Specifically, a clear data interface can be optionally defined for each sub-model, including input and output data types and formats, such as basic types (such as int and double) and matrix data, to ensure the consistency of the interface to improve the maintainability and scalability of the system.

[0165] For example, suppose sub-model A outputs a temperature value and a pressure value, and sub-model B needs to receive the output value of sub-model A. Then, the interface structure of sub-model B can be defined to include: temperature, pressure, and status indication.

[0166] S4322: Determine the data transmission mechanism between each sub-model;

[0167] Specifically, those skilled in the art may arbitrarily set an existing data transmission mechanism as the data transmission mechanism between the sub-models to ensure efficient message transmission between the sub-models.

[0168] Preferably, the data transmission mechanism adopts the ZeroMQ (ZMQ) mechanism.

[0169] S4323: Integrate the data received by each sub-model.

[0170] Specifically, since the data between the sub-models may have different calculation units, each sub-model needs to integrate the data into a format suitable for internal processing before the calculation step.

[0171] For example, in sub-model B, the received data needs to be processed according to business logic, such as converting Celsius to Fahrenheit, or converting the pressure unit from Pascal (Pa) to bar.

[0172] By defining the data interface of each sub-model, determining the data transmission mechanism between sub-models and integrating the data received by each sub-model, the sub-models can exchange data efficiently through the data transmission mechanism and perform necessary integration processing after receiving the data to ensure the overall coordination and accuracy of the simulation system, so that it can flexibly adapt to different complex model structures and realize the versatility and scalability of the system.

[0173] Further preferably, during the execution of the sub-model, due to factors such as hardware or environmental influences, the computing nodes may be abnormal or delayed in computing. Therefore, it is necessary to monitor the execution status of each computing node in real time so that when an abnormal situation occurs, it can be processed in time. Therefore, step S43 may optionally further include:

[0174] S433: Determine whether each computing node has an exception. If not, do not change. If yes, reschedule each computing node according to a preset exception handling mechanism.

[0175] Specifically, it is optional but not limited to the exception handling mechanism being arbitrarily set by technical personnel in this field. When each computing node performs simulation operations, the execution status of each computing node is monitored in real time to determine whether each computing node has an exception. If not, it remains unchanged. If so, each computing node is rescheduled according to the preset exception handling mechanism to avoid affecting the simulation operation process, improve efficiency and save time.

[0176] Preferably, the exception handling mechanism is:

[0177] Determine whether each computing node has an abnormality. If so, reschedule the sub-model of the computing node. If not, determine whether each computing node has a calculation delay. If not, leave it unchanged. If so, replace the sub-model of the computing node to other computing nodes.

[0178] In this embodiment, a parallel simulation method based on load balancing of the present invention is provided. By splitting a complex system model to obtain several sub-models, the model can be divided into relatively independent sub-models under the premise of keeping the system simulation logic intact, so that it can adapt to the needs of parallel computing and reduce data dependency and interaction costs in the splitting process. Then, the performance index data of each computing node is obtained to allocate the computing nodes corresponding to each sub-model according to the performance index data, make full use of the performance of each computing node, improve the simulation efficiency, and determine the execution order and scheduling mode of the sub-model according to the priority scheduling strategy, dynamic scheduling strategy and resource conflict avoidance strategy, so as to improve the simulation speed and resource utilization. Finally, according to the execution order and scheduling mode of the sub-model, the corresponding computing nodes of each sub-model can be controlled to perform simulation operations to obtain simulation results. The problem that the existing technology cannot improve the simulation speed and resource utilization while ensuring the accuracy of the simulation results is solved.

[0179] On the other hand, the present invention further provides a computer storage medium storing executable program code; the executable program code is used to execute any of the above-mentioned parallel simulation methods based on load balancing.

[0180] On the other hand, the present invention also provides a terminal device, including a memory and a processor; the memory stores program codes that can be executed by the processor; the program codes are used to execute any of the above-mentioned parallel simulation methods based on load balancing.

[0181] Exemplarily, the program code may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the program code in the terminal device.

[0182] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the terminal device may also include an input / output device, a network access device, a bus, etc.

[0183] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0184] The memory may be an internal storage unit of the terminal device, such as a hard disk or a memory. The memory may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device. Further, the memory may also include both an internal storage unit of the terminal device and an external storage device. The memory is used to store the program code and other programs and data required by the terminal device. The memory may also be used to temporarily store data that has been output or is to be output.

[0185] The above-mentioned computer storage medium and terminal device are created based on the above-mentioned load balancing-based parallel simulation method. Their technical functions and beneficial effects are no longer repeated here. The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the various technical features in the above-mentioned embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0186] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A parallel simulation method based on load balancing, characterized in that: include: Split the complex system model into several sub-models; Obtaining performance indicator data of each computing node, so as to allocate computing nodes corresponding to each sub-model according to the performance indicator data; Determine the execution order and scheduling method of sub-models according to priority scheduling strategy, dynamic scheduling strategy and resource conflict avoidance strategy; According to the sub-model execution order and scheduling method, the corresponding computing nodes of each sub-model are controlled to perform simulation operations to obtain simulation results.

2. The method according to claim 1, characterized in that The steps of splitting a complex system model into several sub-models include: Construct data flow diagrams to obtain data dependencies between submodules in complex system models; Obtain the computational complexity of each submodule, and calculate the data coupling degree between the submodules based on the data dependency relationship between the submodules; Determine the sub-model boundary based on the data dependency between sub-modules; According to the computational complexity, data coupling and sub-model boundaries, the sub-modules are divided into several groups, and each group of sub-modules in the complex system model is split to obtain several sub-models.

3. The method according to claim 2, characterized in that The steps of splitting the complex system model into several sub-models also include: Extract the calculation logic of each sub-model to independently encapsulate each sub-model according to the calculation logic; According to the data dependency relationship between each sub-module, a data dependency chain is constructed, and data dependency markers are injected into each sub-model; The set constants are extracted to the memory of each sub-model, and the data input and output interfaces of each sub-model are constructed to obtain the reconstructed sub-model.

4. The method according to claim 1, characterized in that The step of obtaining performance indicator data of each computing node and allocating computing nodes corresponding to each sub-model according to the performance indicator data includes: Obtain the performance indicator data of each computing node and build a performance matrix; performance indicator data includes memory size and computing speed; Set memory threshold and computational complexity threshold to divide sub-models into memory-intensive sub-models and computation-intensive sub-models; Sort the computing nodes in each memory-intensive sub-model and the performance matrix in a set order according to the memory size, and allocate the computing nodes corresponding to each memory-intensive sub-model in sequence according to the order; The computationally intensive sub-models are sorted in a set order according to computational complexity, and the remaining computational nodes in the performance matrix are sorted in a set order according to computational speed, and the computational nodes corresponding to the computationally intensive sub-models are allocated in sequence according to the sorting.

5. The method according to claim 1, characterized in that The priority scheduling strategy is: According to the data dependency relationship between sub-models, the independence of each sub-model is obtained, and the sub-model with the highest independence is preferentially scheduled; The dynamic scheduling strategy is: Calculate the allocation priority index of each computing node, and preferentially allocate the sub-model to be allocated to the computing node with the lowest allocation priority index; The resource conflict avoidance strategy is: The sub-models of the same computing node are sorted in the set order, and each sub-model is executed in turn.

6. The method according to claim 1, characterized in that According to the sub-model execution order and scheduling mode, the steps of controlling the corresponding computing nodes of each sub-model to execute simulation operations and obtaining simulation results include: According to the sub-model scheduling method, the sub-models are allocated to each computing node; Each computing node initializes the sub-model according to the assigned sub-model; A start signal is sent to all computing nodes to perform simulation operations according to the sub-model execution order to obtain simulation results.

7. The method according to claim 6, characterized in that The step of sending a start signal to all computing nodes to perform simulation operations according to the sub-model execution order to obtain simulation results includes: Sending a start signal to all computing nodes so that each computing node performs simulation operations on the assigned sub-models according to the sub-model execution order; According to the preset synchronization mechanism, synchronization trigger conditions and communication mechanism, each computing node performs simulation calculation synchronously; Determine whether each computing node has an exception. If not, leave it unchanged. If so, reschedule each computing node according to the preset exception handling mechanism.

8. The method according to claim 7, characterized in that The exception handling mechanism is: Determine whether each computing node has an abnormality. If so, reschedule the sub-model of the computing node. If not, determine whether each computing node has a calculation delay. If not, leave it unchanged. If so, replace the sub-model of the computing node to other computing nodes.

9. A computer storage medium, characterized in that An executable program code is stored; the executable program code is used to execute the load balancing-based parallel simulation method described in any one of claims 1-8.

10. A terminal device, characterized in that: It comprises a memory and a processor; the memory stores program codes executable by the processor; the program codes are used to execute the load balancing-based parallel simulation method according to any one of claims 1 to 8.

Citation Information

Cited By

  • Method for dynamically using computing power of reasoning server through model superposition technology

    CN121072759A

  • Containerized communication networking simulation acceleration method and system

    CN121357000A