A parallel task division method based on entity load

Through the parallel task division method based on entity load, the entity is dynamically adjusted to the computing node with the smallest load, solving the load balancing problem in large-scale real-time simulation in Unreal Engine UE5, and improving simulation efficiency and resource utilization.

CN117648190BActive Publication Date: 2025-08-05INST OF WAR STUDIES ACAD OF MILITARY SCI OF THE CHINESE PEOPLES LIBERATION ARMY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311665658.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2025-08-05
Estimated Expiration
2043-12-06

AI Technical Summary

Technical Problem

When large-scale real-time simulation is performed in Unreal Engine UE5, a single computing node cannot meet the needs, and the existing technology cannot achieve load balancing and efficiency improvement on parallel computing nodes.

Method used

The parallel task division method based on entity loads is achieved by obtaining the load of the computing node, dynamically adjusting and allocating the entity to the target computing node with the smallest load, and using greedy algorithms and switching state control of the parallel entity to realize load balancing and parallel computing.

Benefits of technology

Improve the computing efficiency of large-scale real-time simulation, realize load balancing on parallel computing nodes, and make full use of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117648190B_ABST
    Figure CN117648190B_ABST
Patent Text Reader

Abstract

The present application relates to a method for dividing parallel tasks based on entity load. The method can obtain the load of multiple computing nodes, wherein the load of the computing node is determined according to the entity load corresponding to the entity on the computing node; the target computing node is determined according to the load of each computing node; and the computing task of the entity is allocated to the corresponding target computing node according to the entity load. The method can allocate multiple entities to different computing nodes for parallel computing, thereby improving the efficiency of large-scale real-time simulation. In addition, the present application divides the computing tasks of the entity based on the load of each computing node, which can achieve the purpose of load balancing on parallel computing nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of simulation technology, and in particular to a parallel task partitioning method based on entity load. Background Art

[0002] Unreal Engine UE5 is an advanced real-time 3D authoring tool that can be used for large-scale simulation scenarios. However, when performing large-scale simulations, a single computing node will not be able to meet the real-time simulation requirements. Exploring how to perform large-scale real-time simulations in UE5 is of great significance.

[0003] In traditional computer systems, tasks are executed sequentially, meaning one task must complete before the next can begin. Parallel computing is a technology that utilizes multiple processing units or computing resources in a computer system to execute tasks simultaneously. This improves the traditional sequential execution problem of tasks. Appropriate use of parallel computing can improve computer performance and efficiency.

[0004] Parallel computing can be applied in a variety of fields, including scientific computing, image processing, data analysis, and the large-scale real-time simulations mentioned above in UE5. During UE5's actual operation, each entity performs different tasks and has a different load. Simply dividing parallel tasks based on entity type cannot achieve balanced distribution across parallel computing nodes. Therefore, developing a unified task division method is a challenge that needs to be addressed. Summary of the Invention

[0005] Based on this, it is necessary to provide a parallel task division method based on physical load to address the above technical problems.

[0006] The present application provides a parallel task partitioning method based on entity load, the method comprising:

[0007] Obtaining loads of multiple computing nodes, wherein the loads of the computing nodes are determined according to entity loads corresponding to entities on the computing nodes;

[0008] Determining a target computing node according to the load of each computing node;

[0009] Allocating the current entity to the target computing node according to the entity load of the current entity;

[0010] The load of the target computing node is updated, and the process returns to the step of determining the target computing node until all entities are allocated.

[0011] The Unreal Engine includes a load list for storing the load of each computing node; and determining the target computing node according to the load of each computing node further includes:

[0012] The load list is traversed, and a computing node with the smallest load is determined as the target computing node.

[0013] The method further comprises:

[0014] The entity load corresponding to the at least one entity is determined respectively according to the running time required when the computing task of the entity is executed on the computing node.

[0015] The Unreal Engine further includes a parallel identifier and a parallel entity list for storing at least one parallel entity; if the current entity is a parallel entity, allocating the current entity to the target computing node according to the entity load of the current entity further includes:

