An MPI parallel data structure based on arbitrary polyhedral unstructured grid

Through the MPI parallel data structure and sparse matrix CSR storage method, the problems of low parallel computing efficiency and insufficient storage of polyhedral unstructured grids in CFD are solved, and efficient parallel solving and storage optimization are achieved, which is suitable for large-scale grid calculations.

CN113900808BActive Publication Date: 2024-09-20HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111176696.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-09
Publication Date
2024-09-20
Estimated Expiration
2041-10-09

AI Technical Summary

Technical Problem

In fluid mechanics CFD, the traditional single-processor serial solution is difficult to meet the computing needs of complex aircraft shapes and large-scale grids, especially for arbitrary polyhedral unstructured grids, the distributed representation of grid elements and the complexity of connection relationships. This leads to low parallel efficiency, and the memory of a single machine is not enough to store all grid data.

Method used

MPI parallel data structure is used to allocate grid blocks to multiple processes through grid division, global numbering, custom partitioning and sparse matrix CSR storage methods, and MPI non-blocking communication is used to generate distributed lists and store grid connection relationships. , suitable for arbitrary polyhedral unstructured meshes.

Benefits of technology

It effectively reduces the storage load of a single CPU, improves the solution scale and efficiency of parallel CFD programs, reduces storage space occupation, and realizes the overlap of calculation and communication, adapting to large-scale grid computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113900808B
    Figure CN113900808B
Patent Text Reader

Abstract

The invention relates to an MPI parallel data structure based on an arbitrary polyhedral unstructured grid. The polyhedral unstructured grid is used to grid a flow field area, and the grid elements of the grid division are globally numbered, and the connection relationship between different grid elements is recorded, wherein the grid elements include points, lines, surfaces, and units. The grid is partitioned by a custom partitioning program to generate a plurality of grid blocks, and the grid blocks are allocated to different processes and each process is allocated at least one grid block. A distributed list of different grid elements in the process is created and stored, and the distributed list of grid elements is combined with the global grid connection relationship to generate the grid connection relationship in the current process, and the grid connection relationship in the current process is stored in a sparse matrix CSR mode. The MPI parallel data structure of the invention can reduce the storage load of a single CPU to ensure the solution scale of a CFD program, and can maintain a relatively high parallel efficiency at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computational fluid dynamics, in particular to the field of MPI parallel data structure. Background Art

[0002] As the shape of aircraft becomes increasingly complex, the scale of grids increases day by day, and high-precision formats require huge computational overhead, the serial solution of traditional single processors will be difficult to meet the actual needs. Therefore, the practical application of fluid mechanics CFD requires the use of high-performance parallel computing methods. Commonly used parallel programming models in CFD mainly include shared storage models such as OpenMP and CUDA and distributed storage models such as MPI. Since the solution between grid units is coupled in CFD numerical solution, the parallel efficiency of directly using shared storage models such as OpenMP is very low. At the same time, for large-scale grids, the single machine memory may not be able to store all grid data. Distributed storage models such as MPI are used in conjunction with custom partitioning tools (such as Metis) to divide the solution of the entire grid into multiple processes, and realize communication between processes through MPI functions. This distributed storage method is very suitable for CFD parallel computing. Although the MPI parallel programming model is very suitable for CFD parallel computing, the structural design of the program is relatively complex. Specifically, how to represent the grid elements in a distributed manner and how to store the connection relationship between grid elements in a distributed manner are the difficulties in achieving parallelism, especially for arbitrary polyhedral unstructured grids, whose grid information is more difficult to process than structured grids. Summary of the invention

[0003] In order to solve the above problems, the present invention achieves the above objectives through the following technical solutions:

[0004] An MPI parallel data structure based on arbitrary polyhedral unstructured grids includes the following steps:

[0005] S1. Use polyhedral unstructured grid to mesh the flow field area;

[0006] S2. Globally numbering the grid elements of the divided grid and recording the connection relationship between different grid elements, wherein the grid elements include points, lines, surfaces, and cells;

[0007] S3, partitioning the grid by a custom partitioning program to generate a number of grid blocks, and assigning the grid blocks to different processes and each process is assigned at least one grid block, where the number of processes is m, m ≥ 1;

[0008] S4, creating and storing a distributed list of different grid elements in the i-th process, where 1≤i≤m;

[0009] S5. Combine the distributed list of grid elements with the global grid connection relationship to generate the grid connection relationship in the current i process, and use the sparse matrix CSR method to store the grid connection relationship in the i process, where 1≤i≤m.

[0010] As a further optimization solution of the present invention, the steps of globally numbering the grid elements are as follows:

