Dynamic load balancing method and device, electronic equipment and storage medium

In the fluid particle coupling simulation, the coarse grid weight is determined according to the calculation time of particles and fluid grids, and the in-process re-division is carried out, the problem of load imbalance in the fluid particle coupling simulation is solved, and the operation speed of the simulation is improved and efficiency.

CN119067000APending Publication Date: 2024-12-03INSTITUTE OF PROCESS ENGINEERING CHINESE ACADEMY OF SCIENCES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310629614.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In large-scale fluid particle coupling simulation, it is difficult for the prior art to achieve load balancing between processes, resulting in uneven calculation time and affecting parallel efficiency.

Method used

Dynamic load balancing of particles and fluid mesh calculation time in the process is achieved by determining the calculation time of particles and fluid mesh in the process, calculating coarse mesh weights, and based on these weights, the coarse mesh re-division and target process matching in the process is carried out to achieve dynamic load balancing of particles and fluid mesh.

Benefits of technology

The operation speed of fluid particle coupling simulation is improved, the uniform distribution of loads of all processes is achieved, and the efficiency of parallel simulation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067000A_ABST
    Figure CN119067000A_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic load balancing method and device, electronic equipment and a storage medium. The method comprises the following steps: determining a coarse grid matched with a process; wherein the process comprises at least one coarse mesh; the coarse grid comprises at least one particle or fluid grid; determining particle calculation time and fluid grid calculation time in the process; according to the particle calculation time and the fluid grid calculation time, determining a coarse grid weight in the process; based on the weight of the coarse grid in the process, re-dividing the coarse grid in the process, and determining a target process matched with the coarse grid; and sending the to-be-sent particles and fluid grids in the process to the target process to perform particle and fluid grid parallel simulation based on the target process so as to achieve load balance of all processes. According to the technical scheme, the problem of load imbalance in large-scale fluid particle coupling parallel simulation is solved, and the running speed of fluid particle coupling simulation is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of numerical simulation technology, and in particular to a dynamic load balancing method, device, electronic equipment and storage medium. Background Art

[0002] Particle-fluid multiphase systems are widely used in process industries such as chemical, metallurgical, energy, and food. More than 50% of industrial products are particulate matter. CFD-DEM (fluid-particle coupling) simulation has become a powerful tool for studying this system. However, in process industries, the number of particles can reach trillions, which restricts the simulation scale of particle-fluid multiphase systems. Generally, multi-process parallel computing is required, and regional decomposition is used to divide the simulation system into multiple sub-regions. Each process is responsible for one sub-region, and all processes are solved in parallel.

[0003] For large-scale multi-physics parallel simulation, the overall computing time depends on the time taken by the slowest running process. Only when the computing load is evenly distributed among all processes can a higher parallel efficiency be achieved. How to efficiently design and implement CFD-DEM parallel simulation between processes to achieve global load balance is an urgent problem to be solved in current CFD-DEM simulation. Summary of the invention

[0004] The present invention provides a dynamic load balancing method, device, electronic device and storage medium, which solves the problem of load imbalance in large-scale fluid-particle coupling simulation and improves the running speed of fluid-particle coupling simulation.

[0005] According to one aspect of the present invention, a dynamic load balancing method is provided, the method comprising:

[0006] Determine a coarse grid matching the process; wherein the process is a fluid-particle coupling simulation process; the coarse grid is obtained by dividing the area where the simulation object having a particle phase and a fluid phase is located; the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid;

[0007] Determine the particle calculation time and fluid grid calculation time within the process;

[0008] Determining a coarse grid weight within the process according to the particle calculation time and the fluid grid calculation time;

[0009] Re-dividing the coarse grid in the process based on the coarse grid weight in the process, and determining a target process matching the coarse grid;

[0010] The particles and fluid grids to be sent in the process are sent to the target process, so as to perform parallel simulation of the particles and fluid grids based on the target process, thereby achieving load balancing of all processes.

[0011] According to another aspect of the present invention, a dynamic load balancing device is provided, the device comprising:

[0012] A matching relationship determination module is used to determine a coarse grid that matches a process; wherein the process is a fluid-particle coupling simulation process; the coarse grid is obtained by dividing the area where the simulation object having a particle phase and a fluid phase is located; the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid;

[0013] A calculation time determination module, used to determine the particle calculation time and fluid grid calculation time within the process;

[0014] A coarse grid weight determination module, used to determine the coarse grid weight in the process according to the particle calculation time and the fluid grid calculation time;