[0016] According to the order of the parallel entities in the parallel entity list, the current entity is determined, and the current entity is allocated to the target computing node; wherein the parallel entities are arranged in descending order according to the entity loads corresponding to the parallel entities in the parallel entity list.

[0017] The method further comprises:

[0018] If the current entity is a parallel entity, controlling the operation of the parallel entity on the target computing node according to a switch of the parallel entity on the target computing node;

[0019] If the switch of the parallel entity on the target computing node is in an on state, the computing task of the entity is controlled to run on the target computing node.

[0020] The method further comprises:

[0021] Determining whether the current entity is a parallel entity according to the parallel identifier of the current entity;

[0022] If the value of the parallel identifier of the current entity is the first value, determining that the current entity is a parallel entity, and adding the current entity to the parallel entity list;

[0023] If the value of the parallel identifier of the current entity is the second value, it is determined that the current entity is a non-parallel entity.

[0024] The Unreal Engine further includes a physical switch interface; and the method further includes:

[0025] Obtaining a switch flag value corresponding to the current entity through the entity switch interface;

[0026] If the switch flag value corresponding to the current entity is a first preset value, the switch of the current entity on the target computing node is set to an on state, and the switch of the current entity is added to the first state set;

[0027] If the switch flag value corresponding to the current entity is a second preset value, the switch of the current entity on the target computing node is set to an off state, and the switch of the current entity is added to a second state set.

[0028] The method further comprises:

[0029] If the current entity is a non-parallel entity, the computing task of the non-parallel entity is allocated to the target computing node.

[0030] The Unreal Engine further includes a two-dimensional array, and the two-dimensional array is used to store the allocation result of the at least one entity; the method further includes:

[0031] Storing the computing task of the current entity and its corresponding target computing node in the two-dimensional array;

[0032] One dimension of the two-dimensional array is used to represent each computing node, and another dimension of the two-dimensional array is used to represent an entity that allocates the computing node.

[0033] The method further comprises:

[0034] Initializing a sending buffer of the current computing node according to the parallel entity allocated to the current computing node;

[0035] Initialize the receive buffer according to all parallel entities;

[0036] Traversing the parallel entities allocated on the current computing node, and filling the status information of each parallel entity on the current computing node into a sending buffer;

[0037] Collecting state information of all parallel entities on the plurality of computing nodes into the receiving buffer;

[0038] The state information of the parallel entity on the current computing node is updated according to the receiving buffer area of the current computing node.

[0039] The parallel task partitioning method based on entity load in the embodiment of the present application uses entity load to characterize the different computing tasks of each entity to obtain the load of each computing node. The load of each computing node can be updated in real time, and the target computing node is determined based on the load of the computing node. The current entity is allocated to the target computing node based on the entity load of the current entity, so that the computing tasks of at least one entity can be allocated to multiple computing nodes for parallel computing, thereby improving the efficiency of large-scale real-time simulation. In addition, the present application divides the computing tasks of entities based on the load of each computing node, which can achieve the purpose of load balancing on parallel computing nodes. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 1 is a flow chart of a method for partitioning parallel tasks based on entity load in one embodiment;

[0041] Figure 2 1 is a flow chart of a method for dividing parallel tasks based on physical load in another embodiment;

[0042] Figure 3 Schematic diagram of a process for determining a switch Tick of an entity in one embodiment;

[0043] Figure 4 A schematic diagram of the allocation result of entity computing tasks in one embodiment;

[0044] Figure 5 Schematic diagram of a flow chart of a method for synchronizing data between different entities in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0046] Unreal Engine UE5 is an advanced real-time 3D authoring tool that can be used for large-scale simulation scenarios. However, when performing large-scale simulations, a single computing node will not be able to meet the real-time simulation requirements. Exploring how to perform large-scale real-time simulations in UE5 is of great significance.

[0047] In traditional computer systems, tasks are executed sequentially, meaning that one task must complete before the next can begin. Parallel computing is a technology that utilizes multiple processing units or computing resources in a computer system to execute tasks simultaneously. This improves the sequential execution of tasks in traditional computers. Appropriate use of parallel computing can improve computer performance and efficiency. Parallel task partitioning is a key component of parallel computing technology. It divides a large task into multiple subtasks that can be executed simultaneously on different processing units or computing resources. When performing parallel task partitioning, it is important to consider the complexity of the tasks, their dependencies, and the availability of computing resources.

