Task execution method and device based on heterogeneous computing resources, equipment and medium
By segmenting the multi-level simulation model into independent simulation tasks and building dependencies and priorities between tasks, the problem of not being able to fully utilize CPU and GPU resources in the existing technology is solved, and efficient simulation task execution is achieved.
Patent Information
- Application Number
- CN202510315674.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-04-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing simulation model scheduling methods cannot fully utilize the computing resources of the CPU and GPU, resulting in insufficiency of scheduling and inability to coordinate the processing of simulation scheduling tasks, resulting in wasted computing resources.
By analyzing the multi-level simulation model, segmenting it into independently executable simulation tasks, extracting the heterogeneous computing resources required for each task, building dependencies between tasks, building directed acyclic graphs and setting task priorities, and dynamically adjusting the priority to make full use of heterogeneous computing resources.
The coordinated work of CPU and GPU is realized, making full use of heterogeneous computing resources, improving the execution efficiency of simulation tasks, and avoiding wasting computing resources.
Smart Images

Figure CN119829259A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of simulation technology, and in particular to a task execution method, device, equipment and medium based on heterogeneous computing resources. Background Art
[0002] In the simulation modeling of the joint combat simulation system, the existing simulation model scheduling method has the problem of low efficiency. The traditional simulation model scheduling method usually uses a single CPU or GPU for scheduling, which cannot fully utilize the computing resources of the CPU and GPU, resulting in low scheduling efficiency. The CPU is good at processing serial tasks, while the GPU is good at processing parallel tasks. If the simulation scheduling tasks can be reasonably divided and processed by the CPU and GPU in collaboration, the scheduling efficiency will be greatly improved.
[0003] Existing simulation model scheduling methods cannot fully utilize the computing resources of CPU and GPU, resulting in low scheduling efficiency. On the one hand, the CPU and GPU work independently and cannot collaboratively process simulation scheduling tasks, resulting in a waste of computing resources. On the other hand, existing methods cannot reasonably divide the serial and parallel parts according to the characteristics of the task, and cannot give full play to the advantages of CPU and GPU, resulting in low scheduling efficiency.
[0004] Therefore, a new simulation scheduling method is urgently needed to make full use of the computing resources of the CPU and GPU and improve scheduling efficiency. This method should be able to divide the model into serial and parallel parts according to the characteristics of the simulation model, and process them separately by the CPU and GPU, so as to achieve the collaborative work of the CPU and GPU, thereby greatly improving the efficiency of simulation scheduling. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a task execution method based on heterogeneous computing resources to solve the technical problem that heterogeneous computing resources cannot be fully utilized in the prior art. The method includes: Parse a multi-level simulation model, divide the multi-level simulation model into independently executable simulation tasks, extract the heterogeneous computing resources required for each simulation task, build a dependency relationship between the simulation task and other simulation tasks based on the association between the simulation tasks in the multi-level simulation model, and use the heterogeneous computing resources of the simulation task and the dependency relationship between the simulation tasks as the task attributes of the simulation task; Constructing a directed acyclic graph according to the task attributes of the simulation task, setting a simulation task priority for the simulation task in the directed acyclic graph, and calling the heterogeneous computing resources to execute the simulation task according to the directed acyclic graph; During the task execution process, when one simulation task is completed, the simulation task priority corresponding to the subsequent simulation task is dynamically adjusted, and the remaining simulation tasks are executed based on the adjusted simulation task priority until all the simulation tasks in the multi-level simulation model are processed.
[0006] The embodiment of the present invention also provides a task execution device based on heterogeneous computing resources to solve the technical problem that heterogeneous computing resources cannot be fully utilized in the prior art. The device includes: A task attribute acquisition module, used for parsing a multi-level simulation model, dividing the multi-level simulation model into independently executable simulation tasks, extracting the heterogeneous computing resources required for each simulation task, building a dependency relationship between the simulation task and other simulation tasks based on the association between the simulation tasks in the multi-level simulation model, and using the heterogeneous computing resources of the simulation task and the dependency relationship between the simulation tasks as the task attributes of the simulation task; A directed acyclic graph construction module is used to construct a directed acyclic graph according to the task attributes of the simulation task, set a simulation task priority for the simulation task in the directed acyclic graph, and call the heterogeneous computing resources to execute the simulation task according to the directed acyclic graph; The dynamic priority adjustment module is used to dynamically adjust the simulation task priority corresponding to the subsequent simulation task after one simulation task is completed during the task execution process, and execute the remaining simulation tasks based on the adjusted simulation task priority until all the simulation tasks in the multi-level simulation model are processed.
[0007] An embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned task execution methods based on heterogeneous computing resources when executing the computer program, so as to solve the technical problem in the prior art that the computing resources of the CPU and GPU cannot be fully utilized.
[0008] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program for executing any of the above-mentioned task execution methods based on heterogeneous computing resources, so as to solve the technical problem in the prior art that heterogeneous computing resources cannot be fully utilized.
[0009] Compared with the prior art, the beneficial effects that can be achieved by at least one of the above technical solutions adopted in the embodiments of this specification include at least: By calculating the simulation task priority at the beginning of the task and dynamically updating the simulation task priority during the task execution, the execution order can be changed more effectively according to the task execution situation, making full use of heterogeneous computing resources and improving the execution efficiency of simulation tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0011] Figure 1 is a flowchart of a task execution method based on heterogeneous computing resources provided by an embodiment of the present invention; Figure 2 is a flowchart of a method for implementing the above-mentioned task execution method based on heterogeneous computing resources provided by an embodiment of the present invention; Figure 3 is a structural block diagram of a computer device provided by an embodiment of the present invention; Figure 4 It is a structural block diagram of a task execution device based on heterogeneous computing resources provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0012] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0013] The following describes the implementation methods of the present application through specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0014] In an embodiment of the present invention, a task execution method based on heterogeneous computing resources is provided, such as Figure 1 As shown, the method includes: Step S101: parsing a multi-level simulation model, dividing the multi-level simulation model into independently executable simulation tasks, extracting the heterogeneous computing resources required for each simulation task, and constructing a dependency relationship between the simulation task and other simulation tasks based on the association between the simulation tasks in the multi-level simulation model, and using the heterogeneous computing resources of the simulation task and the dependency relationship between the simulation tasks as the task attributes of the simulation task; Step S102: constructing a directed acyclic graph according to the task attributes of the simulation task, setting a simulation task priority for the simulation task in the directed acyclic graph, and calling the heterogeneous computing resources to execute the simulation task according to the directed acyclic graph; Step S103: During the task execution process, when one simulation task is completed, the simulation task priority corresponding to the subsequent simulation task is dynamically adjusted, and the remaining simulation tasks are executed based on the adjusted simulation task priority until all the simulation tasks in the multi-level simulation model are processed.
[0015] In specific implementation, the following steps are performed to construct a directed acyclic graph according to the task attributes of the simulation task: A task identifier is set for the simulation task, a predecessor task and a successor task of the simulation task are obtained from the dependency relationship, and an execution type is obtained from the attributes of the simulation task, wherein the execution type includes parallel processing and serial processing; the processing time, resource type and resource quantity required for the simulation task are obtained from the heterogeneous computing resources, wherein the resource types include CPU and GPU, and the resource quantity includes memory size, number of cores and bandwidth; a directed acyclic graph is generated according to the execution type, the predecessor task and the successor task of the simulation task, and the task identifier, the processing time, the resource type and the resource quantity are marked as the task description of the simulation task in each node of the directed acyclic graph.
[0016] Specifically, use JSON / YAML or a custom structure to build a directed acyclic graph and a description of the directed acyclic graph. The task description includes the task identifier (defining the unique ID of the simulation task), dependencies (including the predecessor task of the current simulation task (the current simulation task can only be executed after the predecessor task is executed) and the successor task (the successor task can only be executed after the current task is executed), execution type (serial processing (such as logical judgment, I / O operation, management of task dependencies, parsing simulation models, triggering task execution flow, etc., serial tasks can be executed sequentially through CPU Workers) and parallel processing (such as matrix operations in simulation modeling, particle interaction calculations, graphics rendering, etc.)), the number of resources required (CPU memory, CPU bandwidth, GPU core, GPU memory, GPU bandwidth required to execute the simulation task) and other information.
[0017] In the joint combat simulation model, the CPU is responsible for the execution of the main thread, the allocation of thread resources for components that can be executed in parallel, the management of the thread pool, the scheduling of GPU resources, and the data synchronization of multi-threaded operations. The GPU mainly completes the core computing functions of the components and feeds the calculation results back to the CPU. The CPU and GPU work together, each performing its own duties. The CPU is responsible for completing the operation logic scheduling of the serially executable part of the signal-level model and the thread management of the parallel executable part, while the GPU focuses on solving the simulation model. For example, in the simulation of combat damage, the CPU is responsible for processing and updating the numerical values of the combat damage, and the GPU parallelly calculates the physical manifestation of the damage.
[0018] In specific implementation, setting the simulation task priority for the simulation task in the directed acyclic graph is achieved through the following steps: Through the processing time of the simulation task, the longest processing time from the starting task of the directed acyclic graph to any one of the simulation tasks and the shortest processing time from the end task of the directed acyclic graph to any one of the simulation tasks are obtained; the simulation task whose longest processing time is equal to the shortest processing time is taken as a key task; the directed acyclic graph is topologically sorted to obtain the hierarchy of the sorted simulation tasks in the directed acyclic graph, and the hierarchy without the dependency is set as the highest; the number of resources of the simulation task is obtained, the demand ratio of the number of resources in the total number of resources of the heterogeneous computing resources is calculated, the hierarchy coefficient and the additional weight of the key task are set, and the task priority of the simulation task is determined according to the hierarchy, the hierarchy coefficient, the additional weight of the key task and the resource coefficient.
[0019] Specifically, based on the topological sorting of the directed acyclic graph, the hierarchical allocation is performed (the directed acyclic graph is topologically sorted, and basic priorities are assigned according to the hierarchical level, and the nodes without dependencies have the highest hierarchical level), and the hierarchical coefficient (for example, 9, 10, 11, etc.) is determined; the longest processing time from the starting task of the directed acyclic graph to any simulation task (the longest path time from the starting point to the current node) and the shortest processing time from the end point to any node (reverse calculation from the end point to ensure the latest start time that does not delay the overall completion time) are obtained, and the nodes (simulation tasks) that meet the requirement that the earliest start time (longest processing time) is equal to the latest start time (shortest processing time) are set as critical paths, and the nodes on the critical path are given additional weights of critical tasks based on their hierarchical level (for example, by increasing by 100, 150, etc.); finally, the priority is adjusted according to the demand for task resources (resource coefficient), for example, GPU-intensive tasks (high resource demand) can have their priority appropriately increased to avoid idle resources, and lightweight tasks (low resource demand) can have their priority reduced to reduce resource contention. The resource factor can be calculated in proportion to the required memory (such as the GPU required memory and the CPU required memory) required by the simulation task (such as increasing the resource factor by 5 for every GB of memory).
[0020] Task priority calculation formula: Task priority (i) = level (i) × level coefficient + additional weight of key task (i) + resource coefficient (i), where i is a node in the directed acyclic graph (i.e., simulation task).
[0021] In specific implementation, the following steps are performed to call the heterogeneous computing resources to execute the simulation task according to the directed acyclic graph: The main thread is started through the CPU, and the directed acyclic graph is parsed through the main thread; according to the task priority in the directed acyclic graph, an execution order list of the simulation task is generated, and the main thread executes the tasks in sequence according to the execution order list; if the execution type is the serial processing, after the current simulation task is completed, the CPU is triggered by the main thread to process the only successor task of the current simulation task; if the execution type is the parallel processing, after the current simulation task is completed, multiple GPU threads are started simultaneously through the main thread to process all the successor tasks that are not mutually dependent, a thread pool is built through the CPU to uniformly manage all GPU threads, and time synchronization processing is performed on all GPU threads through the main thread.
[0022] Specifically, the process of executing the simulation task when calling the heterogeneous computing resources is as follows: Figure 2 shown.
[0023] In specific implementation, the following steps are performed to dynamically adjust the priority of subsequent simulation tasks after the simulation task processing is completed: Set path criticality for the simulation task and key task respectively; obtain the estimated remaining time for processing the remaining simulation task; obtain the resource coefficient of the simulation task, perform S-curve mapping on the resource coefficient, and calculate the resource shortage; calculate the priority of the simulation task through the path criticality, path criticality weight, the estimated remaining time, the estimated remaining time weight, the resource shortage weight and the resource shortage.
[0024] The timing for dynamically adjusting the priority of subsequent simulation tasks may be: when the predecessor task of a node is completed, the priority of subsequent simulation tasks is adjusted; when heterogeneous computing resources are insufficient, the priority of subsequent simulation tasks is adjusted; when the actual time consumed by the simulation task exceeds the estimate, the priority of subsequent tasks is increased proportionally.
[0025] Specifically, in one embodiment, the dynamic task priority can be calculated by the following formula: Task priority (i) = initial task priority (i) × . The initial task priority is the simulation task priority set before the simulation task is executed. The total estimated time is calculated by adding the processing time of each remaining simulation task. The remaining critical path time is calculated by adding the processing time of each remaining critical task. This method calculates a new simulation task priority based on the initial task priority, with a small amount of calculation and a fast calculation speed.
[0026] Specifically, in another embodiment, the path criticality weight is set , estimated remaining time weight , resource scarcity and resource scarcity weight , the sum of the three weights is 1. Set the path criticality for the simulation task and the key task respectively (e.g. the path criticality of the simulation task is set to 0.3, and the path criticality of the key task is set to 1). Resource scarcity is used to increase the priority of simulation tasks that occupy less resources when resources such as CPU memory, CPU threads, GPU memory, and GPU computing flow are tight. The resource coefficient of the simulation task is mapped to an S curve to obtain the resource scarcity. Through path criticality, path criticality weight , estimated remaining time, remaining time weight Calculate the task priority.
[0027] .
[0028] This method is based on the estimated remaining time and the usage of heterogeneous computing resources. By adjusting the weights of each resource, it can better make dynamic adjustments based on the current task execution status.
[0029] In specific implementation, the following steps are used to synchronize the GPU and CPU: Marking execution milestones in the GPU, and driving CPU polling or CPU waiting according to the execution milestones; or, tracking the completion status of the GPU's parallel tasks through the GPU's atomic counter and synchronizing it to the CPU; or, setting a shared memory space, wherein the shared memory space is used to store data that needs to be transmitted between the CPU and the GPU.
[0030] Specifically, when there is data dependency, resource competition, or timing consistency between the CPU and GPU, the GPU and CPU need to be synchronized to improve the efficiency of task execution.
[0031] In specific implementation, the following steps are used to improve the parallel computing capability of GPUs through multi-threading or multi-GPU computing flows: Start multiple threads of the GPU, divide the simulation area of the simulation task into multiple sub-areas, and use each GPU thread to process one sub-area; or, split the simulation task into multiple time windows based on the time axis through a time stepping algorithm, and use multiple GPU computing streams to simultaneously calculate the simulation tasks of different time windows, and use the GPU computing stream to overlap the data transmission of the next time window with the calculation of the current time window; or, obtain the memory hierarchy of the GPU, and hierarchically cache the intermediate data generated in the simulation task according to the memory hierarchy.
[0032] Specifically, in the modeling task of rendering the joint combat simulation system, the 3D grid is divided into blocks (which can be divided according to the segmentation standards of the fluid grid or particle system), and each GPU computing stream processes a 3D grid. It can also reduce the amount of tasks for each GPU computing stream when the load is high, and merge tasks when the load is low. The time stepping algorithm can use the Parareal algorithm, etc. The memory hierarchy can be global memory, shared memory, and registers from high to low. In the modeling task of rendering the joint combat simulation system, the position coordinates are loaded into the shared memory in blocks to calculate short-range forces, etc.
[0033] In this embodiment, a computer device is provided, such as Figure 3 As shown, it includes a memory 301, a processor 302, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any of the above-mentioned task execution methods based on heterogeneous computing resources is implemented.
[0034] Specifically, the computer device may be a computer terminal, a server or a similar computing device.
[0035] In this embodiment, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program for executing any of the above-mentioned task execution methods based on heterogeneous computing resources.
[0036] Specifically, computer-readable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs or other data. Examples of computer-readable storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0037] Based on the same inventive concept, a task execution device based on heterogeneous computing resources is also provided in an embodiment of the present invention, as described in the following embodiments. Since the principle of solving the problem by the task execution device based on heterogeneous computing resources is similar to that of the task execution method based on heterogeneous computing resources, the implementation of the task execution device based on heterogeneous computing resources can refer to the implementation of the task execution method based on heterogeneous computing resources, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements the predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0038] Figure 4 is a structural block diagram of a task execution device based on heterogeneous computing resources according to an embodiment of the present invention. Figure 4 As shown, it includes: a task attribute acquisition module 401, a directed acyclic graph construction module 402 and a dynamic priority adjustment module 403. The structure is described below.
[0039] The task attribute acquisition module 401 is used to parse the multi-level simulation model, divide the multi-level simulation model into independently executable simulation tasks, extract the heterogeneous computing resources required for each simulation task, and build the dependency relationship between the simulation task and other simulation tasks according to the association between the simulation tasks in the multi-level simulation model, and use the heterogeneous computing resources of the simulation task and the dependency relationship between the simulation tasks as the task attributes of the simulation task; A directed acyclic graph construction module 402 is used to construct a directed acyclic graph according to the task attributes of the simulation task, set a simulation task priority for the simulation task in the directed acyclic graph, and call the heterogeneous computing resources to execute the simulation task according to the directed acyclic graph; The dynamic priority adjustment module 403 is used to dynamically adjust the simulation task priority corresponding to the subsequent simulation task when one simulation task is completed during the task execution process, and execute the remaining simulation tasks based on the adjusted simulation task priority until all the simulation tasks in the multi-level simulation model are processed.
[0040] In one embodiment, constructing a directed acyclic graph module includes: A data acquisition unit, used to set a task identifier for the simulation task, acquire a predecessor task and a successor task of the simulation task from the dependency relationship, and acquire an execution type from an attribute of the simulation task, wherein the execution type includes parallel processing and serial processing; A computing resource acquisition unit, used to acquire the processing time, resource type and resource quantity required for the simulation task from the heterogeneous computing resources, wherein the resource type includes CPU and GPU, and the resource quantity includes memory size, core number and bandwidth; A directed acyclic graph generation unit is used to generate a directed acyclic graph according to the execution type, the predecessor task, and the successor task of the simulation task, and mark the task identifier, the processing time, the resource type and the resource quantity as the task description of the simulation task in each node of the directed acyclic graph.
[0041] In one embodiment, constructing a directed acyclic graph module further includes: A processing time calculation unit, used to obtain the longest processing time from the starting task of the directed acyclic graph to any one of the simulation tasks and the shortest processing time from the end task of the directed acyclic graph to any one of the simulation tasks through the processing time of the simulation tasks; Determine a key task unit, used for taking the simulation task whose longest processing time is equal to the shortest processing time as a key task; Obtaining a hierarchical unit, used for topologically sorting the directed acyclic graph, obtaining the hierarchical level of the sorted simulation task in the directed acyclic graph, and setting the hierarchical level without the dependency relationship as the highest; A resource coefficient calculation unit, used to obtain the resource quantity of the simulation task, calculate the demand ratio of the resource quantity in the total resource quantity of the heterogeneous computing resources, and calculate the resource coefficient according to the demand ratio; A priority setting unit is used to set the level coefficient and the additional weight of the key task, and determine the task priority of the simulation task according to the level, the level coefficient, the additional weight of the key task and the resource coefficient.
[0042] In one embodiment, constructing a directed acyclic graph module further includes: A main thread starting unit, used to start the main thread through the CPU, and parse the directed acyclic graph through the main thread; A task execution unit, used to generate an execution order list of the simulation tasks according to the task priorities in the directed acyclic graph, and the main thread executes the tasks in sequence according to the execution order list; A serial processing unit, configured to trigger the CPU to process the only subsequent task of the current simulation task through the main thread after the current simulation task is completed if the execution type is the serial processing; A parallel processing unit is used for, if the execution type is the parallel processing, after the current simulation task is completed, starting multiple GPU threads at the same time through the main thread to process all the subsequent tasks that are not mutually dependent, building a thread pool through the CPU to uniformly manage all GPU threads, and performing time synchronization for all GPU threads through the main thread. When the simulation task is completed, dynamically adjust the subsequent step processing.
[0043] In one embodiment, constructing a directed acyclic graph module further includes: A criticality calculation unit, used for setting path criticality for the simulation task and the critical task respectively; A remaining time calculation unit, used to obtain an estimated remaining time for processing the remaining simulation tasks; A scarcity calculation unit, used to obtain a resource coefficient of the simulation task, map the resource coefficient into an S curve, and calculate the resource scarcity; The update priority unit is used to calculate the simulation task priority through the path criticality, the path criticality weight, the estimated remaining time, the estimated remaining time weight, the resource shortage weight and the resource shortage.
[0044] In one embodiment, the above device further includes a synchronization module.
[0045] In one embodiment, the synchronization module includes: A first state synchronization unit is used to mark an execution milestone in the GPU, and drive CPU polling or CPU waiting according to the execution milestone; or A second state synchronization unit, used to track the completion status of the parallel tasks of the GPU through the atomic counter of the GPU, and synchronize it to the CPU; or, The memory sharing unit is used to set a shared memory space, where the shared memory space is used to store data that needs to be transmitted between the CPU and the GPU.
[0046] In one embodiment, the above device further includes a parallel processing module.
[0047] In one embodiment, the parallel processing module further includes: A multi-thread processing unit is used to start multiple threads of the GPU, divide the simulation area of the simulation task into multiple sub-areas, and use each GPU thread to process one of the sub-areas; or, A multi-computation stream processing unit, used for splitting the simulation task into multiple time windows based on the time axis through a time stepping algorithm, calculating the simulation tasks of different time windows simultaneously through multiple GPU calculation streams, and overlapping the data transmission of the next time window with the calculation of the current time window by using the GPU calculation stream; or, The memory level cache unit is used to obtain the memory level of the GPU and hierarchically cache the intermediate data generated in the simulation task according to the memory level.
[0048] The embodiments of the present invention achieve the following technical effects: The embodiment of the present invention makes full use of the computing resources of the CPU and GPU through the collaborative work of heterogeneous computing resources, thereby improving the efficiency of simulation scheduling; the embodiment of the present invention reasonably divides the simulation scheduling task into serial and parallel parts, which are processed by the CPU and GPU respectively, thereby realizing the collaborative work of the CPU and GPU, avoiding the waste of computing resources, and greatly improving the efficiency of simulation scheduling; the execution process of the main thread and the parallel thread optimizes the task execution process, thereby further improving the efficiency of simulation task scheduling; by calculating the simulation task priority at the beginning of the task and dynamically updating the simulation task priority during the task execution process, the execution order is more effectively changed according to the task execution situation, thereby better utilizing heterogeneous computing resources; ensuring the timing consistency of the CPU and GPU, improving the synchronization rate of the GPU and CPU to improve the efficiency of simulation task execution; utilizing the characteristics of joint combat simulation, effectively segmenting the simulation task, and utilizing the multi-threading and multi-computing streams of the GPU to accelerate the processing efficiency of the simulation task.
[0049] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0050] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A task execution method based on heterogeneous computing resources, characterized in that: include: Parse a multi-level simulation model, divide the multi-level simulation model into independently executable simulation tasks, extract the heterogeneous computing resources required for each simulation task, build a dependency relationship between the simulation task and other simulation tasks based on the association between the simulation tasks in the multi-level simulation model, and use the heterogeneous computing resources of the simulation task and the dependency relationship between the simulation tasks as the task attributes of the simulation task; Constructing a directed acyclic graph according to the task attributes of the simulation task, setting a simulation task priority for the simulation task in the directed acyclic graph, and calling the heterogeneous computing resources to execute the simulation task according to the directed acyclic graph; During the task execution process, when one simulation task is completed, the simulation task priority corresponding to the subsequent simulation task is dynamically adjusted, and the remaining simulation tasks are executed based on the adjusted simulation task priority until all the simulation tasks in the multi-level simulation model are processed.
2. The task execution method based on heterogeneous computing resources according to claim 1, characterized in that: Constructing a directed acyclic graph according to the task attributes of the simulation task, including: Setting a task identifier for the simulation task, obtaining a predecessor task and a successor task of the simulation task from the dependency relationship, and obtaining an execution type from an attribute of the simulation task, wherein the execution type includes parallel processing and serial processing; Obtaining the processing time, resource type and resource quantity required for the simulation task from the heterogeneous computing resources, wherein the resource type includes CPU and GPU, and the resource quantity includes memory size, number of cores and bandwidth; A directed acyclic graph is generated according to the execution type, the predecessor task and the successor task of the simulation task, and the task identifier, the processing time, the resource type and the resource quantity are marked as the task description of the simulation task in each node of the directed acyclic graph.
3. The task execution method based on heterogeneous computing resources according to claim 2, characterized in that: Setting a simulation task priority for the simulation task in the directed acyclic graph includes: Obtain the longest processing time from the starting point task of the directed acyclic graph to any one of the simulation tasks and the shortest processing time from the ending point task of the directed acyclic graph to any one of the simulation tasks through the processing time of the simulation tasks; The simulation task whose longest processing time is equal to the shortest processing time is taken as a key task; Performing topological sorting on the directed acyclic graph, obtaining the levels of the sorted simulation tasks in the directed acyclic graph, and setting the level without the dependency relationship as the highest; Obtaining the number of resources for the simulation task, calculating the demand ratio of the number of resources in the total number of resources of the heterogeneous computing resources, and calculating the resource coefficient according to the demand ratio; The level coefficient and the additional weight of the key task are set, and the task priority of the simulation task is determined according to the level, the level coefficient, the additional weight of the key task and the resource coefficient.
4. The task execution method based on heterogeneous computing resources according to claim 2, characterized in that: According to the directed acyclic graph, calling the heterogeneous computing resources to execute the simulation task includes: Starting a main thread through a CPU, and parsing the directed acyclic graph through the main thread; Generate an execution order list of the simulation tasks according to the task priorities in the directed acyclic graph, and the main thread executes the tasks in sequence according to the execution order list; If the execution type is the serial processing, after the current simulation task is completed, the main thread triggers the CPU to process the only subsequent task of the current simulation task; If the execution type is the parallel processing, after the current simulation task is completed, multiple GPU threads are started simultaneously through the main thread to process all the subsequent tasks that are not mutually dependent, a thread pool is built through the CPU to uniformly manage all GPU threads, and all GPU threads are synchronized in time through the main thread.
5. The task execution method based on heterogeneous computing resources according to claim 2, characterized in that: When the simulation task processing is completed, dynamically adjusting the simulation task priority corresponding to the subsequent simulation task includes: Set path criticality for the simulation task and the key task respectively; Obtaining an estimated remaining time for processing the remaining simulation tasks; Obtaining a resource coefficient of the simulation task, performing S-curve mapping on the resource coefficient, and calculating the resource scarcity; The simulation task priority is calculated by using the path criticality, the path criticality weight, the estimated remaining time, the estimated remaining time weight, the resource shortage weight and the resource shortage.
6. The task execution method based on heterogeneous computing resources according to any one of claims 1 to 5, characterized in that: Also includes: Marking execution milestones in the GPU, and driving CPU polling or CPU waiting according to the execution milestones; or, Track the completion status of the GPU's parallel tasks through the GPU's atomic counter and synchronize it to the CPU; or, A shared memory space is set, where the shared memory space is used to store data that needs to be transmitted between the CPU and the GPU.
7. The task execution method based on heterogeneous computing resources according to any one of claims 1 to 5, characterized in that: Also includes: Starting multiple threads of the GPU, dividing the simulation area of the simulation task into multiple sub-areas, and using each GPU thread to process one of the sub-areas; or, Splitting the simulation task into multiple time windows based on the time axis through a time stepping algorithm, calculating the simulation tasks of different time windows simultaneously through multiple GPU computing streams, and overlapping the data transmission of the next time window with the calculation of the current time window by using the GPU computing stream; or, The memory level of the GPU is obtained, and the intermediate data generated in the simulation task is cached hierarchically according to the memory level.
8. A task execution device based on heterogeneous computing resources, characterized in that: include: A task attribute acquisition module, used for parsing a multi-level simulation model, dividing the multi-level simulation model into independently executable simulation tasks, extracting the heterogeneous computing resources required for each simulation task, building a dependency relationship between the simulation task and other simulation tasks based on the association between the simulation tasks in the multi-level simulation model, and using the heterogeneous computing resources of the simulation task and the dependency relationship between the simulation tasks as the task attributes of the simulation task; A directed acyclic graph construction module is used to construct a directed acyclic graph according to the task attributes of the simulation task, set a simulation task priority for the simulation task in the directed acyclic graph, and call the heterogeneous computing resources to execute the simulation task according to the directed acyclic graph; The dynamic priority adjustment module is used to dynamically adjust the simulation task priority corresponding to the subsequent simulation task after one simulation task is completed during the task execution process, and execute the remaining simulation tasks based on the adjusted simulation task priority until all the simulation tasks in the multi-level simulation model are processed.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the task execution method based on heterogeneous computing resources described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the task execution method based on heterogeneous computing resources according to any one of claims 1 to 7.
Citation Information
Patent Citations
Simulation system and method applied to scheduling system
CN116560811A
Parallel scheduling method and system based on digital twin simulation system
CN117909038A
MOM system global resource cooperative scheduling and tracking mapping method
CN118277273A
Cited By
Laboratory automatic data processing and management method, system, equipment and medium
CN120278484A
A laboratory automated data processing and management method, system, device, and medium
CN120278484B
Simulation scheduling method and system combining static scheduling and centralized scheduling
CN120849104A
A simulation scheduling method and system combining static scheduling and centralized scheduling
CN120849104B
Graphics card workstation intelligent configuration method based on reinforcement learning
CN121143888A