[0015] A target process determination module, configured to re-divide the coarse grid in the process based on the coarse grid weight in the process, and determine a target process matching the coarse grid;

[0016] The particle and fluid grid sending module is used to send the particles and fluid grids to be sent in the process to the target process, so as to perform parallel simulation of particles and fluid grids based on the target process, thereby achieving load balancing of all processes.

[0017] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0018] at least one processor; and

[0019] a memory communicatively connected to the at least one processor; wherein,

[0020] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a dynamic load balancing method described in any embodiment of the present invention.

[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a dynamic load balancing method described in any embodiment of the present invention when executed.

[0022] The technical solution of the embodiment of the present invention is to determine the coarse grid that matches the process; wherein the process contains at least one coarse grid; the coarse grid contains at least one particle or fluid grid; determine the particle calculation time and fluid grid calculation time in the process; determine the coarse grid weight in the process according to the particle calculation time and fluid grid calculation time; based on the coarse grid weight in the process, re-divide the coarse grid in the process and determine the target process that matches the coarse grid; send the particles and fluid grids to be sent in the process to the target process, so as to perform parallel simulation of particles and fluid grids based on the target process, thereby achieving load balancing of all processes. This technical solution solves the problem of load imbalance in large-scale fluid-particle coupling simulation and improves the running speed of fluid-particle coupling simulation.

[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 is a flow chart of a dynamic load balancing method provided according to Embodiment 1 of the present invention;

[0026] Figure 2 This is a flow chart of a dynamic load balancing algorithm based on a coarse grid provided in Example 1 of the present application;

[0027] Figure 3 is a schematic diagram of a dynamic load balancing algorithm based on a coarse grid provided in Example 1 of the present application;

[0028] Figure 4 (a) is a schematic diagram of the coarse grid division process provided in Example 1 of the present application;

[0029] Figure 4 (b) is a schematic diagram of the coarse grid division result provided in Example 1 of the present application;

[0030] Figure 5 (a) The range in which the central shadow process provided in the first embodiment of the present application needs to receive data from the surrounding processes;

[0031] Figure 5 (b) The process at the center shadow provided in Embodiment 1 of the present application receives data from surrounding processes;

[0032] Figure 6 A calculation result of simulating bubbling fluidization provided in Example 1 of the present application;

[0033] Figure 7 A schematic diagram of a dynamic load balancing process provided in Embodiment 2 of the present invention;

[0034] Figure 8 A schematic diagram of the structure of a dynamic load balancing device provided in Embodiment 3 of the present invention;

[0035] Fig. 9 It is a structural schematic diagram of an electronic device for implementing a dynamic load balancing method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0036] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0038] Embodiment 1

[0039] Figure 1 This is a flow chart of a dynamic load balancing method provided according to the first embodiment of the present invention. This embodiment is applicable to the case of handling the load imbalance problem of each process in the fluid particle coupling parallel simulation. The method can be executed by a dynamic load balancing device. The dynamic load balancing device can be implemented in the form of hardware and / or software. The dynamic load balancing device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0040] S110, determining a coarse grid that matches a process; wherein the process is a fluid-particle coupling simulation process; the coarse grid is obtained by dividing the area where a simulation object having a particle phase and a fluid phase is located; the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid.

[0041] In this embodiment, dynamic load balancing is mainly for CFD-DEM simulation based on CPU-GPU heterogeneous architecture. It can be applied to two types of simulation object systems. Optionally, it can be applied to simulation objects with particle phase and fluid phase.

[0042] In this solution, the region where the simulation object having the particle phase and the fluid phase is located may be referred to as a simulation region, and the simulation region includes a plurality of particle and fluid grids, wherein the matching relationship between the simulation region and the process may be pre-set.

[0043] The coarse grids may be rectangular grids of the same size.

[0044] In this embodiment, the simulation area can be divided using a coarse grid so that the coarse grid covers the entire simulation area. The division based on the coarse grid can ensure that the particles and fluid grids in the same area are divided into the same process, avoiding a large amount of data exchange between CFD and DEM processes.

[0045] Furthermore, after the simulation area is divided, the particles and fluid grids in the simulation area can be mapped to the coarse grid, that is, the coarse grid to which the particles belong and the coarse grid to which the fluid grid belongs can be determined. The coarse grid matching each process can also be determined based on the matching relationship between the simulation area and the process. The coarse grid matching each process can be one or more.