[0048] Parallel task partitioning is used in many fields, including scientific computing, image processing, data analysis, and the large-scale real-time simulation in UE5 mentioned above. However, parallel task partitioning also faces challenges, such as load balancing, communication overhead, and data dependencies, which require the use of appropriate algorithms and technologies. Proper task partitioning can improve computing speed and throughput, achieve load balancing, avoid overloading certain computing nodes, and reduce synchronization and communication overhead, thereby fully utilizing computing resources and improving overall computing efficiency.

[0049] During the actual UE5 runtime, each entity (i.e., simulated entity) performs different tasks and experiences different loads. Even the same entity experiences different loads when performing different tasks at different times. This makes it impossible to achieve load balancing by simply partitioning tasks based on entity type. Therefore, a unified task partitioning method for entities with different computing tasks is a challenge that needs to be addressed.

[0050] Based on the above technical problems, the present application provides a parallel task partitioning method based on entity load, which first abstracts the entity load (Overhead) of the entity. Secondly, based on the idea of greedy algorithm, the method sorts the entity loads of all entities and assigns the entities to the target computing node with the smallest current load, thereby achieving load balancing between the computing nodes. Finally, the method can determine whether the computing tasks of the parallel entity are calculated on the target computing node based on the switch (Tick) of the parallel entity, so that the computing tasks of multiple entities can be assigned to different computing nodes, and the computing efficiency of large-scale simulation can be improved through parallel computing of multiple computing nodes.

[0051] like Figure 1 As shown, this application provides a parallel task partitioning method based on entity load for large-scale simulation in Unreal Engine. The user can create at least one simulation body (i.e., entity), each entity is used to complete one or more computing tasks, where computing tasks include but are not limited to position updates, simulated photography, etc. The method includes:

[0052] S110. Obtain load amounts of multiple computing nodes, wherein the load amounts of the computing nodes are determined according to entity loads corresponding to entities on the computing nodes.

[0053] To improve the computational efficiency of large-scale simulations, the present application may distribute the computational tasks of the at least one entity to multiple computing nodes for parallel computation. The load of each computing node is used to evaluate the load corresponding to the computational tasks on that computing node. The load of each computing node may be the sum of the entity loads of all entities assigned to that computing node. The computational tasks of the entities assigned to that computing node are executed by that computing node.

[0054] The entity load of each entity represents the load generated when the entity is running on the computing node. Optionally, the entity load of each entity can be determined based on the runtime required for the entity's computing tasks to be executed on the computing node. Specifically, the method of the present application can calculate the runtime of the entity's computing tasks when they are serially executed on the computing node, and determine the entity load of the entity based on the runtime.

[0055] Furthermore, when each entity performs different computing tasks, its corresponding entity load is also different; even if the same entity performs different computing tasks at different times, its corresponding entity load is also different. Therefore, the embodiment of the present application dynamically adjusts the value of the entity load when the entity performs different computing tasks.

[0056] S120: Determine a target computing node according to the load of each computing node.

[0057] This application can traverse the load of each computing node and select a target computing node from multiple computing nodes.

[0058] Optionally, the present application may determine the computing node with the smallest load among multiple computing nodes as the target computing node, so as to avoid multiple entities being assigned to the same computing node, thereby ensuring load balancing among the computing nodes.

[0059] S130. Allocate the current entity to the target computing node according to the entity load of the current entity;

[0060] Alternatively, the current entity can be any one of multiple entities, and the current entity is assigned to the target computing node. Alternatively, multiple entities can be assigned to the currently determined target computing node in a specific order, and the current entity can be the entity currently to be assigned among the multiple entities. For example, multiple entities can be sorted according to the size of their entity loads, and the entities selected as the current entities in order of the sorting results are selected, thereby assigning the current entity to the target computing node with the smallest current load.

[0061] S140: Update the load of the target computing node, and return to step S120 to re-determine the target computing node until the allocation of all entities is completed.

