A semi-Lagrangian interpolation communication optimization method based on vertical layer grouping

By adopting vertical layer grouping and pipeline computing and communication overlapping methods in numerical weather prediction, the problem of high communication overhead and difficulty in increasing the number of groups in the semi-Lagrangian interpolation stage is solved, and more efficient parallel computing is achieved.

CN114817432BActive Publication Date: 2024-08-30NAT UNIV OF DEFENSE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210396593.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-15
Publication Date
2024-08-30
Estimated Expiration
2042-04-15

AI Technical Summary

Technical Problem

In numerical weather prediction, parallel computing in the semi-Lagrangian interpolation stage has problems such as high communication overhead, difficulty in increasing the number of groups, and unfavorable pipeline design, which affects computing efficiency.

Method used

A pipelined computing and communication overlapping method based on vertical layer grouping is adopted. Through the non-blocking communication method of MPI, the communication of the latter group is overlapped with the calculation of the previous group, and the parallel execution performance is optimized by adjusting the number of groups in the pipeline mode.

Benefits of technology

It effectively hides part of the communication overhead, reduces the execution time of semi-Lagrangian interpolation and numerical prediction models, and improves calculation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114817432B
    Figure CN114817432B
Patent Text Reader

Abstract

The present invention belongs to the technical field of numerical forecasting, and discloses a semi-Lagrangian interpolation communication optimization method based on vertical layer grouping, collects three-dimensional field data in semi-Lagrangian interpolation, and groups all three-dimensional fields in the vertical direction; divides the operation of each group into two parts, communication and calculation, the communication part is performed in FLD3I and YHSPFI, and the interpolation results are stored in FLD3O and YHSPFO respectively; replans the calculation and communication under the grouping condition to achieve the overlap of calculation and communication; for the candidate grouping number, selects the grouping number that minimizes the execution time of the semi-Lagrangian scheme stage. The present invention reduces the operation time at the start and end of the pipeline, improves the overall calculation efficiency; adopts the determined optimal grouping number to perform subsequent business numerical forecasting, and reduces the time of business numerical forecasting to the greatest extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of numerical weather forecasting, and in particular relates to a semi-Lagrangian interpolation communication optimization method based on vertical layer grouping. Background Art

[0002] Since the 1950s, the semi-Lagrangian scheme proposed in non-patent document 1 has been increasingly used in numerical weather forecasting models, especially after being combined with a semi-implicit scheme. In non-patent document 2, this scheme is used to first determine the position of the starting point at the previous time, that is, the trajectory, and then interpolate the physical quantity field at the starting point through the physical quantity field around it, and finally calculate the physical quantity field at the grid point at the current time. Its time step is no longer restricted by the CFL condition, and it only requires that any two trajectories do not intersect. In non-patent document 3, ECMWF began to introduce the semi-Lagrangian advection scheme in 1991, and then it quickly became popular in various numerical weather forecasting models. For example, the semi-Lagrangian advection scheme is used for numerical weather forecasting in non-patent document 4.

[0003] With the continuous development of the semi-Lagrangian scheme, in order to further improve the timeliness of the model, the parallelization of its algorithm was proposed in non-patent document 5. In 1994, JBDrake of the Oak Ridge Laboratory (ORNL) of the U.S. Department of Energy proposed a parallel algorithm for local estimation of wind speed and dynamic change of the expansion zone in non-patent document 6. The algorithm has the effect of on-demand communication, but additional communication is required at each time step. In 1995, Thomas et al. of the Canadian Department of Environment (EC) gave a distributed storage parallel algorithm based on the maximum wind speed of the semi-Lagrangian scheme in non-patent document 7. The expansion zone is determined by the possible maximum wind speed and does not change with time and grid changes. The communication structure of this scheme is simple and fixed, but a lot of unnecessary data is transmitted between processors, which is easy to cause great waste.

[0004] In 1995, ECMWF began to consider the use of a distributed storage parallel algorithm with the maximum wind strategy in IFS in non-patent document 8, and studied strategies to reduce communication volume and improve scalability based on real-time global maximum wind speed and local wind. Since 2005, ECMWF has introduced an on-demand communication strategy in the IFS mode in non-patent document 9. The maximum wind strategy is still used for trajectory calculation, but the communication of interpolation calculations at each time step is performed according to actual needs. In 2010, the China Meteorological Science Research Institute upgraded the maximum wind strategy to another on-demand communication strategy in the GRAPES mode in non-patent document 10, which first performs interpolation calculations on the processor at the starting point, and then transmits the interpolation results to the required processors.