[0046] In this scheme, in each process, a cell can be set to cover the sub-area calculated by this process, and a one-to-one correspondence between the coarse grid and the cell can be established. Among them, the cell size is larger than the coarse grid size. Then all particles are traversed, and the cell to which they belong is calculated. According to the correspondence between the cell and the coarse grid, the coarse grid closest to the particle is found from the 27 neighboring cells, which is the coarse grid to which the particle belongs. Similarly, all fluid grids are traversed, and the cell to which they belong is calculated. According to the correspondence between the cell and the coarse grid, the coarse grid closest to the fluid grid is found from the 27 neighboring cells, which is the coarse grid to which the center of the fluid grid belongs.

[0047] In this embodiment, Figure 2 is a flow chart of a dynamic load balancing algorithm based on a coarse grid provided in the first embodiment of the present application, such as Figure 2As shown, the simulation area is first initialized, that is, the simulation area is divided based on the coarse grid. When the computational load of each process is unbalanced, the coarse grid weights in each process are calculated and re-divided into new processes for simulation, so as to achieve load balance for all processes.

[0048] In this program, Figure 3 is a schematic diagram of a dynamic load balancing algorithm based on a coarse grid provided in Example 1 of the present application, such as Figure 3 As shown, the particle and fluid grids in the simulation area are mapped to the coarse grid, so that the load balancing of all processes is achieved based on the coarse grid.

[0049] S120, determining the particle calculation time and fluid grid calculation time within the process.

[0050] In this embodiment, during the particle and fluid grid simulation process, each process will count the particle calculation time and the fluid grid calculation time within the process at every preset number of steps.

[0051] S130, determining a coarse grid weight within the process according to the particle calculation time and the fluid grid calculation time.

[0052] In this embodiment, if Figure 2 As shown, the weight of each fluid grid relative to each particle can be calculated based on the particle calculation time and the fluid grid calculation time within the process, and the coarse grid weight within the process can be determined based on the weight of each fluid grid relative to each particle, that is, the computational load of each coarse grid can be determined.

[0053] S140: re-divide the coarse grid in the process based on the coarse grid weight in the process, and determine a target process that matches the coarse grid.

[0054] In this embodiment, if Figure 2As shown, based on the weight of the coarse grid in the process, the coarse grid in the process can be re-divided so that the weight of the coarse grid in each process is the same, so that the computational load of the computational area of ​​each process can be evenly distributed. For example, the fluid-particle coupling simulation process includes process a and process b, and the coarse grid includes coarse grid 1, coarse grid 2, coarse grid 3 and coarse grid 4, and the weights of coarse grid 1, coarse grid 2, coarse grid 3 and coarse grid 4 are the same. The coarse grid that matches process a is coarse grid 1; the coarse grid that matches process b is coarse grid 2, coarse grid 3 and coarse grid 4. By re-dividing the coarse grid in the process, any coarse grid among coarse grid 2, coarse grid 3 and coarse grid 4 in process b is reallocated to process a, and the computational load of process a and process b is evenly distributed. Assuming that coarse grid 2 is reallocated to process a, the process matched by coarse grid 2 is changed from process b to process a.

[0055] Optionally, re-dividing the coarse grid in the process includes:

[0056] The coarse grid in the process is re-divided based on a preset dynamic region decomposition algorithm.

[0057] In this solution, the dynamic domain decomposition algorithm may include orthogonal recursive bisection, space filling curve partitioning, graph partitioning, diffusion partitioning and other algorithms.

[0058] In this embodiment, Figure 4 (a) is a schematic diagram of the coarse grid division process provided in Example 1 of the present application, Figure 4 (b) is a schematic diagram of the coarse grid division result provided in Example 1 of the present application. Figure 4 (a) and Figure 4 As shown in (b), the coarse grid can be re-divided using a dynamic domain decomposition algorithm based on orthogonal recursive bisection.

[0059] By re-dividing the coarse grid, the execution time of the dynamic domain decomposition algorithm itself can be reduced, and the computational load within each process can be evenly classified, thereby improving the simulation efficiency.

[0060] S150, sending the particles and fluid grids to be sent in the process to the target process, so as to perform parallel simulation of the particles and fluid grids based on the target process, thereby achieving load balancing for all processes.

[0061] The particles and fluid grids to be sent may refer to particles and fluid grids within a coarse grid of the re-dividing process.

[0062] In this embodiment, if Figure 2 As shown, the particles and fluid grids to be sent within a process can be sent to the target process through data transmission.

[0063] In this solution, after the coarse grid is re-divided, the computational load of each process is evenly distributed, and particle and fluid network simulations can be performed in parallel based on each process. The computing nodes in each process include CPU and GPU accelerators, and different accelerators can be used to simulate particles and fluid grids according to the simulation characteristics of particles and fluid grids. Specifically, the GPU can be used to simulate particles, and the CPU can be used to simulate fluid grids.