[0062] After the current entity is assigned to the target computing node, the method of the embodiment of the present application can update the load of the target node, and the load of the updated target computing node can be equal to the sum of the load of the target computing node before the update and the entity load of the current entity assigned to the target computing node. Afterwards, the method of the embodiment of the present application can reselect a new target computing node based on the updated load of the target computing node and the load of other computing nodes, and assign the next current entity to be assigned to the new target computing node. This process is repeated until all entities are assigned. In the embodiment of the present disclosure, the target computing node can be updated, and the target computing nodes corresponding to two sequentially adjacent entities can be the same computing node or different computing nodes. The current target computing node is determined based on actual conditions.

[0063] The parallel task partitioning method based on entity load in the embodiment of the present application uses entity load to characterize the different computing tasks of each entity to obtain the load of each computing node. The load of each computing node can be updated in real time, and the target computing node is determined based on the load of the computing node. The current entity is allocated to the target computing node based on the entity load of the current entity, so that the computing tasks of at least one entity can be allocated to multiple computing nodes for parallel computing, thereby improving the efficiency of large-scale real-time simulation. In addition, the present application divides the computing tasks of entities based on the load of each computing node, which can achieve the purpose of load balancing on parallel computing nodes.

[0064] In one embodiment, the Unreal Engine provides a parallel entity manager class (UParallelActorManager), which has a new attribute: a load list of floating point type (Float), which is used to store the load of each computing node. For example, the load list can be expressed as:

[0065] TArray <float>OverHeadsForEachProcs; wherein, the load amount OverHeadsForEachProcs of each computing node may be equal to the sum of the entity loads of the entities allocated to the computing node.

[0066] Based on this, the above step of determining the target computing node may further include:

[0067] Traverse the load list and determine the computing node with the smallest load as the target computing node; wherein, the embodiment of the present application can traverse the above-mentioned load list, find the computing node with the current smallest load, and determine the computing node with the current smallest load as the target computing node, thereby ensuring load balancing on each computing node.

[0068] Furthermore, after allocating the current entity to the target computing node, the embodiment of the present application may also update the load of the target computing node based on the entity load of the current entity allocated to the target computing node. The load of the target computing node after the update may be equal to the sum of the load of the target computing node before the update and the entity load of the current entity allocated to the target computing node. The method of the embodiment of the present application can update the load of the target computing node by updating the above-mentioned load list, so as to determine the target computing node corresponding to the next entity by traversing the load list.

[0069] Furthermore, the Unreal Engine's parallel entity management class further provides a property: a two-dimensional pointer data of the AActor type, wherein the two-dimensional array is used to store the allocation result of the at least one entity. For example, the Unreal Engine may provide the following two-dimensional pointer array:

[0070] TArray <TArray<AActor*> >ActorsListsForEachProcs; where ActorsListsForEachProcs represents a parallel entity on each compute node.

[0071] The method of the embodiment of the present application can also store the current entity and its corresponding target computing node in the two-dimensional array; wherein, one dimension of the two-dimensional array is used to represent each computing node, and another dimension of the two-dimensional array is used to represent the entity assigned to the computing node.

[0072] In one embodiment, the at least one entity may include parallel entities that can be executed in parallel and non-parallel entities that cannot be executed in parallel. In the embodiment of the present application, the above-mentioned parallel entities and non-parallel entities can be assigned to multiple computing nodes for parallel computing, and the corresponding relationship between each computing node and its assigned entity can be determined. Figure 2 As shown, the above method includes:

[0073] S210: Determine a parallel entity in the at least one entity;

[0074] The at least one entity may include parallel entities and non-parallel entities. A parallel entity represents an entity capable of performing parallel operations, while a non-parallel entity represents an entity that does not perform parallel operations. The application may first determine whether the at least one entity is a parallel entity that requires parallel operations.

[0075] Optionally, the Unreal Engine entity may have additional attributes: a parallel identifier (e.g., bParallelctor) and an entity payload (Overhead). The parallel identifier may have a data type of unit8, and the entity payload may have a data type of float. Of course, in other embodiments, the parallel identifier may have a data type of other types such as int8, and the entity payload may have a data type of half. This is merely an example and does not limit the specific data types of the parallel identifier and entity payload.