[0011] S21, determining the global numbers of points and lines based on the point coordinates of the grid elements and the connection relationship between the points and lines;

[0012] S22. Using the grid topology structure, determine the global number of the surface and the global number of the unit in the grid element in turn.

[0013] As a further optimization scheme of the present invention, the grid partitioning method includes multi-level recursive binary division and multi-level k-way division, wherein, if the number of partitions is less than 8, multi-level recursive binary division is adopted; if the number of partitions is greater than or equal to 8, multi-level k-way division is adopted.

[0014] As a further optimization solution of the present invention, the step of creating a distributed list in the i process includes:

[0015] S41, generating a mapping array of unit local numbers and global numbers in each process;

[0016] S42, adding a virtual unit number in the number mapping array according to the grid topology structure, wherein the virtual unit refers to a unit adjacent to the current process;

[0017] S43. Create a distributed list of cells, and then generate distributed lists of other grid elements.

[0018] As a further optimization solution of the present invention, the content of the distributed list of creation units includes units used for communication between processes, and the units include grid block inner boundary units and virtual units.

[0019] As a further optimization solution of the present invention, the content of the distributed list storing different grid elements in the i-th process includes the global number of the grid element, the local number in the current process, and the local number in the adjacent process.

[0020] As a further optimization scheme of the present invention, the communication between the processes adopts the MPI parallel communication method, and each process traverses all grid blocks; when the traversed grid block belongs to the current process, data is sent to the process where the neighboring grid block is located; when the traversed grid block belongs to its neighbor, data is received from the process where the neighboring grid block is located; wherein, the sending and receiving of data uses the MPI non-blocking sending and receiving functions, and the actual calculation part is performed in the MPI background.

[0021] As a further optimization solution of the present invention, the grid connection relationship within the process includes a distributed list of grid elements within the process, CSR storage information, and a global number corresponding to a local number of the connection relationship.

[0022] As a further optimization scheme of the present invention, the implementation method of storing the grid connection relationship between cells and faces within the i process in the sparse matrix CSR method includes a one-dimensional array for recording the number of faces around the cell and a one-dimensional array for recording the local numbers of the faces around the cell within the process.

[0023] The beneficial effects of the present invention are:

[0024] 1) The present invention adopts the strategy of Metis partitioning and MPI parallel communication, which is equivalent to dividing the task into multiple subtasks, which can effectively reduce the storage load of a single CPU and ensure the solution scale of the CFD program;

[0025] 2) The MPI communication mode uses non-blocking communication, which can achieve the overlap of computing and communication and maintain high parallel efficiency;

[0026] 3) Distributed list and grid connection relationship distributed CSR storage method is suitable for any polyhedral unstructured grid, which can effectively improve the operation of parallel CFD programs; and the row-compressed sparse matrix CSR method can reduce the storage space occupied by grid connection relationships. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a flow chart of the MPI parallel data structure implementation of the polyhedral unstructured grid in the present invention;

[0028] Figure 2 A schematic diagram of the generation and storage of distributed data in the present invention;

[0029] Figure 3 It is a classification diagram of unit attributes in the process of the present invention; DETAILED DESCRIPTION

[0030] The present application is further described in detail below in conjunction with the accompanying drawings. It is necessary to point out here that the following specific implementation methods are only used to further illustrate the present application and cannot be understood as limiting the scope of protection of the present application. Technical personnel in this field can make some non-essential improvements and adjustments to the present application based on the above application content.

[0031] like Figures 1 to 3 An MPI parallel data structure based on arbitrary polyhedral unstructured grid is shown, which improves the scale of grid solution and the efficiency of parallel solution through distributed storage of grid information;

[0032] Among them, Figure 1The steps for implementing the parallel data structure shown include:

[0033] Step 1: Use any polyhedral unstructured grid to mesh the flow field area under study;

[0034] Step 2: Create numbering information for mesh elements such as points, lines, surfaces, and cells, and record the connection relationship between mesh elements according to the mesh topology structure;

[0035] Step 3: Use the Metis partitioning package to partition the grid. According to the number of processes set for the current solution task, one process is assigned one or more grid blocks.

[0036] Step 4: Run the CFD parallel program and create a distributed list of grid elements for each process;

[0037] Step 5: According to the distributed list data of grid elements such as points, lines, surfaces, and cells and the global grid connection relationship, the in-process grid connection relationship is stored through the distributed CSR storage method;

[0038] Specifically, step S1 is as follows: Figure 2 The method includes: using a grid division software to divide the flow field under study into an unstructured grid, and keeping the grid data into a grid file with a custom suffix of .emesh; the content of the grid file mainly includes: ① the coordinates of the grid points; ② the connection relationship between the grid lines and the points, that is, the point numbers at both ends of the grid lines; ③ the grid line numbers of the boundaries; preferably, the CFD solver EasyCFD independently developed by the inventor's research team can be selected to solve the flow field;

