WO2021077552A1 - 一种面向数值模型的并行通信方法、装置、系统和存储介质 - Google Patents

一种面向数值模型的并行通信方法、装置、系统和存储介质 Download PDF

Info

Publication number
WO2021077552A1
WO2021077552A1 PCT/CN2019/122767 CN2019122767W WO2021077552A1 WO 2021077552 A1 WO2021077552 A1 WO 2021077552A1 CN 2019122767 W CN2019122767 W CN 2019122767W WO 2021077552 A1 WO2021077552 A1 WO 2021077552A1
Authority
WO
WIPO (PCT)
Prior art keywords
grid
grid point
parallel
data
image area
Prior art date
Application number
PCT/CN2019/122767
Other languages
English (en)
French (fr)
Inventor
刘利
李锐喆
张�诚
王斌
Original Assignee
清华大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 清华大学 filed Critical 清华大学
Publication of WO2021077552A1 publication Critical patent/WO2021077552A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Definitions

  • the invention relates to a numerical model-oriented parallel communication technology, in particular to a numerical model-oriented parallel communication method, device, system and storage medium.
  • Earth system model is an indispensable scientific tool for the study of climate evolution law, future climate prediction and seamless numerical prediction. It is coupled by a coupler through component models that simulate the atmosphere, land, ocean, and sea ice. constitute. All component models of the earth system model are based on a grid-based numerical model (Numerical Model), that is, the area to be simulated (horizontal two-dimensional or three-dimensional space) is divided into a number of non-overlapping grid points, also called atomic regions. Perform collaborative calculations on all grid points. For a region, the more grid points are divided, the higher the resolution of the simulation, and the greater the amount of calculation in the simulation process.
  • Numerical Model numerical model
  • MPI Message Passing Interface
  • the square grid area in Figure 1 is divided into four non-overlapping sub-areas (computing areas), and each sub-area is divided into several grid points (not shown), and all the sub-areas in each sub-area
  • the grid points are calculated by a process.
  • the numerical model method will introduce the dependency between the grid points, that is, when calculating the data on one grid point, the data on the other grid points needs to be used; this means that in the process of parallel computing in multiple processes , One process will use the data on the grid points calculated by other processes.
  • a process not only needs to store the data of the grid points it is responsible for calculating, but also needs to store the data of the grid points it needs to be calculated by other processes.
  • the area composed of several grid points that it is responsible for calculation is called the calculation area, and the area composed of several grid points that it needs to use but does not need to calculate is called the image area, that is, other processes
  • the shadow of the calculation result; the area composed of the calculation area and the image area is called the parallel subdivision area.
  • the image areas are usually located at the periphery of the calculation area.
  • the data of the grid points in the image area of one process is calculated by other processes.
  • the process needs to use the data in the image area, it needs to complete the data exchange for the image area between the process and other processes, that is, transfer part of the data calculated by other processes to the image area of the process based on the communication method.
  • This requires the establishment of inter-process communication relationships based on the parallel splitting and the dependency relationship between grid points, such as determining which MPI processes an MPI process exchanges data with, and completing data packaging, communication, and disassembly in the process of exchanging data. Package etc.
  • it is often necessary to develop and apply parallel communication libraries for specific grid points and specific parallel subdivisions.
  • the present invention provides a numerical model-oriented parallel communication method, device, system and storage medium.
  • the present invention provides a parallel communication method oriented to a numerical model.
  • the numerical model divides a multi-dimensional space into a number of sub-grids, including a horizontal two-dimensional sub-grid composed of a number of grid points.
  • a plurality of parallel split regions are formed on the horizontal two-dimensional sub-grid, the data of each parallel split region is stored in a process, and the parallel split region corresponding to the process includes a calculation area and an image area.
  • the data of the grid points contained in the calculation area is calculated by the process, and the data of the grid points contained in the image area is calculated by other processes.
  • the method includes the following steps:
  • the first process and the other processes respectively record the grid point numbers of the grid points contained in the calculation area and the grid points contained in the image area in the corresponding parallel division area;
  • the image area corresponding to the first process includes The data of the first grid point comes from the second grid points with the same grid point number recorded in the calculation area corresponding to the second process in the other processes;
  • the method further includes:
  • the steps S1 and S2 further include:
  • the first process and the other processes respectively record the parallel division numbers of the grid points contained in the calculation area in the parallel division area and the parallel division of the grid points contained in the image area. Numbering;
  • the parallel division number indicates the storage location number of the grid point data contained in the parallel division area in the process corresponding to the parallel division area.
  • the step S3 further includes:
  • the parallel division number corresponding to the first grid point is the first parallel division number
  • the parallel division number corresponding to the second grid point is the second parallel division number to clarify the The storage locations of the data of the first grid point and the second grid point in the first process and the second process, respectively.
  • the data of the grid point includes at least one of the following items: airiness, wind speed, air pressure and humidity in the atmospheric mode; sea temperature, flow velocity and salinity in the ocean mode.
  • the method further includes:
  • the registering the horizontal two-dimensional sub-grid includes:
  • the present invention provides a parallel communication device oriented to a numerical model.
  • the numerical model divides a multi-dimensional space into a number of sub-grids, including a horizontal two-dimensional sub-grid composed of a number of grid points.
  • a plurality of parallel split regions are formed on the horizontal two-dimensional sub-grid, and the data of each parallel split region is stored in a process, and the parallel split region corresponding to the process includes a calculation area and an image area.
  • the data of the grid points contained in the calculation area is calculated by the process, and the data of the grid points contained in the image area is calculated by other processes.
  • the device includes:
  • the grid point number assignment module is used to assign a grid point number to each grid point on the horizontal two-dimensional sub-grid, so that each grid point has a relative to the horizontal two-dimensional sub-grid.
  • the unique grid point number of the grid is used to assign a grid point number to each grid point on the horizontal two-dimensional sub-grid, so that each grid point has a relative to the horizontal two-dimensional sub-grid.
  • the process management module is used to make the first process and the other processes respectively record the grid point numbers of the grid points contained in the calculation area in the parallel division area and the grid points contained in the image area.
  • Grid number
  • the grid point matching module is based on the grid point numbers of the first grid points contained in the image area recorded by the first process, and according to the grid point numbers of the grid points contained in the respective calculation areas recorded by the other processes.
  • the grid point number if the first grid point number is the same as the grid point number of the second grid point contained in the calculation area corresponding to the second process in the other processes, the grid point number corresponding to the first process is determined.
  • the data of the first grid point included in the image area comes from the second grid point recorded with the same grid point number included in the calculation area corresponding to the second process in the other processes;
  • a communication mapping establishment module to establish a mapping relationship between the first grid points included in the image area corresponding to the first process and the second grid points included in the calculation area corresponding to the second process , To transfer the data of the second grid point to the first grid point to realize the data transmission between processes oriented to the numerical model.
  • the present invention provides a numerical model-oriented parallel communication system, including a processor and a memory, where a computer program is stored in the memory, and when the computer program is executed by the processor, any of the above methods is implemented .
  • the present invention provides a storage medium storing a computer-readable program, and the computer-readable program, when executed by a processor, implements any of the above methods.
  • the present invention has the following advantages or beneficial effects:
  • the numerical model-oriented parallel communication method and device of the present invention enables model developers to conveniently complete the development of parallel versions of numerical models, and on the other hand, the same parallel version can support more types of horizontal two-dimensional sub-grids, Parallel partitioning and numerical methods, that is, when updating the mesh or parallel partitioning of the model, or adjusting the dependency between the grid points due to the updated numerical method, there is no need to develop a new parallel version.
  • High efficiency support to aggregate multiple variables to complete data exchange at one time to improve communication efficiency; support asynchronous communication model, that is, the communication process can overlap with the calculation process to reduce the impact of communication overhead, and support asynchronous communication model Convenient switching with synchronous communication model.
  • Figure 1 is a schematic diagram of grid division of a numerical model in related technologies
  • Figure 2 is a schematic diagram of parallel meshing of a numerical model in the related art
  • Fig. 3 is a flowchart of a numerical model-oriented parallel communication method according to the first embodiment of the present invention.
  • Fig. 3 is a flowchart of a numerical model-oriented parallel communication method according to the first embodiment of the present invention. The following describes each step of the first embodiment of the present invention in detail with reference to Fig. 3.
  • the present invention provides a parallel communication method oriented to a numerical model.
  • the numerical model divides a multi-dimensional space into a number of sub-grids, including a horizontal two-dimensional sub-grid composed of a number of grid points.
  • a plurality of parallel split regions are formed on the horizontal two-dimensional sub-grid, the data of each parallel split region is stored in a process, and the parallel split region corresponding to the process includes a calculation area and an image area, so The data of the grid points contained in the calculation area is calculated by the process, and the data of the grid points contained in the image area is calculated by other processes.
  • the method includes the following steps:
  • each grid point on the horizontal two-dimensional sub-grid is schematically assigned a unique grid point number.
  • Table 1 Horizontal two-dimensional sub-grid formed by grid points with grid point numbers
  • Table 2 shows a schematic table of parallel division based on the horizontal two-dimensional sub-grid of Table 1. Among them, for the sake of clarity, only part of the parallel subdivision area is shown.
  • Table 2 it shows three parallel sub-regions contained in the horizontal two-dimensional sub-grid, including the first parallel sub-region, the range size is 5 rows and 10 columns, and the grid point number is [4-13 ⁇ 19-28 ⁇ 34-43 ⁇ 49-58 ⁇ 64-73 ⁇ ;
  • the second parallel division area, the range is 6 rows and 7 columns, and the grid point number is ⁇ 1-7 ⁇ 16- 22] [31-37] [46-52] [61-67] [76-82];
  • the third parallel subdivision area, the range is 6 rows and 5 columns, and the grid point number is [41-45] [56 -60] [71-75] [86-90] [101-105] [116-120].
  • the first parallel subdivision area can be in charge of the first process, and the area with the grid point number in bold in the middle is the calculation area that the first process is responsible for calculating and storing, for example, the grid point number [6-11 ] Or [51-56].
  • the area that is only stored by the first process is the image area that the first process is responsible for, such as the grid point number [4-5] [12-13] or [64-73].
  • the second parallel subdivision area can be responsible for the second process, where the area with the grid point numbers in italics on the left is the calculation area for the second process to calculate and store, for example, grid point numbers [1-5] or [61- 65].
  • the non-italicized area that is only stored by the second process is the image area that the second process is responsible for, such as grid point numbers [6-7] [66-67]...[76-82].
  • the third parallel subdivision area can be in charge of the third process, and the area with the grid point numbers in italics on the right is the calculation area that the third process is responsible for calculating and storing, such as the grid point number [57-60] or [117- 120].
  • the area that is only stored by the second process is the image area that the second process is responsible for, such as the grid point number [41-45] [56] or [116].
  • the first process and the other processes respectively record the grid point numbers of the grid points contained in the calculation area and the grid point numbers of the grid points contained in the image area in the corresponding parallel division area.
  • the first process is made to record the grid point numbers of the grid points contained in the calculation area in the first parallel division area, that is, the grid points of the grid points in bold in the middle mentioned in step S1.
  • Grid number namely [6-11] [21-26] [36-41] [51-56]; and make the first process record the grid of grid points contained in the image area in the first parallel subdivision area Grid number, namely [4-5, 12-13] [19-20, 27-28] [34-35, 42-43] [49-50, 57-58] [64-73].
  • the calculation area corresponding to the second process contains the second grid point recorded with the same grid point number.
  • the first grid point can be any one of the partial grid points included in the image area recorded by the first process, for example, it can be a grid point [5]. Then, according to the grid point numbers of the grid points contained in the respective calculation areas recorded by the second process and the third process, the grid point number of the image area of the first process is determined to be the first grid of [5] The point data comes from the second grid point with the grid point number recorded as [5] in the calculation area corresponding to the second process.
  • the mapping relationship between the first grid point [5] contained in the image area corresponding to the first process and the second grid point [5] contained in the calculation area corresponding to the second process is established, In order to transfer the data of the second grid point [5] to the first grid point [5], the data transmission between processes oriented to the numerical model is realized.
  • the third grid point can be any one of the partial grid points included in the image area recorded by the first process, for example, it can be a grid point [57]. Then, according to the grid point numbers of the grid points contained in the respective calculation areas recorded by the second process and the third process, the grid point number of the image area of the first process is determined to be the third grid of [57] The point data comes from the fourth grid point recorded as [57] in the grid point number contained in the calculation area corresponding to the third process.
  • a mapping relationship between the third grid point [57] contained in the image area corresponding to the first process and the fourth grid point [57] contained in the calculation area corresponding to the third process is established, In order to transfer the data of the fourth grid point [57] to the third grid point [57], the data transmission between processes oriented to the numerical model is realized.
  • the steps in this embodiment do not limit the execution order of the steps, and it does not exclude that some steps can be executed simultaneously or out of order.
  • the data of the grid points may be one or more of airiness, wind speed, air pressure and humidity in an atmospheric mode, or sea temperature, flow velocity, and salinity in an ocean mode.
  • each grid point in the parallel division area is assigned a unique parallel division number.
  • the parallel division number indicates the storage location number of the grid point data contained in the parallel division area in the process corresponding to the parallel division area, so as to facilitate the storage and extraction of data in the process.
  • steps S1, S2, and S3 further include:
  • each grid point is represented in the form of (m, n), where m represents the parallel division number of the grid point, n Indicates the grid point number of the grid point. (m, -) indicates that the grid point is the image area responsible for the first process. This setting can store data in the image area more flexibly.
  • Table 3 The first parallel division area composed of grid points with parallel division numbers and grid point numbers
  • the grid point data of the calculation area of the second process whose grid point number is [5] mentioned above can be stored in any grid in the image area of the first process in Table 1.
  • Point (m, -) where, as long as the parallel division number of the grid point in the first process is specified, it can be (1, -), for example. In this way, for the first process, there are more choices for the data storage location, which is also convenient for searching and extracting.
  • Table 4 The second parallel division area composed of grid points with parallel division numbers and grid point numbers
  • the first process and the other processes respectively record the parallel division numbers of the grid points contained in the calculation area in the parallel division area and the parallel division of the grid points contained in the image area. Numbering.
  • the parallel division number corresponding to the first grid point is the first parallel division number
  • the parallel division number corresponding to the second grid point is the second parallel division number to clarify the The storage locations of the data of the first grid point and the second grid point in the first process and the second process, respectively.
  • the parallel division number of the first grid point of the first process with the grid point number [5] is [2]
  • the first grid point is represented as (2, 5), which means data storage
  • the parallel partition number is [2] storage location.
  • the parallel division number of the second grid point of the second process with the grid point number [5] is [5]
  • the second grid point is represented as (5, 5), indicating that the data is stored in the second process
  • the parallel division number is [5] storage location.
  • mapping relationship between the grid points is established between the processes according to the same grid point number, and then the storage location in a process after data exchange is determined according to the parallel division number.
  • This process is the first process.
  • the present invention also provides a parallel communication library oriented to a numerical model.
  • the numerical model divides the multi-dimensional space into a number of sub-grids, including a horizontal two-dimensional sub-grid composed of a number of grid points.
  • a plurality of parallel split areas are formed on the sub-grid, and the data of each parallel split area is stored in a process.
  • the parallel split area corresponding to the process includes a calculation area and an image area.
  • the data of the included grid points is calculated by the process, and the data of the grid points included in the image area is calculated by other processes.
  • the numerical model-oriented parallel communication library includes the following modules:
  • General grid management module uses a common method to manage different types of horizontal two-dimensional sub-grids, recording the range of the horizontal two-dimensional sub-grid, the number of grid points, the coordinate value of the center of each grid point, the coordinate value of all vertices of each grid point, The unit of coordinate value, whether each grid point is valid or not, the area of each grid point, etc.; unified management of multiple types of one-dimensional sub-grids, recording the number of grid points of one-dimensional sub-grids, and the coordinates of the center of each grid point Units of values, coordinate values, etc.; unified management of multi-dimensional grids including horizontal two-dimensional sub-grids, and supports users to construct a three-dimensional or four-dimensional grid composed of a horizontal two-dimensional sub-grid and several one-dimensional sub-grids.
  • the user When the user builds a multi-dimensional grid, it supports flexible setting of the dimension order. For example, for a three-dimensional grid, the user can set the dimension order to "horizontal + vertical" (the horizontal direction is in the low dimension, the vertical direction is in the high dimension) or " Vertical + horizontal".
  • This module adopts a general method to uniformly manage any parallel divisions on any horizontal two-dimensional sub-grid. In each process, it records the grid point number and the parallel division number of each grid point in the parallel division in the corresponding horizontal two-dimensional sub-grid.
  • General image area management module adopts a general method to uniformly manage the horizontal two-dimensional sub-grid and any image area setting on any parallel division.
  • a parallel division can include the image area, and the grid point numbers of all grid points in the image area can be It is marked with the same special value "-".
  • This module adopts a unified method to manage variables corresponding to arbitrary grids, arbitrary parallel divisions, and arbitrary data types (such as integer, single-precision floating point, double-precision floating point, etc.).
  • the meta-information of each variable including network Grid, parallel partitioning, data types, etc.
  • the module supports continuous or discrete memory space with a variable in the same process.
  • Image area exchange operation management module supports users to construct variable exchange operations between processes composed of several variables (such as air temperature, wind speed, air pressure, humidity, etc. in atmospheric mode; sea temperature, flow rate, salinity, etc. in ocean mode), and run during mode operation Variable exchange operations between processes to complete the exchange of the values of several variables between processes for the image area.
  • variables such as air temperature, wind speed, air pressure, humidity, etc. in atmospheric mode; sea temperature, flow rate, salinity, etc. in ocean mode
  • This module automatically establishes the communication mapping relationship between processes according to the parallel division of variables on a given horizontal two-dimensional sub-grid and the setting of the image area; for a pair of processes with a communication mapping relationship, the data communication between them is automatically realized , And different process pairs can communicate at the same time, that is, parallel communication; support asynchronous communication mode, support users to conveniently select synchronous or asynchronous communication mode; before and after calling parallel communication, automatically complete multiple exchange operations in the same image area Packing/unpacking of variable-related data (that is, the data value is automatically placed in the corresponding position of the variable image area).
  • the communication mapping relationship refers to: a process needs to transfer the variable values corresponding to the part of the horizontal grid points it is responsible for calculation to the image area of another process variable.
  • Table 5 shows the values of the model variables of the parallel subdivision region after one calculation in the first process.
  • the first process only calculates the values on the grid points in its calculation area, and does not calculate the values on the remaining grid points (marked as "-" in the figure).
  • Table 6 shows the values of the model variables of the parallel subdivision region after one calculation in the second process.
  • the second process only calculates the values on the grid points in its calculation area, and does not calculate the values on the remaining grid points (marked as "-" in the figure).
  • Table 7 shows the value of the model variables in the first process after the first process and the second process exchange model variables.
  • the value in the calculation area of the first process remains unchanged, and the values of some grid points in the image area are obtained from the second process.
  • API Application programming interface
  • This module includes the API for registering the horizontal and two-dimensional sub-grid of the mode, the API for registering the vertical grid, the API for building multi-dimensional grids, the API for registering parallel splitting, the API for registering image areas, the API for registering variables, and the creation and running of images. API for zone exchange operations, etc.
  • Use API to register each mode grid such as horizontal two-dimensional sub-grid, vertical grid, three-dimensional grid, four-dimensional grid, etc.
  • each mode grid such as horizontal two-dimensional sub-grid, vertical grid, three-dimensional grid, four-dimensional grid, etc.
  • you need to provide necessary information such as the range of the grid, the number of grid points, the coordinate value of the center of each grid point, the unit of the coordinate value, and the mark whether each grid point is valid.
  • the API When registering a one-dimensional sub-grid, you need to provide necessary information such as the number of grid points of the one-dimensional sub-grid, the coordinate value of the center of each grid point, and the unit of the coordinate value; after the registration is successfully completed, the API will return the one-dimensional sub-grid The unique identifier.
  • Use API to create exchange operations for each image area When creating an image area exchange operation, it is necessary to provide the identification of a group of variables and the identification of the image area corresponding to each variable.
  • the image area exchange operation management module will be used first, and then the automatic communication mapping relationship and parallel communication management module will be used to automatically establish the communication mapping relationship between processes according to parallel division and image area settings. After successful creation, return to the image area exchange operation logo.
  • the image area exchange operation management module will be used first, and then the automatic communication mapping relationship and parallel communication management module will target each variable in the image area exchange operation according to its grid (including dimensional order), parallel division and image area settings , Automatically complete the packaging/unpacking of communication data, and automatically complete the synchronous/asynchronous parallel communication of all variables.
  • This embodiment provides a parallel communication device oriented to a numerical model.
  • the numerical model divides a multi-dimensional space into a number of sub-grids, including a horizontal two-dimensional sub-grid composed of a number of grid points.
  • a plurality of parallel split regions are formed on the grid, and the data of each parallel split region is stored in a process.
  • the parallel split region corresponding to the process includes a calculation area and an image area.
  • the calculation area includes The data of the grid points of is calculated by the process, and the data of the grid points contained in the image area is calculated by other processes, and the device includes:
  • the grid point number assignment module is used to assign a grid point number to each grid point on the horizontal two-dimensional sub-grid, so that each grid point has a relative to the horizontal two-dimensional sub-grid.
  • the unique grid point number of the grid is used to assign a grid point number to each grid point on the horizontal two-dimensional sub-grid, so that each grid point has a relative to the horizontal two-dimensional sub-grid.
  • the process management module is used to make the first process and the other processes respectively record the grid point numbers of the grid points contained in the calculation area in the parallel division area and the grid points contained in the image area.
  • Grid number
  • the grid point matching module is based on the grid point numbers of the first grid points contained in the image area recorded by the first process, and according to the grid point numbers of the grid points contained in the respective calculation areas recorded by the other processes.
  • Grid point number if the first grid point number is the same as the grid point number of the second grid point contained in the calculation area corresponding to the second process in the other processes, determine the grid point number corresponding to the first process
  • the data of the first grid point included in the image area comes from the second grid point recorded with the same grid point number and included in the calculation area corresponding to the second process in the other processes;
  • a communication mapping establishment module to establish a mapping relationship between the first grid points included in the image area corresponding to the first process and the second grid points included in the calculation area corresponding to the second process , To transfer the data of the second grid point to the first grid point to realize the data transmission between processes oriented to the numerical model.
  • the numerical model-oriented parallel communication device may further include a memory and a processor.
  • the memory stores the various modules mentioned above.
  • the processor calls and executes the functions of each module to realize the data between processes of the numerical model. transmission.
  • the embodiment of the present invention provides a numerical model-oriented parallel communication system, including a processor and a memory, and the memory stores a computer program.
  • the computer program is executed by the processor, any of the first to third embodiments is implemented.
  • an embodiment of the present invention also provides a storage medium storing a computer-readable program, and the computer-readable program, when executed by a processor, implements any one of the methods in the first to third embodiments.
  • the numerical model-oriented parallel communication method and device of the present invention enables model developers to conveniently complete the development of parallel versions of numerical models, and on the other hand, the same parallel version can support more types of horizontal two-dimensional sub-grids, Parallel partitioning and numerical methods, that is, when updating the mesh or parallel partitioning of the model, or adjusting the dependency between the grid points due to the updated numerical method, there is no need to develop a new parallel version.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