[0005] Over the past decade, the improvement of communication software on high-end computers in terms of communication overhead and software computing overhead has lagged far behind the growth of processor performance. When performing numerical weather forecasting on ultra-large-scale high-performance parallel computing systems, the factor that affects the efficiency of numerical forecasting calculations is the substantial increase in communication overhead. Overlapping computation and communication is an important method to reduce the impact of communication overhead when performing large-scale scientific and engineering calculations, and can also be used in the parallel computing scheme of semi-Lagrangian interpolation in numerical weather forecasting models. In 2015, ECMWF used COARRAY combined with OpenMP to reduce the impact of communication overhead in semi-Lagrangian calculations in the IFS model in non-patent literature 11. While using OpenMP to parallelize the semi-Lagrangian calculation, for each loop iteration variable, the communication between the tasks is implemented through COARRAY Fortran remote access operations to achieve the purpose of overlapping computation and communication. In 2021, Jiang Tao et al. studied the Galaxy Global Spectrum Model YHGSM of the National University of Defense Technology in non-patent literature 12. Based on the consideration that 13 different field variables that need to be interpolated, such as wind field, temperature field, ground pressure field, GFL field, etc., are independent of each other during interpolation, they combined and divided them into three groups according to the amount of calculation, realizing the overlap of calculation and communication between groups and reducing the impact of communication overhead.

[0006] In the method proposed by Jiang Tao et al. for grouping field variables to perform computational communication overlap, since the number of field variables is limited, and some are two-dimensional variables and some are three-dimensional variables, it is difficult for this method to control the relative size of the communication volume and the computational volume in each group, and it is also difficult to increase the number of groups, which is not conducive to the full concealment of communication. At the same time, when grouping, the number of groups is limited, and it is simply divided into three groups, and the pipeline implementation method and the optimal number of groups are not considered.

[0007] Non-patent literature

[0008] 1. Zeng Qingcun. Some issues on computational stability[J]. Chinese Journal of Atmospheric Sciences, 1978, 2(3): 3-13.

[0009] 2.AJSimmons. Development of a High Resolution, Semi-Lagrange version of the ECMWF Forecast Model.

[0010] https: / / www.ecmwf.int / sites / default / files / elibrary / 1991 / 12237-development-high-resolution-semi-lagrangian-version-ecmwf-forecast-model.pdf.

[0011] 3.Ritchie H,Temperton C,Simmons A,et al.Implementation of the Semi-Lagrangian Method in a High-Resolution Version of the ECMWF Forecast Model[J].Mon.wea.rev,1995,123(2):1163-1163.

[0012] 4.IFS Documentation–CY29r1,Part VI:Technical and ComputationalProcedures.https: / / www.ecmwf.int / sites / default / files / elibrary / 2004 / 9199-part-vi-technical-and-computational-procedures.pdf.2005.

[0013] 5.Ritchie H.Application of a Semi-Lagrangian Integration Scheme tothe Moisture Equation in a Regional Forecast Model[J].Monthly Weather Review,2009,113(4):424

[0014] 6.Wolters L,Cats G,Gustafsson N,et al.Data parallel semi-Lagrangiannumerical weather forecasting[C] / / Symposium on Frontiers of MassivelyParallel Computation,Frontiers.1995.

[0015] 7.Drake J B,Worley P H,Michalakes J,et al.Parallel algorithms forsemi-Lagrangian transport in global atmospheric circulation models[J].Parallel Processing for Scientific Computing,1995:119--124.

[0016] 8.Thomas S, J.Massively parallel semi-Lagrangian advection[J].Simulation Practice&Theory,1995,3(4-5):223-238.

[0017] 9.Barros,Dent S,Isaksen D,et al.The IFS model:A parallel productionweather code[J].Parallel Computing,1995,21(10):1621-1638.

[0018] 10.Zhiyan JIN,Xiangjun WU,Fengfeng Chen.Parallel Processing of theSemi-Lagrangian Scheme in GRAPES.In the 14th ECMWF Workshop on the Use ofHigh Performance Computing in Meteorology,2010.

[0019] 11.George Mozdzynski,Mats Hamrud,Nils Wedi.ECMWF’s IFS:Parallelization and exascale computing challenges.

[0020] https: / / www.ecmwf.int / sites / default / files / elibrary / 2014 / 11302-ecmwfs-ifs-parallelization-and-exascale-computing-challenges.pdf.

[0021] 12. Jiang T, Wu J, Liu Z, Zhao W, Zhang Y. Optimization of the parallelsemi-Lagrangian scheme based on overlapping communication with computation in the YHGSM[J]. Quarterly Journal of the Royal Meteorological Society, 2021, 147(737): 2293-2302. Summary of the invention