[0064] Optionally, sending the particles and fluid grids to be sent in the process to the target process includes steps A1-A2:

[0065] Step A1, receiving the process identifier sent by the target process through the process;

[0066] Step A2: according to the process identifier, the particles and fluid grids to be sent in the process are sent to the target process.

[0067] The process ID can be composed of letters, numbers or strings.

[0068] Specifically, after the coarse grid is divided, the target process has the original process ID of the new coarse grid, and the target process sends the coarse grid and the current process ID to the original process of the coarse grid using a parallel data exchange algorithm. The process sends the particle and fluid grids to the target process according to the received process ID.

[0069] By sending particles and fluid grids to the target process, the computational load of each process can be evenly distributed, achieving load balancing for multi-process CFD-DEM parallel simulation and improving operating efficiency.

[0070] Optionally, according to the process identifier, sending the particles and fluid grids to be sent in the process to the target process includes steps B1-B3:

[0071] Step B1, traversing all particles and fluid grids to be sent through the process to determine an information hash table; wherein the key of the information hash table is the process identifier that matches the particles and fluid grids to be sent; and the value of the information hash table is the number of particles and fluid grids to be sent received by the target process;

[0072] Step B2: Based on the information hash table, control the target process to apply for memory according to the value of the information hash table;

[0073] Step B3: All particles and fluid grids to be sent are stored according to the process identifier, and the particles and fluid grids to be sent are sent to the target process in sequence.

[0074] In this scheme, according to the process identifier, the particles and fluid grids to be sent in the process are sent to the parallel data exchange algorithm of the target process.

[0075] Specifically, the process sends the particles and fluid grids to be sent to the target process, including the following steps:

[0076] Step 1: The process traverses all particles and fluid grids to be sent to obtain an information hash table of all particles and fluid grids to be sent.

[0077] Step 2: The target process creates a remote window and initializes the cumulative value to 0. The process adds 1 to the cumulative value in the target process remote window according to the information hash table. The cumulative value in the target process remote window is the number of processes paired with it.

[0078] Step 3: The target process receives the number of particles and fluid grids to be sent from the process in turn.

[0079] Step 4: The target process re-applies for memory based on the number of particles and fluid grids to be sent and received.

[0080] Step 5: The process re-applies for a section of memory, and re-stores the particles and fluid grids to be sent according to the process ID of the target process, that is, the information sent to the target process is continuously stored.

[0081] Step 6: The process sends the particles and fluid grids to be sent to the target process in turn, and the target process receives them in turn according to the number of processes paired with it.

[0082] By sending particles and fluid grids to the target process, the computational load of each process can be evenly distributed, achieving load balancing for multi-process CFD-DEM parallel simulation and improving operating efficiency.

[0083] In this embodiment, after the coarse grid division is completed, a point-to-point communication method is adopted, and each process receives virtual particle information from all neighbor processes. Figure 5 (a) is the range of data that the central shadow process provided in the first embodiment of the present application needs to receive from the surrounding processes, Figure 5 (b) The process at the center shadow provided in Example 1 of the present application receives data from the surrounding processes. The point-to-point communication method is used to avoid the dependency of the current direction virtual area particle packing on the virtual particles received in the previous direction, so the packing part can be executed in parallel by the GPU. Since accelerators such as GPUs not only have more computing units, but also use higher bandwidth memories such as GDDR and HBM, this method can make full use of the high-speed memory of the GPU and reduce the time for data packing.

[0084] In this program, Figure 6The calculation result of simulating bubbling fluidization provided in Example 1 of this application can use 24 processes to simulate a bubbling fluidization. A total of 24 processes are used, each corresponding to a GPU and a CPU core. The computational load of each CFD grid is consistent, so the more particles there are, the greater the computational load. The initial particles accumulate at the bottom of the reactor, such as Figure 6 As shown in the figure, the cloud map reflects the initial bed expansion process. As the bed expands, the process division also changes. At 0.5s, a bubble is generated in the lower right corner of the reactor. The bubble grows and breaks on the dense phase surface at 1.0s. There are fewer particles inside the bubble, so the process simulation area where the bubble is located increases, thereby keeping the calculation load consistent with other processes.