[0076] Furthermore, optionally, a list can be added to the parallel entity management class provided by the Unreal Engine to store parallel entities, which is recorded as a parallel entity list. For example, the following code can be added to the Unreal Engine source code:

[0077] TArray<AActor*> ParallelActorList, where ParallelActorList is a parallel entity list for storing parallel entities. The parallel entities in the parallel entity list are sorted in descending order of their entity load, so that the parallel entities in the parallel entity list can be allocated to the target computing nodes in order.

[0078] Based on this, during the initialization of the Unreal Engine, the method can add a parallel entity of at least one entity to the parallel entity list. The above step S210 also includes determining whether the entity is a parallel entity based on the parallel identifier of the entity. Specifically, the parallel identifier can be represented by a numerical value. The above step S210 can determine whether the numerical value of the parallel identifier of the entity is a first value;

[0079] If the value of the parallel identifier of the entity is a first value, the entity is determined to be a parallel entity and is added to the parallel entity list. For example, the first value may be 1. If the value of the parallel identifier bParallelctor is 1, the entity is determined to be a parallel entity and is added to the parallel entity list ParallelActorList. If the value of the parallel identifier of the entity is a second value, the entity is determined to be a non-parallel entity. For example, the second value may be 0. If the value of the parallel identifier bParallelctor is 0, the entity is determined to be a non-parallel entity.

[0080] In other embodiments, the parallel identifier may also be represented by other means such as a character string, which is only used for illustrative purposes and is not intended to limit the specific representation of the parallel identifier.

[0081] S220, sorting the entity load of each parallel entity to obtain a sorting result, and storing each parallel entity into a parallel entity list according to the sorting result;

[0082] During the initialization of the virtual engine, the method of the present application can arrange the above-mentioned parallel entities in descending order according to the size of their corresponding entity loads, obtain a sorting result, and store the above-mentioned parallel entities in a parallel entity list according to the sorting result.

[0083] S230: Determine a target computing node based on the load of each computing node. Referring to the above embodiment, the method of the present application can traverse the load list and select the computing node with the smallest load as the target computing node.

[0084] S240: Determine the current entity according to the order of the parallel entities in the parallel entity list, and assign the current entity to the target computing node. In this embodiment of the present application, since the aforementioned parallel entities are stored in the parallel entity list in descending order of the size of their entity loads, the method can sequentially determine the current entity according to the order of the parallel entities in the parallel entity list, and assign each current entity to a corresponding target computing node.

[0085] S250: Update the load of the target computing node and return to step S230 until all parallel entities in the parallel entity list are assigned. The step of updating the load of the target computing node may include adding the entity load of the current entity to the load of the target computing node and updating the load list. After completing the assignment of the current parallel entity, the next parallel entity and its corresponding target computing node may be re-determined until all parallel entities are assigned.

[0086] For example, there are parallel entities A, B, C, D, and E in the parallel entity list; the entity loads corresponding to the above parallel entities A, B, C, D, and E decrease in sequence. The multiple computing nodes can be: computing node 1, computing node 2, computing node 3, computing node 4, and computing node 5. In the initial state, computing node 1 has the smallest load. The method of the embodiment of the present application can implement the allocation of each parallel entity in the following manner:

[0087] First assignment: First, select the first parallel entity A in the parallel entity list (i.e., the parallel entity with the heaviest load) as the current entity, select compute node 1, which currently has the least load, as the target compute node, and assign parallel entity A to the target compute node (i.e., compute node 1). Next, update the load of compute node 1 and re-determine the target compute node with the least load. For example, the new target compute node is node 2.

[0088] Second assignment: This method uses the second parallel entity B in the parallel entity list as the current entity and assigns it to the new target compute node (compute node 2). It then updates the load of compute node 2 and re-determines the target compute node with the lowest load. For example, the new target compute node is node 3.

[0089] Third assignment: This method uses the third parallel entity C in the parallel entity list as the current entity and assigns it to a new target compute node (compute node 3). It then updates the load of compute node 3 and re-determines the target compute node with the lowest load. For example, the new target compute node is node 4.