[0022] Aiming at the characteristic that there is only weak dependency in the vertical direction in the semi-Lagrangian interpolation stage in the numerical weather forecast mode, the present invention provides a pipeline calculation and communication overlap method based on vertical layer grouping. Through the non-blocking communication mode of MPI, the communication of the latter group is overlapped with the calculation of the former group, thereby achieving the purpose of hiding part of the communication overhead and reducing the execution time of the semi-Lagrangian interpolation and the entire numerical forecast mode. At the same time, a method for obtaining the optimal performance during parallel execution by adjusting the number of groups in the pipeline mode is provided.

[0023] The present invention discloses a semi-Lagrangian interpolation communication optimization method based on vertical layer grouping, comprising the following steps:

[0024] S1: Collect three-dimensional field data of numerical weather forecast semi-Lagrangian interpolation;

[0025] S2: The collected three-dimensional field data are sequentially stored in the three-dimensional array FLD3I (1:N, 0:L+1, 1:F), and the three-dimensional array FLD3O (1:N, 1:L, 1:F) is allocated to store the three-dimensional field data obtained by interpolation, where N is the total number of horizontal grid points in this process, L is the number of vertical layers of the model, and F is the number of fields to be interpolated;

[0026] S3: storing the two-dimensional field corresponding to a certain variable in the array YHSPFI(1:N), and allocating the array YHSPFO(1:N) to store the result of interpolating the two-dimensional field corresponding to the certain variable;

[0027] S4: group all three-dimensional fields in the vertical direction;

[0028] S5: Divide the operation of each group into two parts: communication and interpolation calculation. The communication part is performed in the three-dimensional array FLD3I and the array YHSPFI, and the interpolation results are stored in the three-dimensional array FLD3O and the array YHSPFO respectively.

[0029] S6: Re-plan computing and communication in grouping to achieve computing and communication overlap;

[0030] S7: For the candidate grouping numbers, execute steps S4-S6 in sequence, and select the grouping number that minimizes the execution time of the semi-Lagrangian scheme stage.

[0031] Furthermore, the grouping of all three-dimensional fields in the vertical direction includes:

[0032] The actual number of layers of the three-dimensional field obtained by interpolation is the 1st to Lth layers. The three-dimensional field is grouped in the vertical direction, that is, the three-dimensional array FLD3O is grouped according to the vertical layers. After grouping, g groups are obtained. The number of layers of each group differs by at most one layer. The starting layer number in the i-th (i=0,1,2,...,g-1) group is denoted as b i , the number of layers included is recorded as l i ; When i≤L%g, l i =[L / g]+1; when i>L%g, l i =[L / g], where [x] represents the integer part of x;

[0033] When interpolating, the i-th layer in the three-dimensional array FLD3O corresponds to the arrival point of the semi-Lagrangian interpolation trajectory, that is, the grid point. When interpolating, at most two layers of data are used in the vertical direction. Therefore, the value of the i-th layer of the field to be interpolated in the three-dimensional array FLD3O uses at most the i-5th to i+5th layers of the corresponding field in the three-dimensional array FLD3I; at the vertical boundary, when interpolating the i-th layer data in the three-dimensional array FLD3O, at most the lowest 0th layer or the highest L+1th layer in the three-dimensional array FLD3I is used; therefore, the layers of the three-dimensional array FLD3I are grouped, and group 0 contains the 0th to bth layers. 0 +l 0 +4 layers, the i>0 group contains the b i-1 +l i-1 +5 to min(L+1,b i +l i +4) layer;

[0034] The calculation of the array YHSPFO is attached to the calculation of the last group, i.e., the g-1th group, of the three-dimensional array FLD3O, and the communication operation of YHSPFI is attached to the communication operation of the last group of the three-dimensional array FLD3I.

[0035] Furthermore, the operation of each group is divided into two parts: communication and calculation, including:

[0036] The communication part is carried out in arrays FLD3I and YHSPFI, and the interpolation results are stored in arrays FLD3O and YHSPFO respectively;

[0037] The calculation operation corresponding to each group corresponds to the interpolation calculation of the grid points and all fields at all levels in the group;

[0038] For each group of corresponding communication operations, the entire discrete grid network is regionally decomposed in the horizontal direction according to the global numerical weather forecast model to obtain multiple sub-regions. The calculation on each sub-region is carried out on a processor, the HALO area and semi-Lagrangian buffer data structure of each sub-region are determined, and mutual communication is performed between the sub-regions so that the horizontal grid point data required for interpolation at the starting point during subsequent interpolation is in this sub-region or its HALO area.

[0039] Furthermore, the semi-Lagrangian buffer refers to the FLD3I and YHSPFI arrays; the HALO area refers to the space expanded after the horizontal spatial expansion of FLD3I and YHSPFI, which is used to store data received from other processors.