[0085] The technical solution of the embodiment of the present invention is to determine the coarse grid that matches the process; wherein the process contains at least one coarse grid; the coarse grid contains at least one particle or fluid grid; determine the particle calculation time and fluid grid calculation time in the process; determine the coarse grid weight in the process according to the particle calculation time and fluid grid calculation time; based on the coarse grid weight in the process, re-divide the coarse grid in the process and determine the target process that the coarse grid matches; send the particles and fluid grids to be sent in the process to the target process, so as to perform parallel simulation of particles and fluid grids based on the target process, thereby achieving load balancing of all processes. By executing this technical solution, the problem of load imbalance in large-scale fluid-particle coupling simulation is solved, and the running speed of fluid-particle coupling simulation is improved.

[0086] Embodiment 2

[0087] Figure 7 This is a schematic diagram of a dynamic load balancing process provided by the second embodiment of the present invention. The relationship between this embodiment and the above embodiment is a detailed description of the coarse grid weight calculation process. Figure 7 As shown, the method includes:

[0088] S710, determining a coarse grid that matches a process; wherein the process is a fluid-particle coupling simulation process; the coarse grid is obtained by dividing the area where a simulation object having a particle phase and a fluid phase is located; the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid.

[0089] S720, determining the particle calculation time and fluid grid calculation time within the process.

[0090] S730. Calculate the average particle calculation time according to the particle calculation time and the number of particles in a preset process; and calculate the average fluid grid calculation time according to the fluid grid calculation time and the number of fluid grids in a preset process.

[0091] Among them, the number of particles and the number of fluid grids in the process can be counted after the simulation area is divided.

[0092] In this embodiment, the average particle calculation time can be calculated using the following formula:

[0093] Among them, t DEM Nr is the particle calculation time within the process particle is the number of particles in the process.

[0094] In this scheme, the average calculation time of the fluid grid can be calculated using the following formula:

[0095] Among them, t CFD is the fluid grid computation time within the process, Nr grid is the number of fluid grids in the process.

[0096] S740: Determine the weight of the fluid grid currently sampled in the process relative to the particle according to the average calculation time of the particle and the average calculation time of the fluid grid.

[0097] In this embodiment, the weight w of the fluid grid currently sampled in the process relative to the particle can be calculated using the following formula: i,k ;

[0098]

[0099] S750, calculating the Kalman gain based on the variance of the weight of the fluid grid currently sampled in the process relative to the particle and the predetermined variance of the weight of the fluid grid previously sampled in the process relative to the particle and environmental interference to obtain a target gain.

[0100] Specifically, the following formula can be used to calculate the variance of the weight of the fluid grid currently sampled in the process relative to the particle:

[0101]

[0102]

[0103] Among them, w′ k is the average weight of the fluid grid currently sampled in the process relative to the particle, N process The amount by which the fluid mesh currently being sampled in the process is weighted relative to the particle.

[0104] Among them, environmental interference can be obtained through experimental data.

[0105] In this embodiment, the program running process may be accompanied by various interferences, resulting in inaccurate weights of each fluid grid relative to each particle. Kalman filtering can be used to fuse information in uncertainty and recalculate the weights of each fluid grid relative to each particle.

[0106] Furthermore, the variance of the weight of the fluid grid currently sampled in the process relative to the particle, the variance of the weight of the fluid grid previously sampled in the process relative to the particle, and the environmental interference determined in advance may be calculated to determine the Kalman gain.

[0107] Optionally, the Kalman gain is calculated based on the variance of the weight of the fluid grid currently sampled relative to the particle in the process and the predetermined variance of the weight of the fluid grid previously sampled relative to the particle in the process and environmental interference to obtain the target gain, including steps C1-C3:

[0108] Step C1, adding the predetermined variance of the weight of the fluid grid sampled last time in the process relative to the particle and the environmental interference to determine a first result;

[0109] Step C2, adding the first result and the variance of the weight of the fluid grid currently sampled in the process relative to the particle to obtain a second result;

[0110] Step C3: Divide the first result by the second result to obtain a target gain.

[0111] In this embodiment, it is assumed that the variance of the weight of the fluid grid relative to the particle in the previous sampling process is Environmental disturbance is The target gain K can be calculated using the following formula:

[0112]

[0113]

[0114] By calculating the Kalman gain to calculate the coarse grid weight, the accuracy of the coarse grid weight calculation can be improved.

[0115] S760, determining the weight of the fluid grid relative to the particle according to the target gain, the average of the weight of the fluid grid currently sampled in the process relative to the particle, and the predetermined weight of the fluid grid previously sampled in the process relative to the particle.

[0116] In this embodiment, it is assumed that the weight of the fluid grid sampled previously in the process relative to the particle is w k-1 The weight w of the fluid grid relative to the particle in the process can be calculated using the following formula: k ;