一种面向数值模型的并行通信方法、装置、系统和存储介质,方法包括:将网格点编号分配给水平二维子网格上的每个网格点(S1);使第一进程和其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的网格点编号和影像区所包含的网格点的网格点编号(S2);根据第一进程所记录的影像区所包含的第一网格点的网格点编号,并根据其他进程所记录的各自计算区所包含的网格点的网格点编号,确定第一进程对应的影像区所包含的第一网格点的数据来自第二进程对应的计算区所包含的记录有相同网格点编号的第二网格点(S3);建立第一进程的影像区所包含的第一网格点与第二进程的计算区所包含的第二网格点之间的映射关系,以将第二网格点的数据传递到第一网格点(S4)。

Description

一种面向数值模型的并行通信方法、装置、系统和存储介质
本申请要求享有2019年10月24日提交的名称为“一种面向数值模型的并行通信方法、装置、系统和存储介质”的中国专利申请CN201911019068.3的优先权,其全部内容通过引用并入本文中。
技术领域
本发明涉及面向数值模型的并行通信技术,尤其涉及一种面向数值模型的并行通信方法、装置、系统和存储介质。
背景技术
地球系统模型是气候演变规律研究、未来气候预测和无缝隙数值预报所不可或缺的科学工具,由分别模拟大气、陆面、海洋和海冰等地球系统圈层的分量模型通过耦合器的耦合构成。地球系统模型的所有分量模型均是基于格网的数值模型(Numerical Model),即将要模拟的区域(水平二维或空间三维)划分为若干互不重叠的格点,也称原子区域,并在所有格点上进行协同计算。对一个区域而言,划分出来的格点越多,则模拟的分辨率越高,模拟过程的计算量也就越大。
目前,计算节点和处理器核越来越多的高性能计算机给很多应用程序的加速运行带来了机会,这也包括上述格网数值模型。为了在高性能计算机上取得较好的加速效果,应用程序需要被编写为高效的并行版本。消息传递接口(Message Passing Interface,MPI)是一种被广泛使用的并行编程库,既可以在不同计算节点之间,也可以在同一节点内的不同处理器核之间实现并行计算。无论国内外,绝大多数分量模型都具备了基于MPI的并行版本。
在研制数值模型的并行版本时,研发人员首先需要把模型网格的所有网格点分派给不同进程,以便进行并行计算。例如,图1中方形网格区域被划分为4个互不重叠的子区域(计算区),而每个子区域又被划分为若干个网格点(图未示),每个子区域中的所有网格点由一个进程负责计算。数值模型的方法会引入网格点之间的依赖关系,即在计算一个网格点上的数据时,需要使用其他网格点上的数据;这意味着在多个进程进行并行计算的过程中,一个进程会使用其他进程所负责计算的网格点上的数据。因此,一个进程不仅需 要存放其所负责计算的网格点的数据,还需要存放其所需的由其他进程负责计算的网格点的数据。对于一个进程来说,由其负责计算的若干网格点所组成的区域被称为计算区,而其需要使用但不需计算的若干网格点组成的区域被称为影像区,即其他进程计算结果的影子;由计算区和影像区共同组成的区域被称为并行剖分区域。例如,参照图1,图2中四边为实线的子区域为各进程的计算区,实线与虚线间的阴影为影像区,有两边为虚线的矩形子区域为并行剖分区域。可以看出,影像区通常位于计算区的外围。
上述情况中,一个进程影像区中的网格点的数据由其他进程计算。当该进程需要使用影像区中的数据时,需要在该进程与其他各进程间完成针对影像区的数据交换,即基于通信方式把其他进程计算出来的部分数据传递到该进程的影像区中,这就需要根据并行剖分和网格点间的依赖关系建立进程间的通信关系,例如确定一个MPI进程与哪些MPI进程进行数据交换,并在交换数据过程中,完成数据的打包、通信、拆包等。为了简化程序实现,往往需要研发与应用针对特定网格点和特定并行剖分的并行通信库。
对于数值模型并行版本的研制而言,研发人员面临着一系列挑战。一方面,并行剖分越复杂,研发人员需投入更多时间来设计研发用于建立通信关系的程序;另一方面,当数值模型所使用的网格、并行剖分或数值方法发生改变时,往往需要重新研制并行通信库,甚至研发数值模型新的并行版本。现有技术中,最常用的水平二维子网格就是经纬网格,但随着数值模型的快速发展,出现了很多新型水平二维子网格,例如高斯归约网格、三极网格、球面立方网格、正二十面体网格、阴阳网格、局部加密的网格等,而这些新型网格对应的并行剖分、数值方法等也更加复杂。
因此,在数值模型快速发展的背景下,本领域的技术人员需要在克服越来越多困难的基础上,不断研发数值模型的并行版本。
发明内容
为了解决上述问题,本发明提供一种面向数值模型的并行通信方法、装置、系统和存储介质。
第一方面,本发明提供了一种面向数值模型的并行通信方法,所述数值模型将多维空间划分为若干子网格,其中包括由若干网格点构成的水平二维子网格,所述水平二维子网格上形成有多个并行剖分区域,每个所述并行剖分区域的数据存储在一个进程中,所述进程对应的并行剖分区域包括计算区和影像区,所述计算区所包含的网格点的数据由所述进程负责计算,所述影像区所包含的网格点的数据由其他进程负责计算,所述方法包括如下 步骤:
S1、将网格点编号分配给所述水平二维子网格上的每个网格点,以使每个所述网格点拥有相对于所述水平二维子网格唯一的网格点编号;
S2、使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的网格点编号和影像区所包含的网格点的网格点编号;
S3、根据所述第一进程所记录的影像区所包含的第一网格点的网格点编号,并根据所述其他进程所记录的各自计算区所包含的网格点的网格点编号,若所述第一网格点编号和所述其他进程中第二进程对应的计算区所包含的第二网格点的网格点编号相同,确定所述第一进程对应的影像区所包含的第一网格点的数据来自所述其他进程中第二进程对应的计算区所包含的记录有相同网格点编号的第二网格点;
S4、建立所述第一进程对应的影像区所包含的所述第一网格点与所述第二进程对应的计算区所包含的所述第二网格点之间的映射关系,以将所述第二网格点的数据传递到所述第一网格点,实现面向数值模型的进程间的数据传输。
进一步,所述方法还包含:
S5、根据所述第一进程所记录的影像区所包含的第三网格点的网格点编号,并根据所述其他进程所记录的各自计算区所包含的网格点的网格点编号,若所述第三网格点编号和所述其他进程中第三进程对应的计算区所包含的第四网格点的网格点编号相同,确定所述第一进程对应的影像区所包含的第三网格点的数据来自所述其他进程中第三进程对应的计算区所包含的记录有相同网格点编号的第四网格点;
S6、建立所述第一进程对应的影像区所包含的所述第三网格点与所述第三进程对应的计算区所包含的所述第四网格点之间的映射关系,以将所述第四网格点的数据传递到所述第二网格点。
优选的,所述步骤S1和S2还包括:
S1-1、将并行剖分编号分配给所述并行剖分区域中的每个网格点,以使所述水平二维子网格上的每个所述并行剖分区域中的网格点拥有唯一的并行剖分编号;
S2-1、使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的并行剖分编号和影像区所包含的网格点的并行剖分编号;
其中,所述并行剖分编号表示所述并行剖分区域中所包含的网格点的数据在所述并行剖分区域对应的进程中的存储位置编号。
优选的,所述步骤S3还包括:
S3-1、所述第一网格点对应的并行剖分编号为第一并行剖分编号,所述第二网格点对应的并行剖分编号为第二并行剖分编号,以明确所述第一网格点和所述第二网格点的数据分别在所述第一进程和所述第二进程中的存储位置。
优选的,所述网格点的数据至少包括下列各项中的一项:大气模式的气度,风速,气压和湿度;海洋模式的海温、流速和盐度。
优选的,所述步骤S1之前还包括:
注册所述水平二维子网格,并获得所述水平二维子网格的唯一网格标识。
优选的,所述注册所述水平二维子网格包括:
记录所述水平二维子网格的范围,所述网格点的数量,各所述网格点的中心坐标值,各所述网格点所有顶点的坐标值,坐标值的单位和各所述网格点的面积。
第二方面,本发明提供了一种面向数值模型的并行通信装置,所述数值模型将多维空间划分为若干子网格,其中包括由若干网格点构成的水平二维子网格,所述水平二维子网格上形成有多个并行剖分区域,每个所述并行剖分区域的数据存储在一个进程中,所述进程对应的并行剖分区域包括计算区和影像区,所述计算区所包含的网格点的数据由所述进程负责计算,所述影像区所包含的网格点的数据由其他进程负责计算,所述装置包括:
网格点编号分配模块,用于将网格点编号分配给所述水平二维子网格上的每个网格点,以使每个所述网格点拥有相对于所述水平二维子网格唯一的网格点编号;
进程管理模块,用于使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的网格点编号和影像区所包含的网格点的网格点编号;
网格点匹配模块,根据所述第一进程所记录的影像区所包含的第一网格点的网格点编号,并根据所述其他进程所记录的各自计算区所包含的网格点的网格点编号,若所述第一网格点编号和所述其他进程中第二进程对应的计算区所包含的第二网格点的网格点编号相同,确定所述第一进程对应的影像区所包含的第一网格点的数据来自所述其他进程中第二进程对应的计算区所包含的记录有相同网格点编号的第二网格点;
通信映射建立模块,建立所述第一进程对应的影像区所包含的所述第一网格点与所述第二进程对应的计算区所包含的所述第二网格点之间的映射关系,以将所述第二网格点的数据传递到所述第一网格点,实现面向数值模型的进程间的数据传输。
第三方面,本发明提供了一种面向数值模型的并行通信系统,包括处理器和存储器, 所述存储器存储有计算机程序,所述计算机程序被所述处理器执行时,实现上述任一种方法。
第四方面,本发明提供了一种存储介质,存储有计算机可读程序,所述计算机可读程序在被处理器执行时,实现上述任一种方法。
与现有技术相比,本发明具有如下优点或有益效果:
本发明的面向数值模型的并行通信方法和装置,一方面使得模型研发人员可以便捷完成数值模型并行版本的研发,另一方面也可以使同一并行版本支持更多类型的水平二维子网格、并行剖分和数值方法,即使得在更新模型的网格或并行剖分、或因更新数值方法而需要调整网格点间依赖关系时,无需研发新的并行版本。
1)通用性:支持任意类型水平二维子网格,支持多维网格,支持水平二维子网格上的任意并行剖分,支持任意影像区设置,支持不同维度变量及任意维度顺序。
2)便捷易用性:将根据并行剖分和网格点间依赖关系自动建立进程间的通信关系,在进程间需要交换数据时,自动完成数据的打包、通信、拆包,即影像区数据填充等。
3)高效性:支持把多个变量聚合起来一次性完成数据交换,以提高通信的效率;支持异步通信模型,即通信过程可与计算过程重叠,以降低通信开销的影响,并支持异步通信模型与同步通信模型的便捷切换。
附图说明
通过结合附图阅读下文示例性实施例的详细描述可更好地理解本公开的范围,其中所包括的附图是:
图1为相关技术中数值模型的网格划分示意图;
图2为相关技术中数值模型的网格的并行剖分示意图;
图3为根据本发明实施例一的面向数值模型的并行通信方法的流程图。
具体实施方式
为使本发明的目的、技术方案和优点更加清楚,下面结合附图以及实施例来详细说明本发明的实施方案,借此对本发明如何应用技术手段来解决技术问题,并达成技术效果的实现过程能充分理解并据以实施。
实施例一
图3是本发明实施例一的面向数值模型的并行通信方法的流程图,以下结合图3对本发明实施例一的每个步骤进行详细说明。
如图3所示,本发明提供一种面向数值模型的并行通信方法,所述数值模型将多维空间划分为若干子网格,其中包括由若干网格点构成的水平二维子网格,所述水平二维子网格上形成有多个并行剖分区域,每个所述并行剖分区域的数据存储在一个进程中,所述进程对应的并行剖分区域包括计算区和影像区,所述计算区所包含的网格点的数据由所述进程负责计算,所述影像区所包含的网格点的数据由其他进程负责计算,所述方法包括如下步骤:
S1、将网格点编号分配给水平二维子网格上的每个网格点,以使每个网格点拥有相对于水平二维子网格唯一的网格点编号。
如表1所示,本实施例中,水平二维子网格上的每个网格点示意性的分配了唯一的网格点编号。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55 56 56 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
表1 具有网格点编号的网格点构成的水平二维子网格
表2显示了以表1的水平二维子网格为基础,进行并行剖分的示意表。其中,为了清楚,仅显示了部分并行剖分区域。
Figure PCTCN2019122767-appb-000001
表2 水平二维子网格的并行剖分
如表2所示,显示了该水平二维子网格包含的三个并行剖分区域,其中包括第一并行剖分区域,范围大小为5行10列,网格点编号为【4-13】【19-28】【34-43】【49-58】【64-73】;第二并行剖分区域,范围大小为6行7列,网格点编号为【1-7】【16-22】【31-37】【46-52】【61-67】【76-82】;第三并行剖分区域,范围大小为6行5列,网格点编号为 【41-45】【56-60】【71-75】【86-90】【101-105】【116-120】。
在本实施例中,第一并行剖分区域可由第一进程负责,其中中间黑体字的网格点编号的区域为第一进程负责计算和存储的计算区,例如网格点编号【6-11】或【51-56】。而只由第一进程负责存储的区域为该第一进程负责的影像区,例如网格点编号【4-5】【12-13】或【64-73】。第二并行剖分区域可由第二进程负责,其中左边斜体黑字的网格点编号的区域为第二进程负责计算和存储的计算区,例如网格点编号【1-5】或【61-65】。而只由第二进程负责存储的非斜体字区域为该第二进程负责的影像区,例如网格点编号【6-7】【66-67】…【76-82】。第三并行剖分区域可由第三进程负责,其中右边斜体黑字的网格点编号的区域为第三进程负责计算和存储的计算区,例如网格点编号【57-60】或【117-120】。而只由第二进程负责存储的区域为该第二进程负责的影像区,例如网格点编号【41-45】【56】或【116】。
S2、使第一进程和其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的网格点编号和影像区所包含的网格点的网格点编号。
在本实施例中,使第一进程记录第一并行剖分区域中的计算区所包含的网格点的网格点编号,即步骤S1中所提到的中间黑体字的网格点的网格点编号,即【6-11】【21-26】【36-41】【51-56】;并使第一进程记录第一并行剖分区域中的影像区所包含的网格点的网格点编号,即【4-5,12-13】【19-20,27-28】【34-35,42-43】【49-50,57-58】【64-73】。使第二进程记录第二并行剖分区域中的计算区所包含的网格点的网格点编号,即步骤S1中所提到的左边斜体黑字的网格点的网格点编号,即【1-5】【16-20】【31-35】【46-50】【61-65】;并使第二进程记录第二并行剖分区域中的影像区所包含的网格点的网格点编号,即【6-7】【21-22】【36-37】【51-52】【66-67】【76-82】。使第三进程记录第三并行剖分区域中的计算区所包含的网格点的网格点编号,即步骤S1中所提到的右边边斜体黑字的网格点的网格点编号,即【57-60】【72-75】【87-90】【102-105】【117-120】;并使第三进程记录第三并行剖分区域中的影像区所包含的网格点的网格点编号,即【41-45】【56,71,86,101,116】。
S3、根据第一进程所记录的影像区所包含的第一网格点的网格点编号,并根据其他进程所记录的各自计算区所包含的网格点的网格点编号,若第一网格点编号和其他进程中第二进程对应的计算区所包含的第二网格点的网格点编号相同,确定第一进程对应的影像区所包含的第一网格点的数据来自其他进程中第二进程对应的计算区所包含的记录有相同网格点编号的第二网格点。
在本实施例中,第一网格点可为第一进程所记录的影像区所包含的部分网格点中的任意一个,例如,可为网格点【5】。然后,根据第二进程和第三进程所记录的各自的计算区所包含的网格点的网格点编号,确定第一进程的影像区的网格点编号为【5】的第一网格点的数据来自第二进程对应的计算区所包含的网格点编号记录为【5】的第二网格点。
S4、建立第一进程对应的影像区所包含的第一网格点与第二进程对应的计算区所包含的第二网格点之间的映射关系,以将第二网格点的数据传递到第一网格点,实现面向数值模型的进程间的数据传输。
在本实施例中,建立第一进程对应的影像区所包含的第一网格点【5】与第二进程对应的计算区所包含的第二网格点【5】之间的映射关系,以将第二网格点【5】的数据传递到第一网格点【5】,实现面向数值模型的进程间的数据传输。
S5、根据第一进程所记录的影像区所包含的第三网格点的网格点编号,并根据其他进程所记录的各自计算区所包含的网格点的网格点编号,若第三网格点编号和其他进程中第三进程对应的计算区所包含的第四网格点的网格点编号相同,确定第一进程对应的影像区所包含的第三网格点的数据来自其他进程中第三进程对应的计算区所包含的记录有相同网格点编号的第四网格点。
在本实施例中,第三网格点可为第一进程所记录的影像区所包含的部分网格点中的任意一个,例如,可为网格点【57】。然后,根据第二进程和第三进程所记录的各自的计算区所包含的网格点的网格点编号,确定第一进程的影像区的网格点编号为【57】的第三网格点的数据来自第三进程对应的计算区所包含的网格点编号记录为【57】的第四网格点。
S6、建立第一进程对应的影像区所包含的第三网格点与第三进程对应的计算区所包含的第四网格点之间的映射关系,以将第四网格点的数据传递到第二网格点。
在本实施例中,建立第一进程对应的影像区所包含的第三网格点【57】与第三进程对应的计算区所包含的第四网格点【57】之间的映射关系,以将第四网格点【57】的数据传递到第三网格点【57】,实现面向数值模型的进程间的数据传输。
以此类推,可实现同一水平二维子网格中平行剖分区域间的数据传输,即进程间的数据传输,而且不限于并行剖分的方法,数值计算方法或水平二维子网格的类型,例如一维子网格或多维网格。
本实施例中的各步骤并不限制各步骤的执行顺序,不排除某些步骤可同时执行或无序执行。
在本实施例中,网格点的数据可为大气模式的气度,风速,气压和湿度或海洋模式的海温、流速和盐度中的一种或多种。
实施例二
在本实施例中,在实施例一的基础上引入了并行剖分编号的概念,即为并行剖分区域中的每个网格点分配唯一的并行剖分编号。并行剖分编号表示并行剖分区域中所包含的网格点的数据在该并行剖分区域对应的进程中的存储位置编号,以便于数据的在进程中的存储和提取。
本实施例的面向数值模型的并行通信方法,步骤S1、S2和S3分别还包括:
S1-1、将并行剖分编号分配给所述并行剖分区域中的每个网格点,以使所述水平二维子网格上的每个所述并行剖分区域中的网格点拥有唯一的并行剖分编号。
以第一进程负责的第一并行剖分区域为例,如表3所示,每个网格点以(m,n)的形式表示,其中m表示该网格点的并行剖分编号,n表示该网格点的网格点编号。(m,-)表示该网格点为第一进程负责的影像区。这样的设置为可将数据更为灵活的存储在影像区。
(1,-) (2,-) (3,6) (4,7) (5,8) (6,9) (7,10) (8,11) (9,-) (10,-)
(11,-) (12,-) (13,21) (14,22) (15,23) (16,24) (17,25) (18,26) (19,-) (20,-)
(21,-) (22,-) (23,36) (24,37) (25,38) (26,39) (27,40) (28,41) (29,-) (30,-)
(31,-) (32,-) (33,51) (34,52) (35,53) (36,54) (37,55) (38,56) (39,-) (40,-)
(41,-) (42,-) (43,-) (44,-) (45,-) (46,-) (47,-) (48,-) (49,-) (50,-)
表3 具有并行剖分编号和网格点编号的网格点构成的第一并行剖分区域
例如,参考表4,可将上文提到的网格点编号为【5】的第二进程的计算区的网格点的数据存储在表1中第一进程的影像区中的任意网格点(m,-),其中,只要指定第一进程中的网格点的并行剖分编号,例如可为(1,-)。如此,对于第一进程来说,数据存储位置有了更多的选择,也便于查找和提取。
(1,1) (2,2) (3,3) (4,4) (5,5) (6,-) (7,-)
(8,16) (9,17) (10,18) (11,19) (12,20) (13,-) (14,-)
(15,31) (16,32) (17,33) (18,34) (19,35) (20,-) (21,-)
(22,46) (23,47) (24,48) (25,49) (26,50) (27,-) (28,-)
(29,61) (30,62) (31,63) (32,64) (33,65) (34,-) (35,-)
(36,-) (37,-) (38,-) (39,-) (40,-) (41,-) (42,-)
表4 具有并行剖分编号和网格点编号的网格点构成的第二并行剖分区域
S2-1、使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的并行剖分编号和影像区所包含的网格点的并行剖分编号。
需要注意的是,每个进程所对应的并行剖分区域中的网格点的并行剖分编号是独立进行编号的,相互之间没有影响。
S3-1、所述第一网格点对应的并行剖分编号为第一并行剖分编号,所述第二网格点对应的并行剖分编号为第二并行剖分编号,以明确所述第一网格点和所述第二网格点的数据分别在所述第一进程和所述第二进程中的存储位置。
在本实施例中,网格点编号为【5】的第一进程的第一网格点的并行剖分编号为【2】,第一网格点表示为(2,5),表示数据存储在了第一进程中并行剖分编号为【2】存储位置。网格点编号为【5】的第二进程的第二网格点的并行剖分编号为【5】,第二网格点表示为(5,5),表示数据存储在了第二进程中并行剖分编号为【5】存储位置。
在本实施例中,首先进程间根据相同的网格点编号建立网格点之间的映射关系,而后根据并行剖分编号确定数据交换后在一进程中的存储位置,在本实施例中,该进程为第一进程。
实施例三
本发明还提供了一种面向数值模型的并行通信库,所述数值模型将多维空间划分为若干子网格,其中包括由若干网格点构成的水平二维子网格,所述水平二维子网格上形成有多个并行剖分区域,每个所述并行剖分区域的数据存储在一个进程中,所述进程对应的并行剖分区域包括计算区和影像区,所述计算区所包含的网格点的数据由所述进程负责计算,所述影像区所包含的网格点的数据由其他进程负责计算,所述面向数值模型的并行通信库包括以下模块:
1)通用网格管理模块。该模块采用通用方式来统一管理不同类型的水平二维子网格,记录水平二维子网格的范围、格点数、各网格点中心的坐标值、各网格点所有顶点的坐标值、坐标值的单位、各网格点是否有效的标记、各网格点的面积等;统一管理多种类型的一维子网格,记录一维子网格的格点数、各格点中心的坐标值、坐标值的单位等;统一管理包括水平二维子网格在内的多维网格,支持用户构建由一个水平二维子网格和若干一维子网格联合构成三维或四维网格,记录多维网格与其子网格间的相互关系等。在用户构建多维网格时,支持对维度顺序的灵活设置,例如:对于三维网格,用户可以把维度顺序设置为“水平+垂直”(水平方向在低维、垂直方向在高维)或者“垂直+水平”。
2)通用并行剖分管理模块。该模块采用通用方式来统一管理任意水平二维子网格上的任意并行剖分。在各个进程中,其记录并行剖分中各网格点在对应水平二维子网格中的网格点编号和并行剖分编号。
3)通用影像区管理模块。该模块采用通用方式来统一管理水平二维子网格与任意并行剖分上的任意影像区设置,一个并行剖分可包含影像区,而影像区中所有网格点的网格 点编号可被标记为同一个特殊值“-”。
4)通用变量管理模块。该模块采用统一方式来管理对应于任意网格、任意并行剖分和任意数据类型(如整数、单精度浮点、双精度浮点等)的变量,其中将管理各变量的元信息(包含网格、并行剖分、数据类型等)和内存空间。该模块支持一个变量在同一进程内的连续或离散内存空间。
5)影像区交换操作管理模块。该模块支持用户构建由若干变量(如大气模式的气度、风速、气压、湿度等;海洋模式的海温、流速、盐度等)组成的进程间的变量交换操作、并在模式运行过程中运行进程间的变量交换操作,以完成进程间若干变量的值针对影像区的交换。
6)自动通信映射关系与并行通信管理模块。该模块根据变量在给定水平二维子网格上的并行剖分和影像区设置,自动建立进程间的通信映射关系;针对有通信映射关系的一对进程,自动实现它们之间的数据通信,且不同进程对之间可同时进行通信、即并行通信;支持异步通信模式,支持用户对同步或异步通信模式的便捷选定;在调用并行通信前后,自动完成同一影像区交换操作中多个变量相关数据的打包/拆包(即自动将数据值放到变量影像区的相应位置)。通信映射关系指的是:一个进程需要将其负责计算的部分水平格点对应的变量值传递到另一进程变量的影像区中。
在本实施例中,进程间的数据交换参考表5,表6和表7。表5为第一进程经过一次计算后的并行剖分区域的模型变量的值的情况。
- - V6 V7 V8 V9 V10 V11 - -
- - V21 V22 V23 V24 V25 V26 - -
- - V36 V37 V38 V39 V40 V41 - -
- - V51 V52 V53 V54 V55 V56 - -
- - - - - - - - - -
表5第一进程经过一次计算后的并行剖分区域的模型变量的值的情况
其中,第一进程仅计算其计算区中网格点上的值,而不计算其余格点上的值(图中标记为“-”)。表6为第二进程经过一次计算后的并行剖分区域的模型变量的值的情况。
V1 V2 V3 V4 V5 - -
V16 V17 V18 V19 V20 - -
V31 V32 V33 V34 V35 - -
V46 V47 V48 V49 V50 - -
V61 V62 V63 V64 V65 - -
- - - - - - -
表6 第二进程经过一次计算后的并行剖分区域的模型变量的值的情况
其中,第二进程仅计算其计算区中网格点上的值,而不计算其余格点上的值(图中标记为“-”)。表7为第一进程与第二进程进行模型变量交换后,第一进程中模型变量值 的情况。
V4 V5 V6 V7 V8 V9 V10 V11 - -
V19 V20 V21 V22 V23 V24 V25 V26 - -
V34 V35 V36 V37 V38 V39 V40 V41 - -
V49 V50 V51 V52 V53 V54 V55 V56 - -
V64 V65 - - - - - - - -
表7第一进程与第二进程进行模型变量交换后,第一进程中模型变量值的情况。
其中,第一进程的计算区中的值保持不变,影像区中部分网格点的值从第二进程获取到。
7)应用程序接口(API)模块。该模块包括注册模式水平二维子网格的API,注册垂直网格的API,构建多维网格的API,注册并行剖分的API,注册影像区的API,注册变量的API,创建与运行影像区交换操作的API等。
在研制一个数值模式的并行版本时,研发人员首先需要根据模式网格和数值方法的特点,设计并行剖分方法,确定各进程并行剖分中的计算区和影像区;然后可采用向面向数值模型的并行通信库来便捷实现进程间针对影像区的数据交换。自动并行通信库以模式的网格、并行剖分(包括计算区和影像区)、要进行数据交换的变量(如大气模式的气度、风速、气压、湿度等;海洋模式的海温、流速、盐度等;也可以是研发人员指定的任意变量)等为输入,需要模式的所有进程同步进行以下操作:
使用API向向面向数值模型的并行通信库注册各模式网格,如水平二维子网格、垂直网格、三维网格、四维网格等。在注册水平二维子网格时,需要提供网格的范围、格点数、各网格点中心的坐标值、坐标值的单位、各网格点是否有效的标记等必要信息,还可以提供各网格点所有顶点的坐标值、各网格点的面积等信息;在成功完成注册后,API将返回水平二维子网格的唯一标识。在注册一维子网格时,需要提供一维子网格的格点数、各格点中心的坐标值、坐标值的单位等必要信息;在成功完成注册后,API将返回一维子网格的唯一标识。在注册三维或四维网格时,需要提供构建其所使用的一个水平二维子网格和若干一维子网格的标识;在成功完成注册后,API将返回多维网格的唯一标识。这一步使用到通用网格管理模块。
使用API向向面向数值模型的并行通信库注册各并行剖分,其位于水平二维子网格上。在注册一个并行剖分时,需要提供对应水平二维子网格的标识、并行剖分所包含格点的数量、各格点的网格点编号和并行剖分编号等信息;在成功完成注册后,API将返回并行剖分的唯一标识。这一步将使用到通用并行剖分管理模块。
使用API向面向数值模型的并行通信库注册各影像区。在注册一个影像区时,需要提供相应并行剖分的标识、影像区中格点的数量、影像区中所有网格点的网格点编号可被 标记为同一个特殊值“-”;在成功完成注册后,API将返回影像区的唯一标识。这里将使用到通用影像区管理模块。
使用API向面向数值模型的并行通信库注册各变量。在注册一个变量时,需要提供变量名、网格标识、并行剖分标识、数据类型和内存空间等信息;在成功完成注册后,API将返回变量的唯一标识。这里将使用到通用变量管理模块。
使用API创建各影像区交换操作。在创建一个影像区交换操作时,需要提供一组变量的标识,以及对应于各变量的影像区的标识。这里将先使用到影像区交换操作管理模块,然后使用到自动通信映射关系与并行通信管理模块,以根据并行剖分和影像区设置等自动建立进程间的通信映射关系。在成功创建后,返回影像区交换操作的标识。
使用API来运行影像区交换操作,仅需提供影像区交换操作的标识。这里将先使用到影像区交换操作管理模块,然后自动通信映射关系与并行通信管理模块将针对影像区交换操作中的各变量,根据其网格(包括维度顺序)、并行剖分和影像区设置,自动完成通信数据的打包/拆包,并自动完成所有变量的同步/异步并行通信。
对于面向数值模型的并行通信库来研制的数值模式并行版本,当模式研发人员在更新模式网格或并行剖分、或因更新数值方法而需要调整格点间依赖关系时,无需重新开发与通信库相关的模式程序。这将使得并行版本更具有通用性,也将降低在模式发展过程中维护并行版本的工作量。
实施例四
本实施例提供一种面向数值模型的并行通信装置,所述数值模型将多维空间划分为若干子网格,其中包括由若干网格点构成的水平二维子网格,所述水平二维子网格上形成有多个并行剖分区域,每个所述并行剖分区域的数据存储在一个进程中,所述进程对应的并行剖分区域包括计算区和影像区,所述计算区所包含的网格点的数据由所述进程负责计算,所述影像区所包含的网格点的数据由其他进程负责计算,所述装置包括:
网格点编号分配模块,用于将网格点编号分配给所述水平二维子网格上的每个网格点,以使每个所述网格点拥有相对于所述水平二维子网格唯一的网格点编号;
进程管理模块,用于使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的网格点编号和影像区所包含的网格点的网格点编号;
网格点匹配模块,根据所述第一进程所记录的影像区所包含的第一网格点的网格点编 号,并根据所述其他进程所记录的各自计算区所包含的网格点的网格点编号,若所述第一网格点编号和所述其他进程中第二进程对应的计算区所包含的第二网格点的网格点编号相同,确定所述第一进程对应的影像区所包含的第一网格点的数据来自所述其他进程中第二进程对应的计算区所包含的记录有相同网格点编号的第二网格点;
通信映射建立模块,建立所述第一进程对应的影像区所包含的所述第一网格点与所述第二进程对应的计算区所包含的所述第二网格点之间的映射关系,以将所述第二网格点的数据传递到所述第一网格点,实现面向数值模型的进程间的数据传输。
在本实施例中,该面向数值模型的并行通信装置还可包括存储器和处理器,存储器存储有上述各种模块,处理器调用并执行各模块的功能,以实现面向数值模型的进程间的数据传输。
实施例五
本发明的实施例提供了一种面向数值模型的并行通信系统,包括处理器和存储器,存储器存储有计算机程序,所述计算机程序被所述处理器执行时,实现实施例一至实施例三的任一种方法,以实现面向数值模型的进程间的数据传输。
此外,本发明的实施例还提供了一种存储介质,存储有计算机可读程序,所述计算机可读程序在被处理器执行时,实现实施例一至实施例三任一种方法。
本发明的面向数值模型的并行通信方法和装置,一方面使得模型研发人员可以便捷完成数值模型并行版本的研发,另一方面也可以使同一并行版本支持更多类型的水平二维子网格、并行剖分和数值方法,即使得在更新模型的网格或并行剖分、或因更新数值方法而需要调整网格点间依赖关系时,无需研发新的并行版本。
尽管为使解释简单化将上述方法图示并描述为一系列动作,但是应理解并领会,这些方法不受动作的次序所限,因为根据一个或多个实施例,一些动作可按不同次序发生和/或与来自本文中图示和描述或本文中未图示和描述,但本领域技术人员可以理解的其他动作并发地发生。
以上实施例仅是本发明的具体实施例。显然,本发明不限于以上实施例,还可以存在许多变形。凡是本领域的普通技术人员能以本发明公开的内容直接导出或是联想到的所有变形均应被认为是本发明的保护范围。