[0040] Furthermore, the global numerical weather prediction model is at least one of YHGSM, ECMWF IFS, and GRAPES.

[0041] Furthermore, the re-planning of computing and communication in grouping to achieve overlapping of computing and communication includes:

[0042] On each processor, use the MPI non-blocking send operation to start sending the 0th group of data in FLD3I;

[0043] On each processor, for the groups i=0 to g-2, first use the MPI non-blocking send operation to start the send operation of the i+1 group of data in the three-dimensional array FLD3I; when i=g-2, use the MPI non-blocking send operation to start the communication of the array YHSPFI; then, receive the i-th group of data in the three-dimensional array FLD3I; finally, calculate the i-th group of the three-dimensional array FLD3O, and realize the calculation while communicating with the i+1-th group of data;

[0044] On each processor, for the g-1th group, first receive the g-1th group data of the three-dimensional array FLD3I and the data of the array YHSPFI; then perform calculations on the g-1th group of the three-dimensional array FLD3O and the array YHSPFO.

[0045] 7. The semi-Lagrangian interpolation communication optimization method based on vertical layer grouping according to claim 1 is characterized in that the step of performing steps S4-S6 in sequence for the candidate grouping numbers to select the grouping number that minimizes the execution time of the semi-Lagrangian scheme stage comprises:

[0046] For g = [L / (L-4)] ~ L-4, run the program according to steps S4-S6, and record the execution time of the semi-Lagrangian scheme stage as t g , for all possible g, select such that t g The smallest one; this g is used as the number of groups when the subsequent business is running to minimize the business running time.

[0047] The beneficial effects of the present invention are as follows:

[0048] By grouping in the vertical direction, compared with the method of grouping by the total number of fields of 16, since the number of vertical layers of the current business forecast model has reached 137 layers, the maximum possible number of groups can be greatly increased. This is beneficial to decompose calculation and communication to the greatest extent, reducing the time for sending the 0th group and receiving and calculating the g-1th group, which is equivalent to reducing the operation time at the start and end of the pipeline, thereby helping to improve the overall computing efficiency.

[0049] The actual running time of different numbers of groups is used to determine the optimal number of groups, so as to minimize the parallel execution time. When grouping, if the number of groups is too small, it is not conducive to reducing the overall execution time due to the long execution time at the start and end. If the number of groups is too large, each group needs to communicate separately, which will increase the number of communications, which is not conducive to reducing the overall execution time. By executing the actual program with different numbers of groups in advance to determine the number of groups that makes the execution time the shortest, and using the determined optimal number of groups for subsequent business numerical forecasting, the time for business numerical forecasting can be minimized. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 Flowchart of the present invention;

[0051] Figure 2 A schematic diagram of the arrangement of the computing and communication operation sequence and the computing and communication overlap when the number of groups is 4 and the three-dimensional field is grouped by vertical layers according to an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.

[0053] The technical problem to be solved by the present invention is: for the semi-Lagrangian interpolation commonly used in numerical weather forecasting, how to solve the problem that the number of groupings is difficult to increase when grouping by field variables, which is not conducive to pipeline design and minimizing the impact of communication overhead, so as to further improve the parallel computing efficiency of the process.

[0054] In order to solve the above technical problems, the technical solution proposed by the present invention is as follows: in view of the characteristics that the interpolation stage of the existing parallel semi-Lagrangian scheme only needs to communicate in the horizontal direction, and there is only data dependency between the upper and lower five layers in the vertical direction, the three-dimensional array to be interpolated is grouped, and the two-dimensional array to be interpolated is added to the last group, and then the method of overlapping the calculation of the previous group with the communication of the latter group is adopted to reduce the communication overhead. On this basis, a calculation and communication overlapping execution mode based on the pipeline method is established, and the number of groups that achieve the highest calculation efficiency is determined through actual tests.

[0055] Collect three-dimensional field data in the semi-Lagrangian interpolation of the numerical weather forecast model, including wind field, temperature field, surface pressure field, GFL field, humidity field, etc.

[0056] Table 1. The storage order of each 3D field and its number of layers in the interpolated data structure FLD3O and the interpolated FLD3I

[0057]