[0117] w k =w k-1 +K(w′ k -w k-1 ).

[0118] S770, determining the weight of each coarse grid in all processes according to the weight of the fluid grid relative to the particle and the number of particles in the preset coarse grid and the number of fluid grids in the coarse grid.

[0119] After the coarse grid is divided, the number of particles and the number of fluid grids in the coarse grid can be statistically obtained.

[0120] In this example, the computational load of each coarse grid is calculated based on the weight of each fluid grid relative to each particle:

[0121] W=w k *cfd_grid+dem_particle.

[0122] Among them, cfd_grid is the number of fluid grids in the coarse grid, and dem_particle is the number of particles in the coarse grid.

[0123] Optionally, the weight of each coarse grid in all processes is determined according to the weight of the fluid grid relative to the particle and the number of particles in the preset coarse grid and the number of fluid grids in the coarse grid, including steps D1-D2:

[0124] Step D1, multiplying the weight of the fluid grid relative to the particle and the number of fluid grids in the coarse grid to obtain a first weight;

[0125] Step D2, multiplying the first weight and the preset weight coefficient, and adding the multiplication result and the number of particles in the coarse grid to obtain each coarse grid weight in all processes; wherein the preset weight coefficient is the fluid coefficient in the fluid-particle coupling simulation.

[0126] In this scheme, dynamic load balancing realizes uniform distribution of computational load by re-dividing the computational area of ​​each process. In CFD-DEM simulation, it is necessary to divide CFD grids and DEM particles at the same time, and optimize these two problems as a multi-objective optimization problem. The CFD part is given a larger weight as the objective function. Based on the calculation of the computational load of each CFD grid, the weight coefficient of CFD is multiplied, thereby converting the dynamic partitioning of multiple objectives into a single-objective dynamic partitioning problem.

[0127] Specifically, the coarse grid weight within the process can be calculated using the following formula:

[0128] W=λ*wk *cfd_grid+dem_particle

[0129] Among them, λ is the weight coefficient.

[0130] By calculating the coarse grid weight and adjusting the simulation area of ​​each process based on the coarse grid weight, the load of all processes can be balanced, thereby improving the simulation speed.

[0131] S780: Re-divide the coarse grid in the process based on the coarse grid weight in the process, and determine a target process that matches the coarse grid.

[0132] S790, sending the particles and fluid grids to be sent in the process to the target process, so as to perform parallel simulation of the particles and fluid grids based on the target process, thereby achieving load balancing for all processes.

[0133] The technical solution of the embodiment of the present invention is to determine a coarse grid that matches a process; wherein the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid; determine the particle calculation time and the fluid grid calculation time in the process; calculate the average particle calculation time according to the particle calculation time and the number of particles in the preset process; and calculate the average fluid grid calculation time according to the fluid grid calculation time and the number of fluid grids in the preset process; determine the weight of the fluid grid currently sampled in the process relative to the particle according to the particle average calculation time and the fluid grid average calculation time; based on the variance of the weight of the fluid grid currently sampled in the process relative to the particle and the predetermined weight of the fluid grid previously sampled in the process relative to the particle The Kalman gain is calculated based on the variance and environmental interference to obtain the target gain; the weight of the fluid grid relative to the particle is determined according to the target gain, the mean of the weight of the fluid grid currently sampled in the process relative to the particle, and the weight of the fluid grid sampled in the previous process relative to the particle in advance; the weight of each coarse grid in all processes is determined according to the weight of the fluid grid relative to the particle and the number of particles in the preset coarse grid and the number of fluid grids in the coarse grid; based on the coarse grid weight in the process, the coarse grid in the process is re-divided, and the target process matching the coarse grid is determined; the particles and fluid grids to be sent in the process are sent to the target process, so as to perform parallel simulation of particles and fluid grids based on the target process, so as to achieve load balance of all processes. By implementing this technical solution, the problem of load imbalance in large-scale fluid-particle coupling simulation is solved, and the running speed of fluid-particle coupling simulation is improved.

[0134] Embodiment 3

[0135] Figure 8A structural schematic diagram of a dynamic load balancing device provided in Embodiment 3 of the present invention.

[0136] like Figure 8 As shown, the device comprises:

[0137] A matching relationship determination module 810 is used to determine a coarse grid that matches a process; wherein the process is a fluid-particle coupling simulation process; the coarse grid is obtained by dividing the region where the simulation object having a particle phase and a fluid phase is located; the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid;