[0090] Fourth assignment: This method uses the fourth parallel entity D in the parallel entity list as the current entity and assigns it to a new target compute node (compute node 4). It then updates the load of compute node 4 and re-determines the target compute node with the lowest load. For example, the new target compute node is node 5.

[0091] Second allocation: This method takes the last parallel entity E in the parallel entity list as the current entity, and allocates the current entity E to the new target computing node (computing node 5). After that, the load of computing node 5 is updated.

[0092] The method of the embodiment of the present application distributes each parallel entity to the target computing node with the smallest current load in descending order, which can ensure that the load on each computing node is balanced and that parallel entities with smaller entity loads perform redundant calculations on the computing nodes, thereby fully utilizing the computing power of the computing nodes.

[0093] In one embodiment, the method of the embodiment of the present application can also determine whether the parallel entity is running on its assigned target computing node by calling the Tick function, wherein the Tick function is used to determine the entity switch Tick of the parallel entity on the corresponding target computing node. Figure 2 , the above method further includes:

[0094] S260: Control the operation of the parallel entity on the corresponding target computing node based on the switch of the parallel entity on the corresponding target computing node. In the embodiment of the present application, the method can determine the operation of the computing task of each parallel entity on the corresponding target computing node based on the state of the switch Tick of each parallel entity on the corresponding target computing node. The entity switch Tick of the parallel entity on the target computing node can include an enabled state (Enabled) and a disabled state (Disabled).

[0095] Optionally, if the switch Tick of the parallel entity on the target node is in the on state, the computing task of the entity is controlled to run on the target computing node; if the switch Tick of the parallel entity on the target computing node is in the off state, it indicates that the target computing node will not run the computing task of the parallel entity.

[0096] In an embodiment of the present application, the Unreal Engine provides two state combinations: a first state set AllEnabledTickFunctions and a second state set AllDishabledTickFunctions. The first state set is used to store entity switches in the on state, i.e., on ticks, and the second state set is used to store entity switches in the off state, i.e., off ticks. The method of the embodiment of the present application can traverse the first state set in each frame and control the computing tasks of the entities corresponding to the entity ticks in the first state set to run on the corresponding target computing nodes. The entity ticks in the second state set will not be executed by the target computing nodes to which they are assigned, i.e., there is no entity load.

[0097] Optionally, the Unreal Engine provides an entity switch interface to assign the entity Tick to the first state set or the second state set. Figure 3 As shown, the method further includes:

[0098] S310: Obtain a switch flag value corresponding to the entity through the entity switch interface;

[0099] For example, the physical switch interface may be an API (Application Program Interface), such as void FTickFunction::SetTickFunctionEnable(bool bInEnabled). The Unreal Engine may determine whether to disable the physical switch Tick based on the value of the parameter bInEnabled (switch flag value) passed into the physical switch interface.

[0100] S320: Determine whether the switch flag value corresponding to the current entity is a first preset value;

[0101] If the switch flag value bInEnabled corresponding to the current entity is a first preset value, step S430 is executed to set the switch Tick of the current entity on the corresponding target computing node to the on state, and the switch Tick of the current entity is added to the first state set. If the switch flag value bInEnabled corresponding to the current entity is a second preset value, step S440 is executed to set the switch Tick of the current entity on the corresponding target computing node to the off state, and the switch Tick of the current entity is added to the second state set.

[0102] For example, if the switch flag value bInEnabled corresponding to the current entity is 1, it indicates that the entity's Tick needs to be enabled, the entity's Tick switch on the assigned target compute node is set to the on state, and the entity's Tick switch is added to the first state set AllEnabledTickFunctions. If the switch flag value bInEnabled corresponding to the entity is 0, it indicates that the entity's Tick needs to be disabled, the entity's Tick switch on the assigned target compute node is set to the off state, and the entity's Tick switch is added to the second state set AllDisabledTickFunctions.