[0058] Assume that the interpolated three-dimensional fields are stored in the three-dimensional array FLD3O (1:N, 1:L, 1:F) in sequence, and the used three-dimensional fields are stored in the three-dimensional array FLD3I (1:N, 0:L+1, 1:F) in sequence, where 1:N represents the subscript and superscript of the first dimension of the three-dimensional array, 0:L+1 represents the subscript and superscript of the second dimension of the three-dimensional array, and 1:F represents the subscript and superscript of the third dimension of the three-dimensional array. In addition, there is another two-dimensional field corresponding to the ground pressure that needs to be interpolated. Assume that the interpolation results are stored in the array YHSPFO (1:N), and the data used for interpolation are stored in the array YHSPFI (1:N). Here, N is the total number of horizontal grid points in this process, L is the number of vertical layers of the model, and F is the number of fields to be interpolated. The specific storage order and hierarchy are shown in Table 1, where F = 16. In this way, the specific technical solution is:

[0059] The first step is to group all three-dimensional fields in the vertical direction.

[0060] (1.1) The actual number of layers of the interpolated field is 1 to L layers, which corresponds to the grouping of the three-dimensional array FLD3O of the data structure by vertical layers. Assume that it is divided into g groups, so that the number of layers in each group differs by at most one layer, and the starting layer number in the i-th (i=0,1,2,...,g-1) group is denoted by b i , the number of layers contained is recorded as l i According to the grouping rule, when i≤L%g, l i =[L / g]+1; when i>L%g, l i =[L / g]. Here [x] represents the integer part of x. Taking g=5 and L=91 as an example, the grouping is shown in Table 2.

[0061] (1.2) When interpolating, the i-th layer in the three-dimensional array FLD3O corresponds to the arrival point (grid point) of the semi-Lagrangian interpolation trajectory. Statistics show that the corresponding starting point is at most 3 layers away from the arrival point. At the same time, considering that at most two layers of data may be needed in the vertical direction during interpolation, the value of the i-th layer of the field to be interpolated in the three-dimensional array FLD3O may use at most the i-5th to i+5th layers of the corresponding field in the three-dimensional array FLD3I. At the vertical boundary, when interpolating the i-th layer data in FLD3O, at most the lowest 0th layer or the highest L+1th layer in FLD3I is used. Therefore, corresponding to the grouping of layers in FLD3O, the i-th group needs to use the max(0,b i -5) to min(L+1,b i +l i +4) layer. Now the layers of FLD3I are grouped, and group 0 contains layers 0 to b. 0 +l 0 +4 layers, the i>0 group contains the b i-1 +l i-1 +5 to min(L+1,b i +l i +4) layer, as shown in Table 2.

[0062] (1.3) The two-dimensional surface pressure operation is added to the last group, i.e., the g-1 group. That is, the calculation of YHSPFO is added to the calculation of the last group of FLD3O, and the communication of YHSPFI is added to the communication of the last group of FLD3I.

[0063] Table 2. Relationship between the number of layers to be inserted and the number of layers used

[0064] b l FLD3O Level Used in FLD3I middle level FLD3I Hierarchical Grouping Group 0 1 19 1-19 0-24 0-24 Group 1 20 18 20-37 15-42 25-42 Group 2 38 18 38-55 33-60 43-60 Group 3 56 18 56-73 51-78 61-78 Group 4 74 18 74-91 69-92 79-93

[0065] The second step is to divide the operation of each group into two parts: communication and interpolation calculation. The communication part is performed in the data structures FLD3I and YHSPFI, and the interpolation results are stored in FLD3O and YHSPFO respectively. The calculation operation corresponding to each group actually corresponds to the specific interpolation calculation of all grid points and all fields at all levels in the group. For the communication operation corresponding to each group, according to the overall design of the horizontal regional decomposition of the current global numerical weather forecast model (such as YHGSM, ECMWF IFS, GRAPES, etc., which are the prior art in this field), it is based on the pre-determined HALO area and semi-Lagrangian buffer data structure (the determination method refers to non-patent literature 4-12), and the mutual communication between each sub-area is carried out, so that the horizontal grid point data required for interpolation at the starting point during subsequent interpolation is in this sub-area or its HALO area. After the horizontal region is decomposed, multiple sub-regions are obtained. Each sub-region has a corresponding HALO area and semi-Lagrangian buffer. The semi-Lagrangian buffer refers to the FLD3I and YHSPFI arrays; the HALO area refers to the extra space opened by FLD3I and YHSPFI in the horizontal direction, which is used to store data received from other processors. Note that there is no need to make any changes to the original communication and calculation methods in the horizontal direction in the numerical forecast model. In the field of high-performance computing, new applications that require surrounding elements use regional decomposition strategies to assign tasks to different processors, and each processor processes a data subset. When performing calculations, the required process must be able to obtain data from all grid points. For the data at the boundary of the data subset, the required data is inevitably located on other processors. In order to control the synchronization overhead, the boundaries of the decomposed sub-regions are logically overlapping, and the values ​​of the adjacent regions need to be updated according to certain requirements before the calculation of the internal region begins. The present invention uses HALO exchange to solve this communication problem, that is, finite difference discretization on a regular grid is used, and the overlapping part between sub-areas is called HALO area, and each process stores its boundary data in the HALO area. HALO exchange is a prior art in this field, and the present invention will not be repeated.