Claims (10)

  1. 一种面向数值模型的并行通信方法,所述数值模型将多维空间划分为若干子网格,其中包括由若干网格点构成的水平二维子网格,所述水平二维子网格上形成有多个并行剖分区域,每个所述并行剖分区域的数据存储在一个进程中,所述进程对应的并行剖分区域包括计算区和影像区,所述计算区所包含的网格点的数据由所述进程负责计算,所述影像区所包含的网格点的数据由其他进程负责计算,其特征在于,所述方法包括如下步骤:
    S1、将网格点编号分配给所述水平二维子网格上的每个网格点,以使每个所述网格点拥有相对于所述水平二维子网格唯一的网格点编号;
    S2、使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的网格点编号和影像区所包含的网格点的网格点编号;
    S3、根据所述第一进程所记录的影像区所包含的第一网格点的网格点编号,并根据所述其他进程所记录的各自计算区所包含的网格点的网格点编号,若所述第一网格点编号和所述其他进程中第二进程对应的计算区所包含的第二网格点的网格点编号相同,确定所述第一进程对应的影像区所包含的第一网格点的数据来自所述其他进程中第二进程对应的计算区所包含的记录有相同网格点编号的第二网格点;
    S4、建立所述第一进程对应的影像区所包含的所述第一网格点与所述第二进程对应的计算区所包含的所述第二网格点之间的映射关系,以将所述第二网格点的数据传递到所述第一网格点,实现面向数值模型的进程间的数据传输。
  2. 根据权利要求1所述的面向数值模型的并行通信方法,其特征在于:所述方法还包含:
    S5、根据所述第一进程所记录的影像区所包含的第三网格点的网格点编号,并根据所述其他进程所记录的各自计算区所包含的网格点的网格点编号,若所述第三网格点编号和所述其他进程中第三进程对应的计算区所包含的第四网格点的网格点编号相同,确定所述第一进程对应的影像区所包含的第三网格点的数据来自所述其他进程中第三进程对应的计算区所包含的记录有相同网格点编号的第四网格点;
    S6、建立所述第一进程对应的影像区所包含的所述第三网格点与所述第三进程对应的计算区所包含的所述第四网格点之间的映射关系,以将所述第四网格点的数据传递到所述第三网格点。
  3. 根据权利要求1所述的面向数值模型的并行通信方法,其特征在于:所述步骤S1和S2还包括:
    S1-1、将并行剖分编号分配给所述并行剖分区域中的每个网格点,以使所述水平二维子网格上的每个所述并行剖分区域中的网格点拥有唯一的并行剖分编号;
    S2-1、使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的并行剖分编号和影像区所包含的网格点的并行剖分编号;
    其中,所述并行剖分编号表示所述并行剖分区域中所包含的网格点的数据在所述并行剖分区域对应的进程中的存储位置编号。
  4. 根据权利要求3所述的面向数值模型的并行通信方法,其特征在于:所述步骤S3还包括:
    S3-1、所述第一网格点对应的并行剖分编号为第一并行剖分编号,所述第二网格点对应的并行剖分编号为第二并行剖分编号,以明确所述第一网格点和所述第二网格点的数据分别在所述第一进程和所述第二进程中的存储位置。
  5. 根据权利要求1所述的面向数值模型的并行通信方法,其特征在于:所述网格点的数据至少包括下列各项中的一项:大气模式的气度,风速,气压和湿度;海洋模式的海温、流速和盐度。
  6. 根据权利要求1所述的面向数值模型的并行通信方法,其特征在于:所述步骤S1之前还包括:
    注册所述水平二维子网格,并获得所述水平二维子网格的唯一网格标识。
  7. 根据权利要求6所述的面向数值模型的并行通信方法,其特征在于:所述注册所述水平二维子网格包括:
    记录所述水平二维子网格的范围,所述网格点的数量,各所述网格点的中心坐标值,各所述网格点所有顶点的坐标值,坐标值的单位和各所述网格点的面积。
  8. 一种面向数值模型的并行通信装置,所述数值模型将多维空间划分为若干子网格,其中包括由若干网格点构成的水平二维子网格,所述水平二维子网格上形成有多个并行剖分区域,每个所述并行剖分区域的数据存储在一个进程中,所述进程对应的并行剖分区域包括计算区和影像区,所述计算区所包含的网格点的数据由所述进程负责计算,所述影像区所包含的网格点的数据由其他进程负责计算,其特征在于,所述装置包括:
    网格点编号分配模块,用于将网格点编号分配给所述水平二维子网格上的每个网格点,以使每个所述网格点拥有相对于所述水平二维子网格唯一的网格点编号;
    进程管理模块,用于使第一进程和所述其他进程分别记录各自对应的并行剖分区域中的计算区所包含的网格点的网格点编号和影像区所包含的网格点的网格点编号;
    网格点匹配模块,根据所述第一进程所记录的影像区所包含的第一网格点的网格点编号,并根据所述其他进程所记录的各自计算区所包含的网格点的网格点编号,若所述第一网格点编号和所述其他进程中第二进程对应的计算区所包含的第二网格点的网格点编号相同,确定所述第一进程对应的影像区所包含的第一网格点的数据来自所述其他进程中第二进程对应的计算区所包含的记录有相同网格点编号的第二网格点;
    通信映射建立模块,建立所述第一进程对应的影像区所包含的所述第一网格点与所述第二进程对应的计算区所包含的所述第二网格点之间的映射关系,以将所述第二网格点的数据传递到所述第一网格点,实现面向数值模型的进程间的数据传输。
  9. 一种面向数值模型的并行通信系统,其特征在于,包括处理器和存储器,所述存储器存储有计算机程序,所述计算机程序被所述处理器执行时,实现所述权利要求1~7中任意一项所述的方法。
  10. 一种存储介质,存储有计算机可读程序,其特征在于,所述计算机可读程序在被处理器执行时,实现所述权利要求1~7中任意一项所述的方法。