[0138] A calculation time determination module 820, for determining the particle calculation time and the fluid grid calculation time within the process;

[0139] A coarse grid weight determination module 830, for determining a coarse grid weight in the process according to the particle calculation time and the fluid grid calculation time;

[0140] A target process determination module 840 is used to re-divide the coarse grid in the process based on the coarse grid weight in the process, and determine the target process matching the coarse grid;

[0141] The particle and fluid grid sending module 850 is used to send the particles and fluid grids to be sent in the process to the target process, so as to perform parallel simulation of particles and fluid grids based on the target process, thereby achieving load balancing of all processes.

[0142] Optionally, the coarse grid weight determination module 830 includes:

[0143] An average calculation time obtaining unit is used to calculate the average particle calculation time according to the particle calculation time and the number of particles in a preset process; and to calculate the average fluid grid calculation time according to the fluid grid calculation time and the number of fluid grids in a preset process;

[0144] A weight determination unit of the currently sampled fluid grid relative to the particle, used to determine the weight of the currently sampled fluid grid relative to the particle in the process according to the average calculation time of the particle and the average calculation time of the fluid grid;

[0145] A Kalman gain calculation unit, configured to calculate the Kalman gain based on the variance of the weight of the fluid grid currently sampled relative to the particle in the process and the predetermined variance of the weight of the fluid grid previously sampled relative to the particle in the process, and environmental interference, to obtain a target gain;

[0146] A unit for determining the weight of the fluid grid relative to the particle in the process, used to determine the weight of the fluid grid relative to the particle according to the target gain, the average of the weight of the fluid grid currently sampled in the process relative to the particle, and the predetermined weight of the fluid grid previously sampled in the process relative to the particle;

[0147] The coarse grid weight determination unit is used to determine the weight of each coarse grid in all processes according to the weight of the fluid grid relative to the particle and the number of particles and the number of fluid grids in the preset coarse grid.

[0148] Optionally, a Kalman gain calculation unit is used to:

[0149] Adding the predetermined variance of the weight of the fluid grid sampled previously in the process relative to the particle and the environmental disturbance to determine a first result;

[0150] Adding the first result and the variance of the weight of the fluid grid currently sampled in the process relative to the particle to obtain a second result;

[0151] The first result is divided by the second result to obtain a target gain.

[0152] Optionally, a coarse grid weight determination unit is specifically used to:

[0153] Multiplying the weight of the fluid grid relative to the particle and the number of fluid grids in the coarse grid to obtain a first weight;

[0154] The first weight and the preset weight coefficient are multiplied, and the multiplication result and the number of particles in the coarse grid are added to obtain each coarse grid weight in all processes; wherein the preset weight coefficient is the fluid coefficient in the fluid-particle coupling simulation.

[0155] Optionally, the particle and fluid grid sending module 850 includes:

[0156] A process identifier receiving form, used to receive the process identifier sent by the target process through the process;

[0157] The to-be-sent particle and fluid grid sending unit is used to send the to-be-sent particles and fluid grid in the process to the target process according to the process identifier.

[0158] Optionally, the particle and fluid grid sending unit to be sent is specifically used for:

[0159] By traversing all particles and fluid grids to be sent through the process, an information hash table is determined; wherein the key of the information hash table is the process identifier that matches the particles and fluid grids to be sent; and the value of the information hash table is the number of particles and fluid grids to be sent received by the target process;

[0160] Based on the information hash table, controlling the target process to apply for memory according to the value of the information hash table;

[0161] All particles and fluid grids to be sent are stored according to the process identifier, and the particles and fluid grids to be sent are sent to the target process in sequence.

[0162] Optionally, the target process determination module 840 is specifically configured to:

[0163] The coarse grid in the process is re-divided based on a preset dynamic region decomposition algorithm.

[0164] A dynamic load balancing device provided in an embodiment of the present invention can execute a dynamic load balancing method provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution method.

[0165] Embodiment 4

[0166] Fig. 9 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0167] like Fig. 9As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0168] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0169] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a dynamic load balancing method.

[0170] In some embodiments, a dynamic load balancing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of a dynamic load balancing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform a dynamic load balancing method in any other appropriate manner (e.g., by means of firmware).

[0171] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0172] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0173] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0174] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0175] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0176] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0177] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0178] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A dynamic load balancing method, characterized in that: include: Determine a coarse grid matching the process; wherein the process is a fluid-particle coupling simulation process; the coarse grid is obtained by dividing the area where the simulation object having a particle phase and a fluid phase is located; the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid; Determine the particle calculation time and fluid grid calculation time within the process; Determining a coarse grid weight within the process according to the particle calculation time and the fluid grid calculation time; Re-dividing the coarse grid in the process based on the coarse grid weight in the process, and determining a target process matching the coarse grid; The particles and fluid grids to be sent in the process are sent to the target process, so as to perform parallel simulation of the particles and fluid grids based on the target process, thereby achieving load balancing of all processes.