[0066] The third step is to re-plan the computation and communication in the grouping situation to achieve the overlap of computation and communication, the arrangement order of computation and communication operations in each group, and the overlap of computation and communication between groups. Figure 1 As shown in Figure 1. HALO communication on a massively parallel computer often needs to be implemented through MPI. The communication part related to the update of HALO zone data is called HALO exchange.

[0067] (3.1) The present invention needs to perform large-scale parallel computing, so many processors are needed. High-performance computers have up to millions of processor cores. There are thousands of processors involved in numerical forecasting calculations in the present invention. On each processor involved in the calculation, the MPI non-blocking send operation is used to start the sending of the 0th group of data in FLD3I. MPI (Message Passing Interface) is a cross-language communication protocol consisting of an envelope and data. When the communication call is blocked, the entire program can only execute communication-related content, but cannot execute calculation-related content; MPI non-blocking calls try to overlap communication and calculation to improve the overall execution efficiency of the program. MPI non-blocking calls are prior art in this field and will not be described in detail in the present invention.

[0068] (3.2) On each processor involved in the calculation, for groups i=0 to g-2, first use the MPI non-blocking send operation to start the send operation of the i+1 group of data in FLD3I. When i=g-2, use the MPI non-blocking send operation to start the communication of YHSPFI. After that, receive the i-th group of data in FLD3I. Finally, calculate the i-th group in FLD3O (to achieve simultaneous communication with the i+1-th group of data).

[0069] (3.3) On each processor involved in the calculation, for the g-1th group, first receive the data of the g-1th group of FLD3I and the data of YHSPFI, and then perform the calculation of the g-1th group of FLD3O and the calculation of YHSPFO.

[0070] Step 4: Due to b 0 +5≤L+1, so g≥L / (L-4). At the same time, the communication of FLD3I, the first group has at least 1+5=6 layers, and the remaining groups have at least 1 layer, so g≤L-4. For g=[L / (L-4)]~L-4, run the program under the condition of dividing into g groups according to the first to third steps, and record the execution time of the semi-Lagrangian scheme stage as t g For all possible g, select such that t g Since the subsequent program code will not change after g is selected, this g can be used as the number of groups in subsequent business operations to minimize the business operation time.

[0071] In order to make the technical solution and beneficial effects of the present invention clearer, the present invention is further described below in conjunction with practical examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0072] Example

[0073] Figure 2This is a schematic diagram of the arrangement of the computing and communication operation sequence and the computing and communication overlap when the number of groups is 4 and the three-dimensional field is grouped by vertical layers in the present invention. The specific steps include:

[0074] Step 1) Set g = [L / (L-4)], t m =1E8.

[0075] Step 2) For i=0,1,...,g-1, calculate l i :When i≤L%g, l i =[L / g]+1; when i>L%g, l i =[L / g].

[0076] Step 3) Set b 0 = 1. For i = 0, 1, ..., g-2, set b i+1 =b i +l i .

[0077] Step 4) Set c 0 =0, c i =b i-1 +l i-1 +5(i=1~g-1), e i =min(L+1,b i +l i +4)(i=0~g-1).

[0078] Step 5) On each processor, use the data structure used for horizontal communication in the original mode program and the receiving processor number and other information to start the c in FLD3I through MPI non-blocking send operation. 0 To e 0 Layer data transmission.

[0079] Step 6) On each processor, for groups i=0 to g-2, first use the data structure used for horizontal communication in the original mode program and the receiving processor number and other information to start the c-th group in FLD3I through MPI non-blocking send operation. i+1 To e i+1 When i=g-2, the sending operation of YHSPFI is started through the MPI non-blocking sending operation. After that, the data structure and sending processor number used in the horizontal communication in the original mode program are used to perform FLD3I c i+1 To e i+1 Finally, perform FLD3O b i to b i +l i -1 layer of data calculation.

[0080] Step 7) On each processor, for the i = g - 1 group, first use the data structure and information such as the sending processor number adopted in the horizontal communication of the original mode program to receive the data from layer c i+1 to e i+1 of FLD3I and the YHSPFI data. After that, perform the calculation of the data from layer b i to b i +l i -1 of FLD3O and YHSPFO.

[0081] Step 8) Statistically calculate the total time consumption of Steps 5), 6), and 7) and denote it as t g , and set t m = min(t m , t g ), g m = g, and g = g + 1. If g < L - 4, then go to Step 2).