PCT/CN2019/122767 2019-10-24 2019-12-03 一种面向数值模型的并行通信方法、装置、系统和存储介质 WO2021077552A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911019068.3A CN110764934B (zh) 2019-10-24 2019-10-24 面向数值模型的并行通信方法、装置、系统和存储介质
CN201911019068.3 2019-10-24

Publications (1)

Publication Number Publication Date
WO2021077552A1 true WO2021077552A1 (zh) 2021-04-29

Family

ID=69333577

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122767 WO2021077552A1 (zh) 2019-10-24 2019-12-03 一种面向数值模型的并行通信方法、装置、系统和存储介质

Country Status (2)

Country Link
CN (1) CN110764934B (zh)
WO (1) WO2021077552A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367665B (zh) * 2020-02-28 2020-12-18 清华大学 一种并行通信路由建立方法及系统
CN113157806B (zh) * 2021-04-19 2022-05-24 清华大学 网格数据分布式存储服务系统、方法、装置、设备及介质
CN112988907B (zh) * 2021-04-28 2022-01-21 北京卡普拉科技有限公司 一种信息调整方法、系统、电子设备及存储介质
CN113177329B (zh) * 2021-05-24 2022-05-27 清华大学 数值程序的数据处理系统
CN116306122B (zh) * 2023-03-07 2023-09-19 国家海洋环境预报中心 用于海洋数值模式的网格计算方法、计算机及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7506134B1 (en) * 2006-06-16 2009-03-17 Nvidia Corporation Hardware resource based mapping of cooperative thread arrays (CTA) to result matrix tiles for efficient matrix multiplication in computing system comprising plurality of multiprocessors
CN102592251A (zh) * 2011-01-18 2012-07-18 清华大学 地球系统模式的通用模块化并行耦合系统
CN102707932A (zh) * 2012-05-16 2012-10-03 清华大学 一种用于地球系统模式的并行耦合方法
CN104200045A (zh) * 2014-09-17 2014-12-10 武汉大学 一种流域大尺度水系分布式水动力模型的并行计算方法

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5981768B2 (ja) * 2012-05-15 2016-08-31 キヤノン株式会社 色処理装置およびその方法
CN107239352B (zh) * 2017-05-31 2019-11-29 北京科技大学 一种动力学蒙特卡洛并行模拟的通信优化方法及其系统
CN108062785A (zh) * 2018-02-12 2018-05-22 北京奇虎科技有限公司 面部图像的处理方法及装置、计算设备
CN108459909B (zh) * 2018-02-27 2021-02-09 北京临近空间飞行器系统工程研究所 一种适于并行处理的多体分离网格重叠方法及系统
CN108595277B (zh) * 2018-04-08 2021-01-19 西安交通大学 一种基于OpenMP/MPI混合编程的CFD仿真程序的通信优化方法
CN108959720A (zh) * 2018-06-08 2018-12-07 浙江捷尚人工智能研究发展有限公司 一种计算流体力学实时模拟方法、电子设备、存储介质及系统
CN109754449B (zh) * 2018-11-22 2020-04-03 清华大学 一种二维网格图形的三角化确定方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7506134B1 (en) * 2006-06-16 2009-03-17 Nvidia Corporation Hardware resource based mapping of cooperative thread arrays (CTA) to result matrix tiles for efficient matrix multiplication in computing system comprising plurality of multiprocessors
CN102592251A (zh) * 2011-01-18 2012-07-18 清华大学 地球系统模式的通用模块化并行耦合系统
CN102707932A (zh) * 2012-05-16 2012-10-03 清华大学 一种用于地球系统模式的并行耦合方法
CN104200045A (zh) * 2014-09-17 2014-12-10 武汉大学 一种流域大尺度水系分布式水动力模型的并行计算方法