[0103] In one embodiment, the method of the embodiment of the present application can also process non-parallel entities in at least one entity. If the entity is a non-parallel entity, the computing task of the non-parallel entity is assigned to the target computing node, that is, the computing task of the non-parallel entity is executed by the target computing node. The target computing node can be the computing node with the smallest current load. In this way, the target computing node only performs operations on the computing tasks of the non-parallel entity and the computing tasks corresponding to the parallel entity whose entity switch Tick is turned on.

[0104] like Figure 5 As shown, taking the computing node Node0 No. 0 among multiple computing nodes as an example, Node0 can be the target computing node. At least one entity can be divided into a parallel entity and a non-parallel entity. Among them, the computing tasks of the non-parallel entity are assigned to the target computing node Node 0, such as the entity shown by the car in the figure. One of the parallel entities in the parallel entity list can be assigned to the target computing node Node 0 in descending order, and then the Unreal Engine can control whether the parallel entity runs on the computing node Node 0 according to the switch Tick of the parallel entity assigned to Node 0. As shown Figure 4 The black drones in the figure represent the parallel entities running on the computing node, that is, the computing node Node 0 can be used to execute the computing tasks corresponding to the parallel entities represented by the black drones; Figure 4 The gray drones in the figure represent parallel entities that are not running on the computing node Node 0. That is, the computing tasks corresponding to the parallel entities represented by the gray drones will be assigned to other computing nodes except the computing node Node0 for computing.

[0105] In one embodiment, since the calculation of parallel entities other than the node will be calculated by other computing nodes, if data synchronization is not performed, errors may occur when executing some tasks. For example, when performing a rendering task, it may happen that the entity that should be photographed is not captured, and there is a situation where there is no collision when there should be a collision. Therefore, in order to avoid this situation, the embodiment of the present application can use MPI to synchronize the states between the various computing nodes to ensure data consistency between the various computing nodes.

[0106] Optionally, in order to achieve MPI synchronization, the embodiment of the present application can use the MPI_Type_create_struct() function to define the synchronization information data structure. The synchronization information data structure of each computing node may include a sending buffer and a receiving buffer. Among them, the sending buffer is a memory space, which is used to send the status information of the entity on the current computing node, and the receiving buffer is a memory space, which is used to receive the status information of all entities. In the embodiment of the present application, the status information of the entity includes but is not limited to the coordinates, posture and other data of the entity. Figure 5 As shown, the method further includes:

[0107] S510. Initialize a send buffer of the current computing node based on the parallel entities assigned to the current computing node; the current computing node may be one of multiple computing nodes. For example, the current computing node may be a target computing node, and the parallel entities assigned to the target computing node may be multiple parallel entities assigned to the target computing node based on the load of the target computing node. For specific allocation methods, see the embodiments described above. Optionally, in embodiments of the present application, the process of initializing the send buffer of the current computing node may be the process of creating a send buffer on the current computing node.

[0108] S520: Initialize a receive buffer of the current computing node based on all parallel entities; wherein all parallel entities may be all parallel entities capable of parallel operation on multiple computing nodes. Optionally, in this embodiment of the present application, the process of initializing the receive buffer of the current computing node may be the process of creating a receive buffer on the current computing node.

[0109] S530. Traverse the parallel entities allocated on the current computing node and fill the status information of each parallel entity on the current computing node into the sending buffer; that is, after initializing the sending buffer, this method can store the status information corresponding to each parallel entity on the current computing node into the sending buffer, so as to synchronize the status information of the parallel entities on the current computing node to other computing nodes.

[0110] S540. Gather the status information of all parallel entities on the multiple computing nodes into the receiving buffer. In this embodiment of the present application, when sending and collecting synchronization data, the collective communication function MPI_Allgatherv() provided by MPI can be selected to gather the status information of all parallel entities on the multiple computing nodes. MPI_Allgatherv() is used to gather the status information of all parallel entities on the multiple computing nodes and store the status information of all parallel entities in the receiving buffer.

[0111] S550: Update the status information of the parallel entity on the current computing node according to the receiving buffer area of the current computing node, thereby ensuring the consistency of data of each computing node and achieving data synchronization between different computing nodes.