[0082] Step 9) The obtained g m is the optimal grouping parameter.

[0083] Compared with the prior art, the present invention can achieve the following technical effects:

[0084] By performing grouping in the vertical direction, compared with the method of grouping according to the total number of fields, which is 16, since the vertical number of layers of the current operational forecasting model has reached 137 layers, the maximum possible number of groups can be greatly increased. This is conducive to decomposing the calculation and communication to the greatest extent, reducing the time of the two parts of the sending of the 0th group and the receiving and calculation of the g - 1th group, which is equivalent to reducing the operation time at the start and end of the pipeline, thereby facilitating the improvement of the overall calculation efficiency.

[0085] Using the actual running time at different numbers of groups to determine the optimal number of groups can achieve the purpose of minimizing the parallel execution time to the greatest extent. When performing grouping, if the number of groups is too small, it is not conducive to reducing the overall execution time due to the long execution time at the start and end. If the number of groups is too large, it will also lead to an increase in the number of communications because each group needs to communicate separately, which is also not conducive to reducing the overall execution time. By determining the number of groups that minimizes the execution time through the execution of the actual program for different numbers of groups in advance and using the determined optimal number of groups for subsequent operational numerical forecasting, the time of operational numerical forecasting can be minimized to the greatest extent.

[0086] As used herein, the word "preferred" is intended to be used as an example, instance, or illustration. Any aspect or design described herein as "preferred" is not necessarily to be construed as being more advantageous than other aspects or designs. On the contrary, the use of the word "preferred" is intended to present concepts in a specific way. The term "or" as used in this application is intended to mean an inclusive "or" rather than an exclusive "or". That is, unless otherwise specified or clear from the context, "X uses A or B" means any one of the naturally included permutations. That is, if X uses A; X uses B; or X uses both A and B, then "X uses A or B" is satisfied in any of the foregoing examples.

[0087] Moreover, although the present disclosure has been shown and described with respect to one or implementations, those skilled in the art will think of equivalent variations and modifications based on the reading and understanding of this specification and the accompanying drawings. The present disclosure includes all such modifications and variations, and is limited only by the scope of the appended claims. In particular, with respect to the various functions performed by the above-mentioned components (such as elements, etc.), the terms used to describe such components are intended to correspond to any component (unless otherwise indicated) that performs the specified function of the component (such as it is functionally equivalent), even if the structure is not equivalent to the disclosed structure of the function in the exemplary implementation of the present disclosure shown herein. In addition, although the specific features of the present disclosure have been disclosed with respect to only one of several implementations, such features can be combined with one or other features of other implementations that may be desired and advantageous for a given or specific application. Moreover, insofar as the terms "including", "having", "containing" or their variations are used in specific embodiments or claims, such terms are intended to be included in a manner similar to the term "comprising".

[0088] The functional units in the embodiments of the present invention may be integrated into a processing module, or each unit may exist physically separately, or multiple or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc. The above-mentioned devices or systems may execute the storage method in the corresponding method embodiment.

[0089] To sum up, the above embodiment is an implementation mode of the present invention, but the implementation mode of the present invention is not limited by the embodiment, and any other changes, modifications, substitutions, combinations, and simplifications that deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A semi-Lagrangian interpolation communication optimization method based on vertical layer grouping, It is characterized in that The following steps are involved: S1: Collect three-dimensional field data of numerical weather forecast semi-Lagrangian interpolation; S2: The collected three-dimensional field data are sequentially stored in the three-dimensional array FLD3I (1:N, 0:L+1, 1:F), and the three-dimensional array FLD3O (1:N, 1:L, 1:F) is allocated to store the three-dimensional field data obtained by interpolation, where N is the total number of horizontal grid points in this process, L is the number of vertical layers of the model, and F is the number of fields to be interpolated; S3: storing the two-dimensional field corresponding to a certain variable in the array YHSPFI(1:N), and allocating the array YHSPFO(1:N) to store the result of interpolating the two-dimensional field corresponding to the certain variable; S4: group all three-dimensional fields in the vertical direction; S5: Divide the operation of each group into two parts: communication and interpolation calculation. The communication part is performed in the three-dimensional array FLD3I and the array YHSPFI, and the interpolation results are stored in the three-dimensional array FLD3O and the array YHSPFO respectively. S6: Re-plan computing and communication in grouping to achieve computing and communication overlap; S7: For the candidate grouping numbers, execute steps S4-S6 in sequence, and select the grouping number that minimizes the execution time of the semi-Lagrangian scheme stage.