Also Published As

Publication number Publication date
CN110764934A (zh) 2020-02-07
CN110764934B (zh) 2020-11-27

Similar Documents

Publication Publication Date Title
WO2021077552A1 (zh) 一种面向数值模型的并行通信方法、装置、系统和存储介质
CN106056529B (zh) 一种对用于图片识别的卷积神经网络训练的方法与设备
Oliker et al. PLUM: Parallel load balancing for adaptive unstructured meshes
CN104036537A (zh) 多分辨率一致光栅化
CN103761215B (zh) 基于图形处理器的矩阵转置优化方法
Oliker et al. Parallel tetrahedral mesh adaptation with dynamic load balancing
US10216546B1 (en) Computationally-efficient resource allocation
EP2738675B1 (en) System and method for efficient resource management of a signal flow programmed digital signal processor code
JP3047998B2 (ja) 並列計算機におけるプロセッサ割り当て方法、及び装置
CN109241193A (zh) 分布式数据库的处理方法和装置,及服务器集群
CN110737870B (zh) 一种用于在gpu上合并舒尔矩阵的方法及装置
CN112463160A (zh) 编译方法、装置、电子设备和存储介质
CN109542406B (zh) 用于模式开发的并行求解方法和系统
CN102591622B (zh) 基于相似变换模型的栅格数据坐标转换并行方法
CN111367649A (zh) 高精地图数据并行处理方法和装置
US10013393B2 (en) Parallel computer system, parallel computing method, and program storage medium
CN115357679B (zh) 一种四维空域自适应栅格化规划方法及装置
Fehling Algorithms for massively parallel generic hp-adaptive finite element methods
Shimokawabe et al. A High-Productivity Framework for Adaptive Mesh Refinement on Multiple GPUs
CN106548466A (zh) 三维重建对象的方法和设备
Goodrich et al. Graph drawing in the cloud: Privately visualizing relational data using small working storage
US11983128B1 (en) Multidimensional and multiblock tensorized direct memory access descriptors
CN111712811A (zh) Hd地图的可扩展图形slam
JP3624015B2 (ja) 有限要素分割モデルから辺,面,要素を抽出する方法及びその装置
Oliker PLUM: parallel load balancing for unstructured adaptive meshes

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19949779

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19949779

Country of ref document: EP

Kind code of ref document: A1