[0039] Step S2, importing the mesh file (suffix .emesh) generated in the meshing software into the CFD solver, generating global numbering information of mesh elements such as points, lines, surfaces, and cells according to the function of the program pre-processing module, and recording the connection relationship between mesh elements; wherein the connection relationship between the mesh elements includes: connection relationship between cells, cells and surfaces, cells and points, surfaces and lines, lines and points, etc.;

[0040] Step S3, partition the grid using a custom partitioning package, and allocate one or more grid blocks to one process according to the number of processes set for the current solution task; for example, the partitioning of the grid can be achieved by calling METIS_PartGraphRecursive or METIS_PartGraphKway in the Metis library; wherein, if the number of partitions is less than 8, a multi-level recursive binary division method, i.e., the METIS_PartGraphRecursive function, is adopted; if the number of partitions is greater than or equal to 8, a multi-level k-way partitioning method, i.e., the METIS_PartGraphKway function, is adopted;

[0041] like Figure 3 Specifically, the grid cells in the process are a collection of grid cells of some grid blocks of the original grid. The attributes of the grid cells in the process include three categories: internal cells, boundary cells and virtual cells. ① Internal cells: inside the grid block, only participate in the calculation in the current process; ② Boundary cells: grid block boundaries, participate in the calculation of the current process and adjacent processes, and are virtual cells in adjacent processes; ③ Virtual cells: other process cells adjacent to the boundary cells, need to participate in the calculation of the current process, and are boundary cells in adjacent processes;

[0042] Step S4: Create and store a distributed list of different grid elements in the i-th process, wherein the step of creating a distributed list in the i-th process includes:

[0043] S41, generating a mapping array of unit local numbers and global numbers in each process;

[0044] S42, adding a virtual unit number in the number mapping array according to the grid topology structure, wherein the virtual unit refers to a unit adjacent to the current process;

[0045] S43, creating a distributed list of cells, and then generating distributed lists of other grid elements;

[0046] Specifically, the content of the distributed list of the creation unit in step S43 is as shown in Table 1;

[0047] ① Process information: current MPI process number mpi_comm_rank_ and the total number of processes participating in MPI communication mpi_comm_size_;

[0048] ② Grid element quantity information: global grid element quantity size_global, local grid element quantity size_local_ and virtual grid element quantity size_ghost_;

[0049] ③ Global and local number mapping information: global number item_list_ corresponding to local numbers of grid elements and virtual grid elements in grid blocks, local number item_idx_map_ corresponding to global numbers of grid elements in grid blocks, local number ghost_idx_map_ corresponding to global numbers of virtual grid elements;

[0050] ④Grid element information used for communication between processes: internal grid block boundary grid element number ghosts_of_cur_ and virtual grid element number ghosts_of_adj_;

[0051] ⑤The number of times the numbers are reordered in the process reordered_times_;

[0052] Table 1 Distributed list storage content (taking unit as an example)

[0053]

[0054] Among them, the grid element information (taking a unit as an example) used for communication between processes includes a unit used for communication between processes, which includes a boundary unit and a virtual unit in a grid block; the storage information for storing a distributed list of different grid elements in the i-th process includes (taking a boundary unit as an example): ① global number. ② local number in the current process. ③ local number in an adjacent process (in an adjacent process, the boundary unit is a virtual unit);

[0055] The method for reordering the numbers in the process is the RCM algorithm. After RCM sorting, the non-zero elements of the sparse matrix will be concentrated near the diagonal. For the equation system after CFD linearization, the sorted numbers can be used to concentrate the non-zero elements of the Jacobian matrix near the diagonal.

[0056] In addition, the communication between processes adopts the MPI parallel communication mode, and each process traverses all grid blocks; when the traversed grid block belongs to the current process, data is sent to the process where the neighboring grid block is located; when the traversed grid block belongs to its neighbor, data is received from the process where the neighboring grid block is located; and the sending and receiving of data uses the MPI non-blocking sending and receiving functions, and the actual calculation part is performed in the MPI background;

[0057] Step S5, combining the distributed list of grid elements with the global grid connection relationship to generate the grid connection relationship in the current i process, and using the sparse matrix CSR method to store the grid connection relationship in the i process, where 1≤i≤m;

[0058] Specifically, the distributed storage content of the grid connection relationship within the process mainly includes (taking the unit surface connection relationship as an example): Take Table 2 as an example;

[0059] ①Distributed list information: the distributed list dl_row_ of the unit in the process and the distributed list dl_col_ of the face;