[0112] The method of the embodiment of the present application can ensure that, after synchronizing data between various computing nodes, entities that are not calculated at this node can update corresponding position, rotation angle and other information, although they are not calculated at this node, thereby ensuring that other computing entities can capture these entities that do not participate in the calculation of this node, perform physical collisions, etc.

[0113] It should be understood that although Figure 1-Figure 3 as well as Figure 5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1-Figure 3 as well as Figure 5 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0114] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are 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.

[0115] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.< / float>

Claims

1. A parallel task partitioning method based on physical load, characterized in that: Applied in Unreal Engine, the method includes: Obtaining loads of multiple computing nodes, wherein the loads of the computing nodes are determined according to entity loads corresponding to entities on the computing nodes; Determining a target computing node according to the load of each computing node; Allocating the current entity to the target computing node according to the entity load of the current entity; Updating the load of the target computing node and returning to the step of determining the target computing node until all entities are allocated; wherein the Unreal Engine further includes an entity switch interface; and the method further includes: If the current entity is a parallel entity, controlling the operation of the parallel entity on the target computing node according to the switch of the parallel entity on the target computing node; wherein the switch of the parallel entity on the target computing node is determined by the parameter value input by the entity switch interface; if the switch of the parallel entity on the target computing node is in the on state, controlling the computing task of the entity to run on the target computing node; If the current entity is a non-parallel entity, the computing task of the non-parallel entity is allocated to the target computing node.

2. The method according to claim 1, characterized in that The Unreal Engine includes a load list for storing the load of each computing node; and determining the target computing node according to the load of each computing node further includes: The load list is traversed, and a computing node with the smallest load is determined as the target computing node.

3. The method according to claim 1, characterized in that The method further comprises: An entity load corresponding to at least one entity is determined according to a running time required when the computing task of the entity is executed on the computing node.

4. The method according to claim 1, wherein The Unreal Engine further includes a parallel identifier and a parallel entity list for storing at least one parallel entity; if the current entity is a parallel entity, allocating the current entity to the target computing node according to the entity load of the current entity further includes: According to the order of the parallel entities in the parallel entity list, the current entity is determined, and the current entity is allocated to the target computing node; wherein the parallel entities are arranged in descending order according to the entity loads corresponding to the parallel entities in the parallel entity list.

5. The method according to claim 4, characterized in that The method further comprises: Determining whether the current entity is a parallel entity according to the parallel identifier of the current entity; If the value of the parallel identifier of the current entity is the first value, determining that the current entity is a parallel entity, and adding the current entity to the parallel entity list; If the value of the parallel identifier of the current entity is the second value, it is determined that the current entity is a non-parallel entity.

6. The method according to claim 1, characterized in that The method further comprises: Obtaining a switch flag value corresponding to the current entity through the entity switch interface; If the switch flag value corresponding to the current entity is a first preset value, the switch of the current entity on the target computing node is set to an on state, and the switch of the current entity is added to the first state set; If the switch flag value corresponding to the current entity is a second preset value, the switch of the current entity on the target computing node is set to an off state, and the switch of the current entity is added to a second state set.

7. The method according to claim 1, characterized in that The Unreal Engine further includes a two-dimensional array, wherein the two-dimensional array is used to store the allocation result of at least one entity; and the method further includes: Storing the computing task of the current entity and its corresponding target computing node in the two-dimensional array; One dimension of the two-dimensional array is used to represent each computing node, and another dimension of the two-dimensional array is used to represent an entity that allocates the computing node.

8. The method according to claim 4, characterized in that The method further comprises: Initializing a sending buffer of the current computing node according to the parallel entity allocated to the current computing node; Initialize the receive buffer according to all parallel entities; Traversing the parallel entities allocated on the current computing node, and filling the status information of each parallel entity on the current computing node into a sending buffer; Collecting state information of all parallel entities on the plurality of computing nodes into the receiving buffer; The state information of the parallel entity on the current computing node is updated according to the receiving buffer area of the current computing node.

Citation Information

Patent Citations

  • Load balancing method of aircraft distributed system stimulation

    CN103281393A

  • Load balance method, cloud platform computing method and cloud platform

    CN105471985A