2. The method according to claim 1, characterized in that Determining a coarse grid weight in the process according to the particle calculation time and the fluid grid calculation time includes: According to the particle calculation time and the number of particles in a preset process, the average particle calculation time is calculated; and according to the fluid grid calculation time and the number of fluid grids in a preset process, the average fluid grid calculation time is calculated; Determining the weight of the fluid grid currently sampled in the process relative to the particle according to the average calculation time of the particle and the average calculation time of the fluid grid; Calculating the Kalman gain based on the variance of the weight of the fluid grid currently sampled in the process relative to the particle and the predetermined variance of the weight of the fluid grid previously sampled in the process relative to the particle and environmental interference to obtain a target gain; Determine the weight of the fluid grid relative to the particle according to the target gain, the average of the weight of the fluid grid currently sampled in the process relative to the particle, and the predetermined weight of the fluid grid previously sampled in the process relative to the particle; The weight of each coarse grid in all processes is determined according to the weight of the fluid grid relative to the particle and the number of particles in the preset coarse grid and the number of fluid grids in the coarse grid.

3. The method according to claim 2, characterized in that Based on the variance of the weight of the fluid grid currently sampled in the process relative to the particle and the predetermined variance of the weight of the fluid grid previously sampled in the process relative to the particle and environmental interference, the Kalman gain is calculated to obtain the target gain, including: Adding the predetermined variance of the weight of the fluid grid sampled previously in the process relative to the particle and the environmental disturbance to determine a first result; Adding the first result and the variance of the weight of the fluid grid currently sampled in the process relative to the particle to obtain a second result; The first result is divided by the second result to obtain a target gain.

4. The method according to claim 2, characterized in that: According to the weight of the fluid grid relative to the particle and the number of particles in the preset coarse grid and the number of fluid grids in the coarse grid, the weight of each coarse grid in all processes is determined, including: Multiplying the weight of the fluid grid relative to the particle and the number of fluid grids in the coarse grid to obtain a first weight; The first weight and the preset weight coefficient are multiplied, and the multiplication result and the number of particles in the coarse grid are added to obtain each coarse grid weight in all processes; wherein the preset weight coefficient is the fluid coefficient in the fluid-particle coupling simulation.

5. The method according to claim 1, characterized in that Sending the particles and fluid grids to be sent in the process to the target process includes: Receiving, by the process, a process identifier sent by the target process; According to the process identifier, the particles and fluid grids to be sent in the process are sent to the target process.

6. The method according to claim 5, characterized in that According to the process identifier, sending the particles and fluid grids to be sent in the process to the target process includes: By traversing all the particles and fluid grids to be sent through the process, an information hash table is determined; wherein the key of the information hash table is the process identifier that matches the particles and fluid grids to be sent; and the value of the information hash table is the number of particles and fluid grids to be sent received by the target process; Based on the information hash table, controlling the target process to apply for memory according to the value of the information hash table; All particles and fluid grids to be sent are stored according to the process identifier, and the particles and fluid grids to be sent are sent to the target process in sequence.

7. The method according to claim 1, characterized in that The coarse grid in the process is re-divided, including: The coarse grid in the process is re-divided based on a preset dynamic region decomposition algorithm.

8. A dynamic load balancing device, characterized in that: include: A matching relationship determination module is used to determine a coarse grid that matches a process; wherein the process is a fluid-particle coupling simulation process; the coarse grid is obtained by dividing the area where the simulation object having a particle phase and a fluid phase is located; the process includes at least one coarse grid; the coarse grid includes at least one particle or fluid grid; A calculation time determination module, used to determine the particle calculation time and fluid grid calculation time within the process; A coarse grid weight determination module, used to determine the coarse grid weight in the process according to the particle calculation time and the fluid grid calculation time; A target process determination module, configured to re-divide the coarse grid in the process based on the coarse grid weight in the process, and determine a target process matching the coarse grid; The particle and fluid grid sending module is used to send the particles and fluid grids to be sent in the process to the target process, so as to perform parallel simulation of particles and fluid grids based on the target process, thereby achieving load balancing of all processes.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a dynamic load balancing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a dynamic load balancing method according to any one of claims 1 to 7 when executed.