Pre-parallel balancing method, device and storage medium for large-scale overlapping grids
By dynamically equalizing the overlapping grid in CFD calculation, and using weighted equalization distribution and information transfer technology, the problem of uneven parallel search efficiency is solved, and the parallel computing efficiency of large-scale overlapping grids is improved.
Patent Information
- Application Number
- CN202411246211.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-06
AI Technical Summary
In large-scale CFD calculations, the parallel search process of overlapping grids is inefficient in calculations due to uneven core counts, especially in dynamic simulations, which requires repeated searches, resulting in the impact of global parallel efficiency.
By evenly allocating the interpolation units of each core when the first overlapping grid preprocessing is processed, and recording the search time for weighted average, dynamically adjusting the allocation basis to ensure that the search time of each core is as equal as possible, and using weight coefficients for information transmission to balance the load.
It realizes global equalization without manual intervention, automatically allocates the number of boundary units in real time, significantly improving the parallel efficiency of overlapping grid preprocessing and shortening search time.
Smart Images

Figure CN118761358B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of fluid mechanics numerical simulation, and in particular to a pre-parallel equalization method, device and storage medium for large-scale overlapping grids. Background Art
[0002] As large-scale CFD (Computational Fluid Dynamics) calculations become increasingly important in current industrial applications, the demand for the development of different CFD simulation technologies has become more prominent. Mainstream CFD calculations are divided into two categories: structured grid methods and unstructured grid methods. The structured grid method has always occupied an important position in the CFD field due to its high efficiency and high accuracy.
[0003] In the numerical simulation of CFD structural grid method, overlapping grid technology can greatly reduce the difficulty of grid generation and improve the adaptability to complex shapes by cutting off the continuous topology of spatial grids. It has been widely used in the current CFD complex shape simulation and dynamic simulation, including the simulation of wing deformation, blade rotation, missile shield and other motion processes. Overlapping grid technology needs to be pre-processed before flow field simulation to obtain the interpolation relationship of its interpolation boundary cells. Its time-consuming operation is to obtain the boundary cell position by judging whether a certain spatial point is within the closed envelope surface to be searched, and find out the cell number of the boundary cell in the spatial grid to be interpolated. For this interpolation search problem, a variety of relatively mature algorithms have been developed in the serial era.
[0004] In recent years, the scale of CFD calculation has developed from tens of thousands of grid cells in the early stage to tens of millions of grid cells in the mainstream, and the calculation mode has also changed from serial calculation to parallel calculation. However, the current parallel algorithm research is mainly focused on the parallel calculation of flow field. There are not many mature methods for pre-processing methods such as searching overlapping grid interpolation relations, and most of them are not well adapted to large-scale calculations. When the number of computing cores exceeds a thousand cores, due to the non-uniformity of the parallel calculation amount of different cores, the search process of individual computing cores will be very slow, and the search time of different cores may differ by more than ten times. Since the parallel calculation time depends on the time consumption of the slowest computing core, this non-uniformity will seriously affect the global parallel efficiency. Especially when performing dynamic numerical simulation, since overlapping grid pre-processing must be performed at each time step during the motion process, it takes hundreds or even thousands of time steps to complete the simulation of a dynamic process. Therefore, in repeated and large-scale searches, this problem of uneven parallel search speed and large differences in efficiency of each core will become more prominent. An efficient and highly uniform parallel method is urgently needed to curb the pathological time distribution of different computing cores. Summary of the invention
[0005] In view of this, the present invention provides a method, device and storage medium for pre-parallel balancing of large-scale overlapping grids to solve the above problems.
[0006] In order to solve the above technical problems, the present invention provides a pre-parallel equalization method for large-scale overlapping grids, comprising:
[0007] S1: Perform the first overlapping grid pre-processing to evenly distribute each core interpolation unit; globally search each interpolation unit, record the search time of each interpolation unit, and perform weighted average of the search time;
[0008] S2: Perform non-first overlapping grid pre-processing, and redistribute the interpolation units according to the weighted result of the last overlapping grid pre-processing; send the excess information of the computing cores whose sum of weight coefficients is greater than the preset threshold to the root process, and let the computing cores whose sum of weight coefficients is less than the preset threshold receive the excess information; then, perform a global search, record the search time of each interpolation unit, and perform a weighted average of the search time;
[0009] S3: Repeat step S2, always taking the weighted result of the last overlapping grid pre-processing as the basis for allocation, until the iteration is completed.
[0010] As an optional method, each kernel interpolation unit is evenly distributed, including:
[0011] When performing overlapping grid preprocessing in the first iterative time step, each core is evenly distributed according to the total number of interpolation units.
[0012] As an optional approach, weighted averaging of search times includes:
[0013] The search time of each grid cell is recorded, and after the global search is completed, the total search time of all boundary cells is used for weighted average; the weight coefficient of the cell with slow search time is set to be greater than the preset threshold, and the weight coefficient of the cell with fast search time is set to be less than the preset threshold, and an array is created to save the weight coefficient of each cell.
[0014] As an optional method, the search time may be determined by:
[0015] Before searching, first determine whether the center point of the overlapping grid is within the closed envelope surface to be searched to determine whether it is a boundary cell of overlapping interpolation. If so, find out the cell number to which the boundary cell belongs in the spatial grid to be interpolated;
[0016] The search time includes the total CPU time spent in finding the cell number to which the boundary cell belongs in the spatial grid to be interpolated.
[0017] As an optional method, in the above step S2, the computing cores whose sum of weight coefficients is greater than the average weight threshold are classified as slow cores, and the unit information of the excess part of the cores is sent to the root process;
[0018] After the root process completes the collection of excess unit information of all slow cores, it regroups and distributes the unit information and sends the excess unit information to the computing cores whose sum of weight coefficients is less than the average weight threshold. The computing cores whose sum of weight coefficients is less than the average weight threshold are classified as fast cores.
[0019] As an optional method, the unit information of the excess part includes the xyz coordinates of the center point of the interpolation unit, the calculation core number, the calculation block number, the jkl three-direction sequence number in the calculation block, the calculation core number to which it will be sent, and the calculation block number to which it is sent.
[0020] As an optional method, the calculation kernels whose sum of weight coefficients is within the average weight threshold interval are classified as common kernels and are not processed.
[0021] On the other hand, the present invention provides an electronic device, as an optional method, comprising: a memory for storing a computer program; a processor for implementing the steps of the above-mentioned large-scale overlapping grid pre-parallel equalization method when executing the computer program.
[0022] On the other hand, the present invention provides a computer-readable storage medium. As an optional method, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned large-scale overlapping grid pre-parallel balancing method are implemented.
[0023] The beneficial effects of the present invention are:
[0024] Without manual intervention, the overlapping grid pre-search process of each core is automatically globally balanced during the iterative process of the dynamic solution of the flow field, and the number of boundary cells is allocated in real time to ensure that the search time of each computing core is as similar as possible; greatly improving the parallel efficiency of the overlapping grid pre-processing and shortening the search time. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of the steps of a pre-parallel balancing method for large-scale overlapping grids provided by an embodiment of the present invention;
[0026] Figure 2 A schematic diagram of overlapping grid simulation provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods.
[0028] In the dynamic parallel calculation of CFD overlapping grids, it is necessary to perform multi-time step calculations on the moving surface, and each time step of the surface movement needs to be pre-processed to determine the interpolation relationship of the overlapping boundary cells. However, in the overlapping grid pre-processing process after parallel slicing, due to the different number of interpolation cells to be searched on each computing core, the search speed of each cell is also inconsistent, resulting in a large difference in the search time of each core and a serious reduction in parallel efficiency. In response to this problem, this embodiment proposes the following technical solution:
[0029] See also Figure 2 At the initial position of dynamic calculation, that is, during the first overlapping grid pre-processing, the number of overlapping boundary cells on different computing cores is uniformly allocated, and each core is evenly allocated according to the total number of interpolation cells to ensure that the number of interpolation cells required to search for each core is consistent. Since the actual search time required for each unit is not the same, the time consumed is recorded after each unit search is completed, and the total search time of all boundary cells is used for weighted average after the global search is completed. In subsequent searches, the number of units is no longer allocated according to the number of interpolation units, but according to the weighted unit weight. This weight coefficient has been dynamically changing with the change of the object surface position and the advancement of the flow field calculation, and the search time of each core is always kept as similar as possible.
[0030] See also Figure 1 , this embodiment is implemented as follows:
[0031] S1: Perform the first overlapping grid pre-processing to evenly distribute each core interpolation unit; globally search each interpolation unit, record the search time of each interpolation unit, and perform weighted average of the search time;
[0032] S2: Perform non-first overlapping grid pre-processing, and redistribute the interpolation units according to the weighted result of the last overlapping grid pre-processing; send the excess information of the computing cores whose sum of weight coefficients is greater than the preset threshold to the root process, and let the computing cores whose sum of weight coefficients is less than the preset threshold receive the excess information; then, perform a global search, record the search time of each interpolation unit, and perform a weighted average of the search time;
[0033] S3: Repeat step S2, always taking the weighted result of the last overlapping grid pre-processing as the basis for allocation, until the iteration is completed.
[0034] The above steps are implemented in this embodiment. When performing overlapping grid pre-processing in the first iterative time step, each core is evenly distributed according to the total number of interpolation units to ensure that the number of interpolation units that each core needs to search is basically the same; at the same time, the search time of each grid unit is recorded, and after the global search is completed, the total search time of all boundary units is used for weighted averaging. The weight coefficient of the unit with slow search time is greater than 1, and the weight coefficient of the unit with fast search time is less than 1, and an array is created to save the weight coefficient of each unit.
[0035] When performing overlapping grid preprocessing in the second iterative time step, the number of grid cells allocated to each core is no longer allocated according to the number of interpolation cells, but according to the cell weights after weighting in the previous step, to ensure that the sum of the interpolation cell weight coefficients obtained on each computing core is as equal as possible.
[0036] For computing cores (defined as slow cores in this embodiment) whose sum of weight coefficients is greater than 5% of the average weight, it is necessary to send the excess unit information in this core (the excess unit information includes the xyz coordinates of the center point of the interpolation unit, the number of the computing core to which it belongs, the number of the computing block to which it belongs, the jkl three-direction sequence number in the computing block, the number of the computing core to which it will be sent, and the number of the computing block to which it will be sent) to the root process. After the root process completes the collection of the excess unit information of all slow cores, it recombines and allocates the unit information, and sends the excess unit information to computing cores (defined as fast cores in this embodiment) whose sum of weight coefficients is less than 5% of the average weight, and ensures that the sum of the weight coefficients of each core is between the average weight plus or minus 5%. For computing cores (defined as ordinary cores in this embodiment) whose original sum of weight coefficients is between the average weight plus or minus 5%, no processing is performed.
[0037] Specifically, the determination of the search time includes: before searching, first determine whether the center point of the spatial overlapping grid is located within the closed envelope surface to be searched, so as to determine whether it is a boundary cell of overlapping interpolation; if so, find out the cell number to which the boundary cell belongs in the spatial grid to be interpolated; the search time includes the total CPU time of the process of finding out the cell number to which the boundary cell belongs in the spatial grid to be interpolated.
[0038] After each computing core completes sending or receiving, it performs a regular search operation and records the search time of each unit. After the global search is completed, the weight is re-added and the weight coefficient of each unit is saved. It should be noted that although there is a difference of about 5% between the general core and the average weight, considering that data sending and receiving also takes a certain amount of time, if the general core is also involved in sending, it may not necessarily obtain positive time benefits. Therefore, slight deviations of the general core will not be processed.
[0039] For each subsequent iteration time step, step 2 is repeated. Each core always uses the weight coefficient obtained in the previous step as the basis for allocation, and ensures that the weight coefficients on all cores are basically the same until the iteration is completed. Since the time and displacement intervals between each two time steps in the overlapping grid movement are very small, the overlapping grid interpolation relationship between two adjacent time steps is not much different. It is reasonable and feasible to use the weight coefficient of the previous time step to replace the current time step. This method of allocating interpolation units by using the search time weight instead of the number of units has better uniformity.
[0040] Please refer again Figure 1 , Figure 1 The above process ensures that the search time of the boundary units on each computing core is basically the same through the dynamic allocation method in the process of overlapping grid movement, solves the serious uneven search time problem caused by the random allocation of each core interpolation unit in the traditional interpolation method, and can greatly improve the pre-processing efficiency in the dynamic process of overlapping grids.
[0041] Through the above scheme, the traditional method is to determine the number of boundary cells of the overlapping grid on each core in the overlapping grid pre-process by the initial allocation result during parallel slicing, which is very random, resulting in serious uneven search time for each core, affecting the parallel efficiency; this method uniformly allocates interpolation units through global management, and introduces the weighted search time of each unit in the previous iteration step in the dynamic process to ensure that the time for each core to complete the pre-search is basically equal, greatly improving the parallel efficiency.
[0042] On the other hand, this embodiment also provides an electronic device, which can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.) or other types of mobile devices, or a stationary computing device such as a desktop computer or a PC. The electronic device can also be a mobile or stationary server.
[0043] As an optional manner, the method comprises: a memory for storing a computer program; and a processor for executing the computer program to realize:
[0044] S1: Perform the first overlapping grid pre-processing to evenly distribute each core interpolation unit; globally search each interpolation unit, record the search time of each interpolation unit, and perform weighted average of the search time;
[0045] S2: Perform non-first overlapping grid pre-processing, and redistribute the interpolation units according to the weighted result of the last overlapping grid pre-processing; send the excess information of the computing cores whose sum of weight coefficients is greater than the preset threshold to the root process, and let the computing cores whose sum of weight coefficients is less than the preset threshold receive the excess information; then, perform a global search, record the search time of each interpolation unit, and perform a weighted average of the search time;
[0046] S3: Repeat step S2, always taking the weighted result of the last overlapping grid pre-processing as the basis for allocation, until the iteration is completed.
[0047] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the pre-parallel balancing method of the large-scale overlapping grid described above belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the pre-parallel balancing method of the large-scale overlapping grid described above.
[0048] On the other hand, this embodiment further provides a computer-readable storage medium. As an optional manner, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following is implemented:
[0049] S1: Perform the first overlapping grid pre-processing to evenly distribute each core interpolation unit; globally search each interpolation unit, record the search time of each interpolation unit, and perform weighted average of the search time;
[0050] S2: Perform non-first overlapping grid pre-processing, and redistribute the interpolation units according to the weighted result of the last overlapping grid pre-processing; send the excess information of the computing cores whose sum of weight coefficients is greater than the preset threshold to the root process, and let the computing cores whose sum of weight coefficients is less than the preset threshold receive the excess information; then, perform a global search, record the search time of each interpolation unit, and perform a weighted average of the search time;
[0051] S3: Repeat step S2, always taking the weighted result of the last overlapping grid pre-processing as the basis for allocation, until the iteration is completed.
[0052] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the pre-parallel balancing method of the large-scale overlapping grids described above belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the pre-parallel balancing method of the large-scale overlapping grids described above.
[0053] An embodiment of the present application further provides a chip storing a computer program, which implements the steps of the pre-parallel equalization method for large-scale overlapping grids when the computer program is executed by the chip.
[0054] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0055] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0056] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0057] The above are only preferred embodiments of the present invention. It should be noted that the above preferred embodiments should not be regarded as limiting the present invention, and the protection scope of the present invention should be based on the scope defined by the claims. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the spirit and scope of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A method for pre-parallel equalization of large-scale overlapping grids, characterized in that: include: S1: Perform the first overlapping grid pre-processing to evenly distribute each core interpolation unit; globally search each interpolation unit, record the search time of each interpolation unit, and perform weighted average of the search time; S2: Perform non-first overlapping grid pre-processing, and reallocate interpolation units according to the weighted result of the last overlapping grid pre-processing; Sending the excess information of the computing cores whose sum of weight coefficients is greater than the preset threshold to the root process, and allowing the computing cores whose sum of weight coefficients is less than the preset threshold to receive the excess information; After that, a global search is performed, the search time of each interpolation unit is recorded, and the search time is weighted averaged; S3: repeat step S2, always taking the weighted result of the last overlapping grid pre-processing as the allocation basis, until the iteration is completed; In the above S1, The weighted averaging of the search time includes: Record the search time of each grid cell, and use the total search time of all boundary cells for weighted average after the global search is completed; make the weight coefficient of the cell with slow search time greater than the preset threshold, and the weight coefficient of the cell with fast search time less than the preset threshold, and create an array to save the weight coefficient of each cell; The determination of the search time includes: Before searching, first determine whether the center point of the overlapping grid is within the closed envelope surface to be searched to determine whether it is a boundary cell of overlapping interpolation. If so, find out the cell number to which the boundary cell belongs in the spatial grid to be interpolated; The search time includes the total CPU time of the process of finding the unit number to which the boundary unit belongs in the spatial grid to be interpolated; In the above S2, the excess information includes the xyz coordinates of the center point of the interpolation unit, the calculation core number, the calculation block number, the jkl three-direction sequence number in the calculation block, the calculation core number to be sent to, and the calculation block number to be sent.
2. A method for pre-parallel equalization of a large-scale overlapping grid according to claim 1, characterized in that: The evenly distributing the core interpolation units includes: When performing overlapping grid preprocessing in the first iterative time step, each core is evenly distributed according to the total number of interpolation units.
3. The method for pre-parallel equalization of a large-scale overlapping grid according to claim 1, characterized in that: In the above step S2, the computing cores whose sum of weight coefficients is greater than the average weight threshold are classified as slow cores, and the unit information of the excess part of the cores is sent to the root process; After the root process completes the collection of excess unit information of all slow cores, it recombines and allocates the unit information, and sends the excess unit information to the computing cores whose sum of weight coefficients is less than the average weight threshold. The computing cores whose sum of weight coefficients is less than the average weight threshold are classified as fast cores.
4. The method for pre-parallel equalization of a large-scale overlapping grid according to claim 3, characterized in that: The calculation kernels whose sum of weight coefficients is within the average weight threshold interval are classified as common kernels and are not processed.
5. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the pre-parallel equalization method for large-scale overlapping grids as claimed in any one of claims 1 to 4 when executing the computer program.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the pre-parallel equalization method for large-scale overlapping grids as claimed in any one of claims 1 to 4 are implemented.