[0060] ②CSR storage information: one-dimensional array offset that records the number of faces around the unit and one-dimensional array data that records the face numbers around the unit;

[0061] ③ The global number global_edge_idx corresponding to the local number of the connection relationship. Table 2 shows the storage content of the distributed grid connection relationship (taking the unit surface connection relationship as an example);

[0062] Table 2 Distributed grid connection relationship storage content (taking unit surface connection relationship as an example)

[0063]

[0064] The implementation method of storing the mesh connection relationship between the cells and faces in the i process in the sparse matrix CSR method includes a one-dimensional array recording the number of faces around the cells and a one-dimensional array recording the local numbers of the faces around the cells in the process;

[0065] The strategy of grid partitioning and MPI parallel communication adopted in the present invention is equivalent to dividing the task into multiple subtasks, which can effectively reduce the storage load of a single CPU and ensure the solution scale of the CFD program; wherein, the MPI communication mode uses non-blocking communication, which can realize the overlap of calculation and communication and maintain a high parallel efficiency;

[0066] The MPI parallel data structure mainly uses a distributed list to store in-process grid elements, and a distributed CSR method to store grid connection relationships. The row-compressed sparse matrix CSR method can reduce the storage space occupied by grid connection relationships. Therefore, this distributed structure and CSR storage method can effectively reduce the storage load of a single CPU, ensure the solution scale of the CFD program, and adapt to any polyhedral unstructured grid, which can effectively improve the parallel CFD program.

[0067] At the same time, MPI_WINDOWS technology is used to update virtual element data, which can effectively improve the operating performance on computer clusters with RDMA characteristics.

[0068] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A method for implementing an MPI parallel data structure based on an arbitrary polyhedral unstructured grid, characterized in that: The following steps are included: S1. Use polyhedral unstructured grid to mesh the flow field area; S2. Globally numbering the grid elements of the divided grid and recording the connection relationship between different grid elements, wherein the grid elements include points, lines, surfaces, and cells; S3, partitioning the grid to generate a number of grid blocks through a custom partitioning program, and assigning the grid blocks to different processes and each process is assigned at least one grid block, where the number of processes is m, m ≥ 1; S4, creating and storing a distributed list of different grid elements in the i-th process, where 1 ≤ i ≤ m; S5, combining the distributed list of grid elements with the global grid connection relationship to generate the grid connection relationship in the current i process, and using the sparse matrix CSR method to store the grid connection relationship in the i process, where 1 ≤ i ≤ m; The steps of creating the distributed list in the i-th process include: S41, generating a mapping array of unit local numbers and global numbers in each process; S42, adding a virtual unit number in the number mapping array according to the grid topology structure, wherein the virtual unit refers to a unit adjacent to the current process; S43, creating a distributed list of cells, and then generating distributed lists of other grid elements; The content of the distributed list storing different grid elements in the i-th process includes the global number of the grid element, the local number in the current process, and the local number in the adjacent process; The content of the distributed list of creation units includes units used for communication between processes, and the units include boundary units within grid blocks and virtual units; The grid connection relationship within the process includes a distributed list of grid elements within the process, CSR storage information, and a global number corresponding to a local number of the connection relationship; The implementation method of storing the grid connection relationship between cells and faces in the i-process in the sparse matrix CSR method includes a one-dimensional array recording the number of faces around the cells and a one-dimensional array recording the local numbers of the faces around the cells in the process.

2. The method for implementing an MPI parallel data structure based on an arbitrary polyhedral unstructured grid according to claim 1, characterized in that: The steps of globally numbering the grid elements are as follows: S21, determining the global numbers of points and lines based on the point coordinates of the grid elements and the connection relationship between the points and lines; S22. Using the grid topology structure, determine the global number of the surface and the global number of the unit in the grid element in turn.

3. The method for implementing an MPI parallel data structure based on an arbitrary polyhedral unstructured grid according to claim 2, characterized in that: The grid partitioning method includes multi-level recursive binary division and multi-level k-way division. If the number of partitions is less than 8, the multi-level recursive binary division is adopted; if the number of partitions is greater than or equal to 8, the multi-level k-way division is adopted.

4. The method for implementing an MPI parallel data structure based on an arbitrary polyhedral unstructured grid according to claim 3, characterized in that: The communication between the processes adopts the MPI parallel communication method, and each process traverses all grid blocks; when the traversed grid block belongs to the current process, data is sent to the process where the neighboring grid block is located; when the traversed grid block belongs to its neighbor, data is received from the process where the neighboring grid block is located; wherein, the sending and receiving of data uses the MPI non-blocking sending and receiving functions, and the actual calculation part is performed in the MPI background.