2. The semi-Lagrangian interpolation communication optimization method based on vertical layer grouping according to claim 1, It is characterized in that The grouping of all three-dimensional fields in the vertical direction includes: The actual number of layers of the three-dimensional field obtained by interpolation is the 1st to Lth layers. The three-dimensional field is grouped in the vertical direction, that is, the three-dimensional array FLD3O is grouped according to the vertical layers. After grouping, g groups are obtained. The number of layers of each group differs by at most one layer. The starting layer number in the i-th (i=0,1,2,...,g-1) group is denoted as b i , the number of layers included is recorded as l i ; When i≤L%g, l i =[L / g]+1; when i>L%g, l i =[L / g], where [x] represents the integer part of x; When interpolating, the i-th layer in the three-dimensional array FLD3O corresponds to the arrival point of the semi-Lagrangian interpolation trajectory, that is, the grid point. When interpolating, at most two layers of data are used in the vertical direction. Therefore, the value of the i-th layer of the field to be interpolated in the three-dimensional array FLD3O uses at most the i-5th to i+5th layers of the corresponding field in the three-dimensional array FLD3I; at the vertical boundary, when interpolating the i-th layer data in the three-dimensional array FLD3O, at most the lowest 0th layer or the highest L+1th layer in the three-dimensional array FLD3I is used; therefore, the layers of the three-dimensional array FLD3I are grouped, and group 0 contains the 0th to bth layers. 0 +l 0 +4 layers, the i>0 group contains the b i-1 +l i-1 +5 to min(L+1,b i +l i +4) layer; The calculation of the array YHSPFO is attached to the calculation of the last group, i.e., the g-1th group, of the three-dimensional array FLD3O, and the communication operation of YHSPFI is attached to the communication operation of the last group of the three-dimensional array FLD3I.

3. The semi-Lagrangian interpolation communication optimization method based on vertical layer grouping according to claim 1, It is characterized in that The operation of each group is divided into two parts: communication and calculation, including: The communication part is carried out in arrays FLD3I and YHSPFI, and the interpolation results are stored in arrays FLD3O and YHSPFO respectively; The calculation operation corresponding to each group corresponds to the interpolation calculation of the grid points and all fields at all levels in the group; For each group of corresponding communication operations, the entire discrete grid network is regionally decomposed in the horizontal direction according to the global numerical weather forecast model to obtain multiple sub-regions. The calculation on each sub-region is carried out on a processor, the HALO area and semi-Lagrangian buffer data structure of each sub-region are determined, and mutual communication is performed between the sub-regions so that the horizontal grid point data required for interpolation at the starting point during subsequent interpolation is in this sub-region or its HALO area.

4. The semi-Lagrangian interpolation communication optimization method based on vertical layer grouping according to claim 3, It is characterized in that The semi-Lagrangian buffer refers to the FLD3I and YHSPFI arrays; the HALO area refers to the space expanded after the horizontal space expansion of FLD3I and YHSPFI, which is used to store data received from other processors.

5. The semi-Lagrangian interpolation communication optimization method based on vertical layer grouping according to claim 3, It is characterized in that The global numerical weather prediction model is at least one of YHGSM, ECMWF IFS, and GRAPES.

6. The semi-Lagrangian interpolation communication optimization method based on vertical layer grouping according to claim 1, It is characterized in that The re-planning of computing and communication in a grouping situation to achieve overlapping of computing and communication includes: On each processor, use the MPI non-blocking send operation to start sending the 0th group of data in FLD3I; On each processor, for the groups i=0 to g-2, first use the MPI non-blocking send operation to start the send operation of the i+1 group of data in the three-dimensional array FLD3I; when i=g-2, use the MPI non-blocking send operation to start the communication of the array YHSPFI; then, receive the i-th group of data in the three-dimensional array FLD3I; finally, calculate the i-th group of the three-dimensional array FLD3O, and realize the calculation while communicating with the i+1-th group of data; On each processor, for the g-1th group, first receive the g-1th group data of the three-dimensional array FLD3I and the data of the array YHSPFI; then perform calculations on the g-1th group of the three-dimensional array FLD3O and the array YHSPFO.

7. The semi-Lagrangian interpolation communication optimization method based on vertical layer grouping according to claim 1, It is characterized in that The step S4-S6 is performed in sequence for each candidate grouping number to select a grouping number that minimizes the execution time of the semi-Lagrangian scheme stage, including: For g = [L / (L-4)] ~ L-4, run the program according to steps S4-S6, and record the execution time of the semi-Lagrangian scheme stage as t g , for all possible g, select such that t g The smallest one; this g is used as the number of groups when the subsequent business is running to minimize the business running time.

Citation Information

Patent Citations

  • Interpolation transformation method with various sampling rates

    CN103324603A

  • Global medium-term numerical forecast GRAPES_GFS

    CN110703357A