Performance optimization method and device based on computing resources, equipment and storage medium

By performing performance optimization and grid division of marine circulation mode code, combined with data assimilation and parallel processing, the problem of high consumption of computing resources in global marine environmental forecast mode is solved, efficient computing efficiency and resource utilization are achieved, and business needs are met.

CN119201431AInactive Publication Date: 2024-12-27NAT MARINE ENVIRONMENTAL FORECASTING CENT
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411216456.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2024-12-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The computing resources consumed by the global marine environment forecasting model are too large, which is difficult to meet business needs. Especially due to the huge amount of computing due to high-resolution and complex data assimilation schemes, it is difficult for the existing technology to effectively utilize the performance of high-performance computers.

Method used

By performing performance optimization of marine circulation mode code, including compilation option optimization, hotspot function optimization, single-instruction multi-data flow optimization and meshing optimization, combining data assimilation and parallel processing, computing efficiency and resource utilization are improved.

Benefits of technology

Under the existing computing resources, the computing efficiency of the global marine environmental forecasting model has been significantly improved, and good optimization efficiency and acceleration ratio have been obtained, which can better match business needs, save computing resources and improve the performance of the forecasting system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201431A_ABST
    Figure CN119201431A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a performance optimization method and device based on computing resources, equipment and a storage medium, and the method comprises the steps: carrying out the performance optimization of an ocean circulation mode code of a global ocean environment forecasting system in a target ocean circulation mode, and obtaining an optimized ocean circulation mode code; acquiring marine environment forecasting data needing to be subjected to marine environment forecasting; performing grid optimization on a grid division mode in the optimized ocean circulation mode code so as to determine an optimized global ocean environment forecasting system; performing data assimilation on the marine environment forecast data; and performing target ocean circulation mode operation by using the ocean environment forecasting data after data assimilation so as to realize ocean environment forecasting. According to the embodiment of the invention, the calculation efficiency of a global marine environment forecasting mode can be improved under the condition of existing calculation resources through a performance optimization mode, the calculation resources are applied more reasonably, good optimization efficiency and speed-up ratio are obtained, and business requirements are better matched.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the field of marine environment forecasting, and more specifically to a performance optimization method, device, equipment and storage medium based on computing resources. Background Art

[0002] The main means of studying the ocean include theoretical research, observational experiments and numerical simulation. Observational experiments are the basis of numerical simulation and theoretical research, theoretical research provides guidance for the design of numerical simulation and observational experiments, and numerical models integrate the knowledge and understanding gained from observational data and theoretical research. They can not only be used to verify theoretical hypotheses and make up for the shortcomings of observational data, but are also the only tool that can ultimately be used to predict future changes.

[0003] Ocean forecasting provides predictions of future environmental succession for ocean conditions and ocean phenomena at multiple spatial and temporal scales covering the entire globe through efficient data assimilation systems and numerical models. It is the basis for all ocean activities such as maritime navigation, marine fisheries, and marine resource exploitation. The ocean circulation model is an important component of the ocean forecasting system. Since its birth, through continuous improvement and development, the ocean circulation model has become the core component of the ocean numerical forecasting system. In recent years, with the frequent occurrence of marine disasters and the establishment of a sound ocean circulation model system, the operational upgrade of global and regional ocean forecasting systems is becoming increasingly important.

[0004] With the continuous deepening of ocean and climate change research and the development of high-performance computers, ocean circulation models are gradually developing towards higher resolution, more physical processes and faster computing speed. Generally speaking, for every doubling of horizontal resolution, the amount of calculation will increase to 8 to 10 times the original amount. At the same time, with the increase in resolution, more and more physical processes that cannot be described by the original sub-grid will be included, and the parameterization of the new sub-grid process also needs to be evaluated and adjusted by comparing multiple sets of numerical test results with measured data, which obviously also increases the requirements for computing amount and computing power. Therefore, making full use of and giving full play to the performance of high-performance computers to improve the computing speed of ocean circulation models has become a necessary condition for the development of models.

[0005] Due to its wide coverage, high resolution, complex data assimilation scheme, and large amount of data, the computing resource consumption of the global ocean environment forecast model is increasing. Therefore, the global ocean environment forecast model consumes too much resources, and better matching the operational needs has become an urgent problem to be solved. Summary of the invention

[0006] The embodiments of the present application provide a performance optimization method, device, equipment and storage medium based on computing resources, which can improve the computing efficiency of the global ocean environment forecast model under the existing computing resources through performance optimization, and can more reasonably apply computing resources to obtain good optimization efficiency and acceleration ratio, so as to better match the business needs.

[0007] In a first aspect, an embodiment of the present application provides a performance optimization method based on computing resources, the method comprising:

[0008] Optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model;

[0009] Obtain the marine environment forecast data required for marine environment forecast;

[0010] The grid division method in the optimized ocean circulation model code was optimized to determine the optimized global ocean environment forecast system;

[0011] Performing data assimilation on the marine environment forecast data under the target ocean circulation model to obtain the marine environment forecast data after data assimilation;

[0012] The ocean environment forecast data after data assimilation is used to perform target ocean circulation model calculations in an optimized global ocean environment forecast system to achieve ocean environment forecasting.

[0013] In one embodiment of the present application, the target ocean circulation pattern is a target ocean circulation pattern;

[0014] The performance optimization of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is performed to obtain the optimized ocean circulation model code under the target ocean circulation model, including:

[0015] Optimizing the compilation options of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the code after the compilation options are optimized;

[0016] Use a preset performance analysis tool to locate the hotspot function in the code optimized by the compilation option, wherein the hotspot function is a function with a previously preset calculation time consumption under the target ocean circulation mode;

[0017] In the code optimized by the compilation option, performing algorithm optimization on the hotspot function to obtain the algorithm optimized code;

[0018] Performing single instruction multiple data flow optimization on the algorithm-optimized code to achieve automatic code vectorization and obtain automatically vectorized code;

[0019] The temporary array storing the intermediate results in the vectorized code is reconstructed into a subroutine storing the intermediate results, so as to obtain the optimized ocean circulation model code under the target ocean circulation model, and the subroutine is used to call when the corresponding intermediate results are needed in the loop.

[0020] In one implementation of the present application, the algorithm optimization of the hotspot function includes the following multiple items:

[0021] Adjust and modify the code of the hotspot function to reduce the number of hotspot function loops, optimize the data structure of the hotspot function, simplify the judgment logic of the hotspot function, or reduce unnecessary conditional branches related to the hotspot function;

[0022] Adjust and modify the code of the hotspot function to reduce unnecessary calls in the hotspot function;

[0023] The code of the hotspot function is adjusted and modified to reduce the use of variables in the hotspot function and optimize the use of local variables and global variables in the hotspot function.

[0024] In one embodiment of the present application, the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized by compiling options to obtain the code after compiling option optimization, including the following multiple items:

[0025] The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option enabling the highest optimization level so that the compiler generates the highest instruction set supported by the current processor;

[0026] The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option that enables interprocedural optimization, so as to achieve interprocedural optimization between compilation optimization enabled files, and enable the compiler to perform inline function expansion on functions defined in separate files;

[0027] For the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, the floating point division of the target ocean circulation model is optimized using the optimized floating point division compilation option to convert the division into the form of multiplication and reciprocal for calculation.

[0028] In one embodiment of the present application, performing single instruction multiple data flow optimization on the algorithm-optimized code to achieve automatic code vectorization to obtain the automatically vectorized code includes:

[0029] If the code after the algorithm optimization includes a first dynamic array and a second dynamic array, and the compiler cannot determine whether the first dynamic array and the second dynamic array have data dependency, it is determined that the first dynamic array and the second dynamic array cannot implement code automatic vectorization;

[0030] Splitting the code statements that the first dynamic array and the second dynamic array depend on into two loops, so that each loop meets the automatic vectorization condition, so as to realize the automatic vectorization of the first dynamic array and the second dynamic array;

[0031] If the target pointer is used as a temporary array in the code after the algorithm optimization, the target pointer is converted into a dynamic array to achieve automatic vectorization of the target pointer.

[0032] In one embodiment of the present application, the grid division method in the optimized ocean circulation model code is grid optimized to determine the optimized global ocean environment forecast system, including:

[0033] In the optimized ocean circulation model code, set the global ocean circulation grid space;

[0034] Establishing a parallel computing grid block matrix in the global ocean circulation grid space;

[0035] Removing all land calculation blocks in the grid block matrix, and marking adjacent ocean calculation blocks in the grid block matrix as adjacent, to obtain a first grid space;

[0036] The grid resolution of the first grid space is optimized through a grid refinement control strategy to achieve a higher resolution for grids near the land coastline and a lower resolution for grids in the open ocean, so as to determine an optimized global ocean environment forecasting system.

[0037] In one embodiment of the present application, the optimized global marine environment forecast system includes a target main program and a file output program;

[0038] The method of using the ocean environment forecast data after data assimilation to perform target ocean circulation model calculation in the optimized global ocean environment forecast system to achieve ocean environment forecast includes:

[0039] When the optimized global ocean environment forecast system performs target ocean circulation model calculation, the target main program and the file output program are run in parallel through the parallel mode of MPMD, and the data stream of the ocean environment forecast data after the data assimilation is processed in parallel to realize the ocean environment forecast;

[0040] Among them, the target main program includes multiple forecast operation processes, the file output program includes multiple file output processes, the number of the file output processes is less than the number of forecast operation processes, each file output process corresponds to multiple forecast operation processes, the multiple forecast operation processes are used to parallelly process the data stream of the marine environment forecast data after the data assimilation, and the file output process is used to receive the calculation results of the multiple forecast operation processes corresponding to itself, and perform single file output or parallel multiple file output.

[0041] In a second aspect, an embodiment of the present application provides a performance optimization device based on computing resources, which has the function of implementing the performance optimization method based on computing resources provided in the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, and the modules can be software and / or hardware.

[0042] In one embodiment of the present application, the computing resource-based performance optimization device includes:

[0043] A code optimization module is used to optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model;

[0044] A data acquisition module is used to acquire the marine environment forecast data required for marine environment forecast;

[0045] The grid optimization module is used to optimize the grid division method in the optimized ocean circulation model code to determine the optimized global ocean environment forecast system;

[0046] A data assimilation module, used for performing data assimilation on the marine environment forecast data under the target ocean circulation mode to obtain the marine environment forecast data after data assimilation;

[0047] The forecast module is used to use the ocean environment forecast data after the data assimilation to perform target ocean circulation model calculation in the optimized global ocean environment forecast system to achieve ocean environment forecast.

[0048] In one embodiment of the present application, the target ocean circulation pattern is a target ocean circulation pattern;

[0049] The code optimization module is specifically used for:

[0050] Optimizing the compilation options of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the code after the compilation options are optimized;

[0051] Use a preset performance analysis tool to locate the hotspot function in the code optimized by the compilation option, wherein the hotspot function is a function with a previously preset calculation time consumption under the target ocean circulation mode;

[0052] In the code optimized by the compilation option, performing algorithm optimization on the hotspot function to obtain the algorithm optimized code;

[0053] Performing single instruction multiple data flow optimization on the algorithm-optimized code to achieve automatic code vectorization and obtain automatically vectorized code;

[0054] The temporary array storing the intermediate results in the vectorized code is reconstructed into a subroutine storing the intermediate results, so as to obtain the optimized ocean circulation model code under the target ocean circulation model, and the subroutine is used to call when the corresponding intermediate results are needed in the loop.

[0055] In one embodiment of the present application, the code optimization module is specifically used for:

[0056] Adjust and modify the code of the hotspot function to reduce the number of hotspot function loops, optimize the data structure of the hotspot function, simplify the judgment logic of the hotspot function, or reduce unnecessary conditional branches related to the hotspot function;

[0057] Adjust and modify the code of the hotspot function to reduce unnecessary calls in the hotspot function;

[0058] The code of the hotspot function is adjusted and modified to reduce the use of variables in the hotspot function and optimize the use of local variables and global variables in the hotspot function.

[0059] In one embodiment of the present application, the code optimization module is specifically used for:

[0060] The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option enabling the highest optimization level so that the compiler generates the highest instruction set supported by the current processor;

[0061] The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option that enables interprocedural optimization, so as to achieve interprocedural optimization between compilation optimization enabled files, and enable the compiler to perform inline function expansion on functions defined in separate files;

[0062] For the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, the floating point division of the target ocean circulation model is optimized using the optimized floating point division compilation option to convert the division into the form of multiplication and reciprocal for calculation.

[0063] In one embodiment of the present application, the code optimization module is specifically used for:

[0064] If the code after the algorithm optimization includes a first dynamic array and a second dynamic array, and the compiler cannot determine whether the first dynamic array and the second dynamic array have data dependency, it is determined that the first dynamic array and the second dynamic array cannot implement code automatic vectorization;

[0065] Splitting the code statements that the first dynamic array and the second dynamic array depend on into two loops, so that each loop meets the automatic vectorization condition, so as to realize the automatic vectorization of the first dynamic array and the second dynamic array;

[0066] If the target pointer is used as a temporary array in the code after the algorithm optimization, the target pointer is converted into a dynamic array to achieve automatic vectorization of the target pointer.

[0067] In one embodiment of the present application, the grid optimization module is specifically used to:

[0068] In the optimized ocean circulation model code, set the global ocean circulation grid space;

[0069] Establishing a parallel computing grid block matrix in the global ocean circulation grid space;

[0070] Removing all land calculation blocks in the grid block matrix, and marking adjacent ocean calculation blocks in the grid block matrix as adjacent, to obtain a first grid space;

[0071] The grid resolution of the first grid space is optimized through a grid refinement control strategy to achieve a higher resolution for grids near the land coastline and a lower resolution for grids in the open ocean, so as to determine an optimized global ocean environment forecasting system.

[0072] In one embodiment of the present application, the optimized global marine environment forecast system includes a target main program and a file output program;

[0073] The forecast module is specifically used for:

[0074] When the optimized global ocean environment forecast system performs target ocean circulation model calculation, the target main program and the file output program are run in parallel through the parallel mode of MPMD, and the data stream of the ocean environment forecast data after the data assimilation is processed in parallel to realize the ocean environment forecast;

[0075] Among them, the target main program includes multiple forecast operation processes, the file output program includes multiple file output processes, the number of the file output processes is less than the number of forecast operation processes, each file output process corresponds to multiple forecast operation processes, the multiple forecast operation processes are used to parallelly process the data stream of the marine environment forecast data after the data assimilation, and the file output process is used to receive the calculation results of the multiple forecast operation processes corresponding to itself, and perform single file output or parallel multiple file output.

[0076] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which includes instructions, which, when executed on a computer, enables the computer to execute the performance optimization method based on computing resources as described in the first aspect.

[0077] In a fourth aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the computing resource-based performance optimization method described in the first aspect when executing the computer program.

[0078] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor coupled to a transceiver of a terminal device, and is used to execute the technical solution provided in the first aspect of the embodiment of the present application.

[0079] In a sixth aspect, an embodiment of the present application provides a chip system, which includes a processor for supporting a terminal device to implement the functions involved in the above-mentioned first aspect, for example, generating or processing information involved in the image processing method provided in the above-mentioned first aspect.

[0080] In a possible design, the chip system further includes a memory, which is used to store program instructions and data required by the terminal. The chip system can be composed of a chip, or can include a chip and other discrete devices.

[0081] In a seventh aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the computing resource-based performance optimization method provided in the first aspect.

[0082] Compared with the prior art, in an embodiment of the present application, the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized to obtain the optimized ocean circulation model code under the target ocean circulation model; the ocean environment forecast data required for the ocean environment forecast is obtained; the grid division method in the optimized ocean circulation model code is grid optimized to determine the optimized global ocean environment forecast system; the ocean environment forecast data is data assimilated under the target ocean circulation model to obtain the assimilated ocean environment forecast data; the assimilated ocean environment forecast data is used to perform the target ocean circulation model operation in the optimized global ocean environment forecast system to realize the ocean environment forecast. Since the embodiment of the present application first optimizes the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, and on this basis performs grid optimization and data assimilation on the target ocean circulation model, and uses the ocean environment forecast data after the data assimilation to perform target ocean circulation model operations to achieve ocean environment forecasting, the present application improves the computing efficiency of the global ocean environment forecast model under the existing computing resources by means of performance optimization, can more reasonably apply computing resources, obtain good optimization efficiency and acceleration ratio, and better match business needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] By reading the detailed description of the embodiments of the present application with reference to the accompanying drawings, the objectives, features and advantages of the embodiments of the present application will become easy to understand. Among them:

[0084] Figure 1 This is a schematic diagram of a scenario of a global ocean environment forecast system provided by an embodiment of the present application;

[0085] Figure 2 It is a schematic diagram of an embodiment of a performance optimization method based on computing resources provided in an embodiment of the present application;

[0086] Figure 3 It is a schematic diagram of an embodiment of the present application in which the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized to obtain the optimized ocean circulation model code under the target ocean circulation model;

[0087] Figure 4 It is a schematic diagram of an embodiment of performing algorithm optimization on hot spot functions in an embodiment of the present application;

[0088] Figure 5 is a schematic diagram of a grid for parallel calculation of a grid block matrix and removal of a full land calculation block in an embodiment of the present application;

[0089] Figure 6 is a schematic diagram of MPMD parallel file output in an embodiment of the present application;

[0090] Figure 7 It is a schematic diagram of the structure of an embodiment of a performance optimization device based on computing resources provided in an embodiment of the present application;

[0091] Figure 8 It is a schematic diagram of the structure of the server provided in the embodiment of the present application. DETAILED DESCRIPTION

[0092] The terms "first", "second", etc. in the specification and claims of the embodiments of the present application and the above-mentioned drawings are used to distinguish similar objects (for example, the first xx and the second xx are respectively expressed as different xx, and the others are similar), and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described here can be implemented in an order other than the content illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device including a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The division of the modules that appear in the embodiments of the present application is only a logical division. There may be other division methods when implemented in practical applications, such as multiple modules can be combined or integrated in another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling between modules, and the communication connection can be electrical or other similar forms, which are not limited in the embodiments of the present application. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in multiple circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiment of the present application.

[0093] Embodiments of the present application provide a computing resource-based performance optimization method, apparatus, device, and storage medium.

[0094] See also Figure 1 , Figure 1 Schematic diagram of a scenario of a global ocean environment forecast system provided in an embodiment of the present application. The global ocean environment forecast system may include a client 100 and a computer device 200. The client 100 and the computer device 200 are connected via a network. A performance optimization device based on computing resources is integrated in the computer device 200. The computer device 200 may be a work platform server (i.e., a server loaded with a work platform). Figure 1In the server, the client 100 can access the computer device 200. In the embodiment of the present application, the computer device 200 is mainly used to optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model; obtain the ocean environment forecast data required for the ocean environment forecast; perform grid optimization on the grid division method in the optimized ocean circulation model code to determine the optimized global ocean environment forecast system; perform data assimilation on the ocean environment forecast data under the target ocean circulation model to obtain the ocean environment forecast data after data assimilation; use the ocean environment forecast data after data assimilation to perform the target ocean circulation model operation in the optimized global ocean environment forecast system to achieve the ocean environment forecast.

[0095] In the embodiment of the present application, the computer device 200 can be an independent server, or a server network or server cluster composed of servers. For example, the computer device 200 described in the embodiment of the present application includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of a plurality of servers. Wherein, the cloud server is composed of a large number of computers or network servers based on cloud computing (Cloud Computing). In the embodiment of the present application, communication can be achieved between the server and the client by any communication method, including but not limited to, mobile communication based on the third generation partnership project (3rd Generation Partnership Project, 3GPP), long term evolution (Long Term Evolution, LTE), Worldwide Interoperability for Microwave Access (Worldwide Interoperability for Microwave Access, WiMAX), or computer network communication based on TCP / IP protocol suite (TCP / IP Protocol Suite, TCP / IP), user datagram protocol (User Datagram Protocol, UDP) protocol, etc.

[0096] It is understandable that the client 100 used in the embodiment of the present application can be understood as a client device, which includes both receiving and transmitting hardware, that is, a device with receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. Such client devices may include: cellular or other communication devices, which have a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The specific client 100 can be a desktop terminal or a mobile terminal, and the client 100 can be one of a mobile phone, a tablet computer, a laptop computer, etc.

[0097] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or fewer servers, or server network connections, as shown in Figure 1 Only one server and one client are shown. It can be understood that the global marine environment forecast system can also include one or more other servers, and / or one or more clients connected to the server network, which is not specifically limited here.

[0098] In addition, if Figure 1 As shown, the global marine environment forecast system can also include a memory 300 for storing data, such as storing marine environment forecast data. For example, the data required for storing the global marine environment forecast system includes, in addition to basic geographic information such as coasts and seabed topography, a series of marine observation data, such as satellite remote sensing, radar, ocean stations, buoys, ship reports, Argo, etc.

[0099] It should be noted that Figure 1 The scenario diagram of the global ocean environment forecast system shown is only an example. The global ocean environment forecast system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of the global ocean environment forecast system and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.

[0100] The following describes it in detail with reference to specific embodiments.

[0101] In this embodiment, description will be made from the perspective of a performance optimization device based on computing resources, and the performance optimization device based on computing resources may be specifically integrated into the computer device 200 .

[0102] The present application provides a performance optimization method based on computing resources, which includes: optimizing the performance of an ocean circulation model code of a global ocean environment forecast system under a target ocean circulation model to obtain an optimized ocean circulation model code under the target ocean circulation model; acquiring ocean environment forecast data required for ocean environment forecasting; optimizing the grid division method in the optimized ocean circulation model code to determine an optimized global ocean environment forecast system; assimilating the ocean environment forecast data under the target ocean circulation model to obtain the assimilated ocean environment forecast data; and using the assimilated ocean environment forecast data to perform target ocean circulation model calculations in the optimized global ocean environment forecast system to achieve ocean environment forecasting.

[0103] See also Figure 2 , is a flow chart of an embodiment of a performance optimization method based on computing resources in an embodiment of the present application. The performance optimization method based on computing resources includes the following steps 201 to 205:

[0104] 201. Optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model.

[0105] Commonly used global operational ocean circulation models include HYCOM (The HYbrid Coordinate Ocean Model), POM (The Princeton Ocean Model), MOM (The Modular Ocean Model), MITgcm (The MITGeneral Circulation Model), NEMO (The Nucleus for European Modelling of the Ocean), etc.

[0106] HYCOM is an ocean model that uses hybrid coordinates. The model is fully parallelized and designed with portability in various systems in mind. The United States uses this model in the GODAE program. This model has two different ways of parallel communication, namely MPI (message passing interface) and a shared memory-based interface, which are implemented using different subroutines in the model. POM is a free surface, three-dimensional baroclinic primitive equation ocean model. The parameterization scheme uses the Mellor-Yamada scheme, which can simulate multi-scale phenomena in the ocean, from small-scale nearshore processes to global climate change. The parallel versions of the model include mpiPOM, etc.

[0107] MOM uses horizontal orthogonal coordinates, Arakawa-B grid for variable space configuration, and MPI and SHMEM (shared memory, originated from Cray machine) for model parallelism. MITgcm is a numerical model used to study the atmosphere, ocean and climate. The model uses non-hydrostatic and finite volume methods, and can simulate a wide range of fluid phenomena in the ocean and atmosphere. A very important element in the model software architecture is a software package called WRAPPER (WrappableApplication Parallel Programming Environment Resource), which enables the model to support multiple parallel schemes and has good parallel scalability.

[0108] NEMO is a primitive equation ocean environment model that uses Boussinesq and static approximation, orthogonal curvilinear coordinates, Arkawa-C network, and vertical coordinates using z coordinates or S coordinates. The mature and advanced physical parameterization scheme and numerical calculation algorithm enable NEMO to support high resolution, excellent load balancing design, parallel IO technology, and single and double-way multi-layer nesting, making it the latest model framework used in oceanographic research, ocean seasonal prediction, and climate research internationally. The forecast products output by NEMO include almost all products in the current ocean forecast business, laying a foundation for the application of NEMO in the business of ocean environment forecasting.

[0109] NEMO includes modules such as OPA (Oc′ean PArall′elis′e), TAM (Tangent linear and adjoint models), LIM (laneuve Ice Model) and TOP (Tracer in the Ocean Paradigm). It was jointly developed by France, the United Kingdom and Italy and has been widely used in 270 related scientific research projects in 27 countries. It is the main force of the current operational ocean forecasting system in various countries in the world, such as Mercator in France, FOAM in the United Kingdom, MFS in Italy and CONCEPTS in Canada. At present, the NEMO ocean circulation model has been operationally applied in the ocean forecasting departments of some countries, among which Mercator in France and FOAM in the United Kingdom are the most prominent. In terms of resolution, Mercator and FOAM have both realized two forecast system versions with resolutions of 1 / 4° and 1 / 12°. The 1 / 4° version provides boundary conditions for high-resolution regional ocean models, and the 1 / 12° version can predict and diagnose ocean vortices. In terms of vertical stratification, both Mercator and FOAM use z-coordinate stratification, and the vertical resolution near the surface of the ocean can reach 1m. In terms of forecast timeliness, the Mercator global ocean system can complete a 14-day forecast at one time.

[0110] The current NEMO ocean circulation model not only involves a large amount of data exchange, but also has many branch judgments. Therefore, how to optimize and improve the computing performance of the ocean circulation model is very representative and necessary.

[0111] In the embodiment of the present application, the target ocean circulation model can be the HYCOM ocean circulation model, the POM ocean circulation model, the MOM ocean circulation model, the MITgcm ocean circulation model, the NEMO ocean circulation model, etc. The target ocean circulation model is preferably the NEMO ocean circulation model, which can optimize and improve the computing performance of the NEMO ocean circulation model in a targeted manner.

[0112] In this step, the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized to obtain the optimized ocean circulation model code under the target ocean circulation model, so as to fully utilize and give play to the performance of modern high-performance computers and further promote the application and development of ocean circulation models.

[0113] 202. Obtain the marine environment forecast data required for marine environment forecast.

[0114] The marine environment forecast data required by the global marine environment forecast system include not only basic geographic information such as coast and seabed topography, but also a series of marine observation data, such as satellite remote sensing, radar, ocean stations, buoys, ship reports, Argo and other data. It can be collected in advance through various means (such as satellite remote sensing, radar, ocean stations, buoys, ships, etc.). These marine environment forecast data are unevenly distributed in space, inconsistent in time distribution, different in data sources, and inconsistent in error information. The system collects the above different types of data and processes and stores them according to the format and directory requirements of system data assimilation.

[0115] 203. The grid division method in the optimized ocean circulation model code was optimized to determine the optimized global ocean environment forecast system.

[0116] 204. Perform data assimilation on the ocean environment forecast data under the target ocean circulation model to obtain the ocean environment forecast data after data assimilation.

[0117] In order to effectively utilize a large amount of multi-source unconventional data and provide a more accurate initial field for the ocean circulation model, the ocean numerical prediction system needs to assimilate data. The system data assimilation module is the three-dimensional variational assimilation system OceanVar. Under the target ocean circulation model, the three-dimensional variational assimilation system OceanVar is used to assimilate the ocean environment forecast data to obtain the assimilated ocean environment forecast data.

[0118] 205. Using the ocean environment forecast data after data assimilation, target ocean circulation model calculation is performed in the optimized global ocean environment forecast system to achieve ocean environment forecast.

[0119] Compared with the prior art, in an embodiment of the present application, the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized to obtain the optimized ocean circulation model code under the target ocean circulation model; the ocean environment forecast data required for the ocean environment forecast is obtained; the grid division method in the optimized ocean circulation model code is grid optimized to determine the optimized global ocean environment forecast system; the ocean environment forecast data is data assimilated under the target ocean circulation model to obtain the assimilated ocean environment forecast data; the assimilated ocean environment forecast data is used to perform the target ocean circulation model operation in the optimized global ocean environment forecast system to realize the ocean environment forecast. Since the embodiment of the present application first optimizes the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, and on this basis performs grid optimization and data assimilation on the target ocean circulation model, and uses the ocean environment forecast data after the data assimilation to perform target ocean circulation model operations to achieve ocean environment forecasting, the present application improves the computing efficiency of the global ocean environment forecast model under the existing computing resources by means of performance optimization, can more reasonably apply computing resources, obtain good optimization efficiency and acceleration ratio, and better match business needs.

[0120] In the embodiment of the present application, when the target ocean circulation mode is the NEMO ocean circulation mode, such as Figure 3 As shown, the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized to obtain the optimized ocean circulation model code under the target ocean circulation model, which may further include the following steps 301 to 305:

[0121] 301. Optimize the compilation options of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the code after the compilation options are optimized.

[0122] Based on the performance analysis, the NEMO ocean circulation model is first optimized using the compilation options in the embodiment of the present application. In the embodiment of the present application, the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized by the compilation options to obtain the optimized code by the compilation options, including the following steps:

[0123] (1) The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option enabling the highest optimization level so that the compiler generates the highest instruction set supported by the current processor.

[0124] For example, use the xHOST option to enable the compiler to generate the highest instruction set supported by the processor, that is, use the compilation option optimization that enables the highest optimization level to enable the compiler to generate the highest instruction set supported by the current processor.

[0125] (2) The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option that enables inter-procedural optimization, to achieve inter-procedural optimization between compilation optimization enabled files, so that the compiler performs inline function expansion on functions defined in separate files;

[0126] For example, using the ipo option to enable interprocedural optimizations between files causes the compiler to perform inline function expansion on functions defined in separate files.

[0127] (3) For the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, the floating point division of the NEMO ocean circulation model is optimized using the optimized floating point division compilation option to convert the division into the form of multiplication of the inverse number for calculation.

[0128] For example, the no-prec-div option is used to optimize the floating-point division of the NEMO ocean circulation model, changing the division to the reciprocal multiplication form for calculation, thereby improving the calculation efficiency.

[0129] In addition, in the embodiment of the present application, the compilation option optimization is performed on the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, and optimization options such as fp-modelfast=2, qopt-dynamic-align, qopt-prefetch, etc. can also be used, as shown in Table 1.

[0130] Table 1 Compilation option optimization list

[0131]

[0132]

[0133] After the compilation option optimization in this step, the overall speedup ratio of the NEMO ocean circulation model can reach 1.4 times. By analyzing the output results, taking the sea surface temperature as an example, it is found that the absolute value of the error caused by the two compilation options O1 and O3 does not exceed 8.5×10 -6 ℃, accounting for only 0.00004% of the average sea surface temperature, and the absolute error is within 1.0×10 -8 The proportion of grid points below ℃ exceeds 99.9%, which meets the accuracy requirements. Similarly, the checks on other variables also meet the accuracy requirements. Therefore, compile option optimization is an effective optimization method.

[0134] 302. Use a preset performance analysis tool to locate hot functions in the code optimized by the compilation option.

[0135] The hotspot function is a function whose operation time is preset in the front under the NEMO ocean circulation mode, for example, the front 5 presets.

[0136] In order to more accurately obtain the bottleneck that affects the computational efficiency of the NEMO ocean circulation model, and thus optimize the NEMO ocean circulation model in a more targeted manner, firstly, Intel Vtune Amplifier (performance analysis tool) can be used to locate the hotspot functions in the NEMO ocean circulation model, that is, the functions that consume more time, and the hotspot functions in the NEMO ocean circulation model are counted. The results show that the hotspot functions in the NEMO ocean circulation model are extremely scattered, that is, there are many hotspot functions and the time consumption is more evenly distributed. In the embodiment of the present application, the first five hotspot functions (tra_ldf_iso, lim_rhg, tra_adv_tvd, ldf_slp, nonosc) can be selected for key optimization.

[0137] 303. In the code optimized by the compilation option, perform algorithm optimization on the hotspot function to obtain the algorithm optimized code.

[0138] The algorithm optimization of the hotspot function may include the following items:

[0139] (1) Adjust and modify the code of the hotspot function to reduce the number of hotspot function loops, optimize the data structure of the hotspot function, simplify the judgment logic of the hotspot function, or reduce unnecessary conditional branches related to the hotspot function;

[0140] (2) adjusting and modifying the code of the hotspot function to reduce unnecessary calls in the hotspot function;

[0141] (3) The code of the hotspot function is adjusted and modified to reduce the use of variables in the hotspot function and optimize the use of local variables and global variables in the hotspot function.

[0142] The algorithm optimization of the hotspot function may include scalar serial optimization of the hotspot function. The purpose of scalar serial optimization is to adjust and modify the hotspot function code, such as removing repeated calculations, reducing conditional branches, reducing loop nesting, etc., to ensure that the code uses the least amount of calculation and appropriate precision to obtain the correct result. The following takes the traldf_iso hotspot function as an example to introduce this optimization process.

[0143] In such Figure 4In the example shown, the calculation formulas of zdk1t and zdkt are the same, that is, zdk1t(ji,jj,jk-1)=zdkt(ji,jj,jk), so by removing zdk1t from the loop and assigning the result to zdk1t after calculating zdkt, repetitive calculations can be reduced.

[0144] For example, when accessing array elements from memory, the addressing interval between two accesses will affect the cache hit rate and reduce computing efficiency. If the array in the hot function is stored in a column-first manner, adjusting the access order of array elements in the hot function to reduce the addressing interval between two adjacent accesses can effectively improve the cache hit rate in the hot function.

[0145] In addition, reducing loop nesting can also effectively improve the computational efficiency of the NEMO ocean circulation model. For example, in the loop of a hotspot function, z2d is a temporary array, the purpose of which is to store the integral of zftu in three-dimensional space along the K axis. Since the computational efficiency of the triple loop is low, the forall command provided by Fortran is used to reduce the loop to a single loop. After the above serial and scalar optimization, the overall computational efficiency of the NEMO ocean circulation model is improved by 22%.

[0146] In the embodiment of the present application, the specific steps for optimizing the first five hotspot functions (tra_ldf_iso, lim_rhg, tra_adv_tvd, ldf_slp, nonosc) can be referred to as follows:

[0147] For example, for the optimization of the tra_ldf_iso function: analyze the data dependencies in the tra_ldf_iso function, and analyze whether the efficiency can be improved through parallel processing or optimization of data access patterns through data dependencies. If parallel processing is possible, change the tra_ldf_iso function to parallel processing (for example, consider using multi-threading or multi-process technology to split the task. Use tools such as OpenMP, Intel Threading Building Blocks (TBB), or Python's concurrent.futures module to manage concurrency). If the data access pattern can be optimized to improve efficiency, optimize the data access pattern (for example, consider using more efficient data structures such as hash tables or search trees).

[0148] Optimization of the lim_rhg function: If the lim_rhg function involves a lot of calculations, you can use preset numerical analysis techniques or preset approximate algorithm processing to reduce the amount of calculations.

[0149] Optimization of the tra_adv_tvd function: Check whether the tra_adv_tvd function has repeated calculations or intermediate results that can be cached. If so, delete the repeated calculations, retain only one calculation result, and cache it as an intermediate result. For example, for data frequently accessed by the tra_adv_tvd function, use cache to reduce data access time. Consider using cache strategies such as LRU (least recently used). At the same time, optimize the cache update strategy to reduce the number of cache invalidations, thereby improving the cache hit rate.

[0150] Optimization of the ldf_slp function: If the ldf_slp function involves a large amount of data reading (such as reading more than a preset number of times), a more efficient data reading strategy, such as a batch reading strategy or an asynchronous reading strategy, can be used for data reading.

[0151] Optimization of nonosc functions: Analyze the logical judgment in nonosc functions and analyze whether unnecessary calculations can be reduced by optimizing the judgment conditions.

[0152] 304. Perform single instruction multiple data flow optimization on the algorithm-optimized code to achieve automatic code vectorization and obtain automatically vectorized code.

[0153] Single instruction multiple data stream, executes the same instruction on multiple data at the same time in a synchronous manner. Vectorization is a hallmark of modern computers. Using automatic vectorization can significantly improve the computing performance of software. In this test environment, when compiling with the xHOST option, the automatic vectorization function is already included. However, automatic vectorization needs to follow vectorization rules, such as no data dependencies and jump statements in the loop. In the embodiment of the present application, the code after the algorithm optimization is optimized by single instruction multiple data stream to achieve automatic code vectorization and obtain the automatically vectorized code.

[0154] Further, performing single instruction multiple data flow optimization on the algorithm-optimized code to achieve automatic code vectorization to obtain the automatically vectorized code may include:

[0155] If the code after the algorithm optimization includes a first dynamic array and a second dynamic array, and the compiler cannot determine whether the first dynamic array and the second dynamic array have data dependency, it is determined that the first dynamic array and the second dynamic array cannot implement code automatic vectorization;

[0156] Splitting the code statements that the first dynamic array and the second dynamic array depend on into two loops, so that each loop meets the automatic vectorization condition, so as to realize the automatic vectorization of the first dynamic array and the second dynamic array;

[0157] If the target pointer is used as a temporary array in the code after the algorithm optimization, the target pointer is converted into a dynamic array to achieve automatic vectorization of the target pointer.

[0158] For example, in the optimized algorithm code, there are dynamic arrays zdit and zdjt implemented by pointers. Since zdit and zdjt are both dynamic arrays implemented by pointers, and Fortran pointers can be used as aliases to point to a memory address, the compiler cannot determine whether there is data dependency between the zdit and zdjt pointers, and thus cannot achieve automatic vectorization. In the embodiment of the present application, automatic vectorization can be achieved by splitting the statement assuming dependency into two loops so that each loop meets the conditions for automatic vectorization.

[0159] In some other embodiments of the present application, since there are a large number of pointers in the code as temporary arrays, the code can be safely automatically vectorized by modifying the pointers into dynamic arrays without affecting the physical process. After single instruction multiple data stream optimization, the overall computational efficiency of the NEMO ocean circulation model is increased to 50%.

[0160] 305. Reconstruct the temporary array storing the intermediate results in the vectorized code into a subroutine storing the intermediate results, and obtain the optimized ocean circulation model code under the target ocean circulation model. The subroutine is used to call when the corresponding intermediate results are needed in the loop.

[0161] In the embodiment of the present application, when the CPU needs to read data in the memory, the CPU will first issue a request executed by the memory controller, and then return the data from the memory to the central processing unit. The time of this process is called the delay cycle. In order to shorten the delay cycle, L1 and L2 caches are set between the central processing unit and the memory. Since both L1 and L2 use the principle of static random access, it can be understood as memory bandwidth. Optimizing the memory bandwidth can improve the cache hit rate, which is also an effective way to improve software computing efficiency.

[0162] Due to the complex physical process of the ocean circulation model, a large number of temporary arrays are used in the ocean circulation model to save the intermediate results of the calculation process, which causes the problem of too many arrays involved in the calculation. When the CPU calculates, if a statement needs to read a large number of arrays at the same time, due to memory bandwidth limitations, it will reduce the cache hit rate and reduce computing efficiency. Therefore, reducing or avoiding the use of temporary arrays is an optimization method to alleviate the excessive memory bandwidth usage.

[0163] In the embodiment of the present application, the optimized ocean circulation model code under the target ocean circulation model is obtained by reconstructing the temporary array storing the intermediate results in the vectorized code into a subroutine storing the intermediate results. The subroutine is used to call the corresponding intermediate results in the loop.

[0164] For example, in the vectorized code, there are temporary arrays A and B for storing intermediate results. Arrays A and B are temporary arrays. During operation, values ​​are first assigned to arrays A and B through calculation, and then the arrays A and B are accessed in the subsequent loop. The optimization strategy is to remove the temporary arrays A and B, and reconstruct the calculation and assignment functions into subroutines cal_a and cal_b, and call them when the intermediate results are needed in the loop.

[0165] After analyzing the vectorized code, it was found that there were a large number of temporary arrays in traldf_iso, nonosc, and lim_rhg, which can be optimized using the above strategy. Based on the actual statistical calculation time of each function before and after optimization and its acceleration ratio, it can be seen that the calculation efficiency of a single hotspot function has been effectively improved after optimization, and the effect is significant. Since the hotspot function of the NEMO ocean circulation model is scattered, this optimization has accelerated the overall calculation efficiency of the NEMO ocean circulation model to 1.4 times.

[0166] At present, the research on high-performance ocean numerical simulation mainly adopts the following schemes to improve the model computing capability:

[0167] 1) Based on distributed memory parallelization program. The MPI (Message Passing Interface) message passing interface is mainly used to reasonably distribute computing tasks in the computing units of multiple independent processes, and data communication is carried out through high-speed networks. This method is complex to implement and needs to consider issues such as boundary switching and load balancing. Although it has good scalability, exchanges between nodes will bring communication overhead. 2) Based on shared memory parallelization program. The OpenMP and other interfaces are mainly used to assign computing tasks to multiple threads, and data exchange is achieved through shared memory addresses. This method is relatively easy to implement and has no communication overhead, but it generally cannot cross nodes, which limits its parallel scale.

[0168] 3) Process / thread-based parallelization. This method is a combination of the above two parallel methods. It is relatively complex to implement and is particularly effective on heterogeneous computers (such as CPU+GPU, domestic Shenwei processors, etc.).

[0169] The NEMO ocean circulation model is a cyclic process in general, in which time is the main sequence of the cycle. The cycle starts with data reading and ends with result output. The loop part contains all the core calculations in the model, and the total calculation amount accounts for 95% or more of the total cycle process. The NEMO ocean circulation model version used in the embodiment of the present application is written based on the MPI message passing interface. Using MPI distributed memory parallel computing can effectively divide tasks, thereby improving computing efficiency.

[0170] After several steps of compile option optimization, hotspot function optimization, single instruction multiple data flow optimization, and temporary array optimization, the overall performance of the NEMO ocean circulation model has been effectively improved. Serial code optimization is achieved by standardizing code writing, removing repeated calculations, reducing loop nesting, and other methods. The compiler automatically vectorizes by modifying the code to meet the compiler's requirements for vectorization. In addition, in response to the problem that the NEMO ocean circulation model occupies too much memory bandwidth, a solution to remove temporary arrays is proposed, so that the acceleration ratio of a single hotspot function after optimization can reach up to 1.4 times. After the above optimization, the overall computing efficiency of the NEMO ocean circulation model has been improved by 35%, saving nearly 1 / 3 of the computing resources. At the same time, the computing efficiency of the MPI parallel mode has been improved by more than 10 times compared with the serial mode, and the load balancing is also good.

[0171] In some embodiments of the present application, in step 203, the grid division method in the optimized ocean circulation model code is optimized to determine the optimized global ocean environment forecast system, which may include:

[0172] (1) In the optimized ocean circulation model code, set the global ocean circulation grid space.

[0173] In the embodiment of the present application, the global ocean environment forecast model can be the NEMO ocean circulation model, and the NEMO ocean circulation model can adopt the NEMO3.6 version, and set the global ocean circulation grid space, for example, the horizontal grid is a tripolar grid, the resolution in the equatorial region is 1 / 12° (about 10km), and it increases to 3km towards the poles, and the vertical layer is 75 layers. The number of calculation grids is 4322×3059×75.

[0174] (2) Establishing a parallel computing grid block matrix in the global ocean circulation grid space.

[0175] (3) All land calculation blocks in the grid block matrix are removed, and adjacent ocean calculation blocks in the grid block matrix are marked as adjacent, thereby obtaining a first grid space.

[0176] like Figure 5 As shown, it is a grid schematic diagram of parallel calculation of the grid block matrix and removal of the full land calculation block in an embodiment of the present application.

[0177] (4) Optimizing the grid resolution of the first grid space through a grid refinement control strategy to achieve a higher resolution for grids near the land coastline and a lower resolution for grids in the open ocean, so as to determine an optimized global ocean environment forecasting system.

[0178] In the embodiment of the present application, the grid refinement control strategy can be used to dynamically adjust the grid in the first grid space in reference to the actual state of the flow during the simulation process, which can theoretically simulate the flow with spatial non-uniformity and temporal intermittency more accurately and efficiently, and can achieve tracking simulation of specific targets. For example, by using high-resolution grids in necessary areas in the first grid space, such as using higher resolution near the coastline and lower resolution in the open ocean, the allocation of computing resources is optimized.

[0179] In some embodiments of the present application, the optimized global ocean environment forecast system includes a target main program and a file output program; at this time, the use of the ocean environment forecast data after the data assimilation to perform target ocean circulation model calculation in the optimized global ocean environment forecast system to achieve ocean environment forecast may include:

[0180] When the optimized global ocean environment forecast system performs target ocean circulation model calculation, the target main program and the file output program are run in parallel through the parallel mode of MPMD, and the data stream of the ocean environment forecast data after the data assimilation is processed in parallel to realize the ocean environment forecast;

[0181] Among them, the target main program includes multiple forecast operation processes, the file output program includes multiple file output processes, the number of the file output processes is less than the number of forecast operation processes, each file output process corresponds to multiple forecast operation processes, the multiple forecast operation processes are used to parallelly process the data stream of the marine environment forecast data after the data assimilation, and the file output process is used to receive the calculation results of the multiple forecast operation processes corresponding to itself, and perform single file output or parallel multiple file output.

[0182] For example, the target main program is a NEMO main program, the NEMO main program includes multiple NEMO processes, the file output program includes multiple file output processes, the number of the file output processes is less than the number of NEMO processes, each file output process corresponds to multiple NEMO processes, the multiple NEMO processes are used to perform parallel processing on the data stream of the marine environment forecast data after the data assimilation, and the file output process is used to receive the calculation results of the multiple NEMO processes corresponding to itself, and perform single file output or parallel multiple file output.

[0183] MPMD stands for Multiple Program Multiple Data, which allows different processors to run different copies of a program and process different data sets at the same time. This approach provides a high degree of flexibility and can allocate computing resources according to the characteristics and requirements of each subtask.

[0184] like Figure 6 As shown, taking the file output program as the XIOS_Server program as an example, the data output is transferred to a dedicated process through the parallel method of MPMD (running the NEMO main program and the XIOS_Server program in parallel at the same time), which reduces the file output volume and facilitates the customization of the output variables.

[0185] After the overall optimization of the above steps, the performance optimization analysis results show that, based on the test performance of 1000 processes, the running time of the program is calculated when the number of parallel applications is 2000 and 4800. After testing, when the number of processes is 1000, the program running time is 47 minutes; when the number of processes is 2000, the program runs for 26 minutes, the performance acceleration ratio reaches 1.81X, and the parallel efficiency reaches 90%; when the number of processes is 4800, the program runs for only 17 minutes, the performance acceleration ratio reaches 2.76X, and the parallel efficiency reaches 58%. Start XIOS on the computer device, remove all land points, and use parallel output, and test them separately. XIOS improves the overall efficiency of the system by about 10%; after removing all land points, the efficiency is improved to 18%; using parallel file output, the maximum improvement is 15%.

[0186] At the same time, the application program in the embodiment of the present application has good scalability, and the running time is significantly shortened as the number of processes gradually increases. Compared with 2000 processes, when 4000 processes are used, the running time can be further shortened, and the acceleration ratio reaches 1.53 times. When 4800 processes are used, 17 minutes are used, and the program running time is effectively reduced, so that the NEMO ocean circulation model meets the actual business needs in terms of timeliness.

[0187] High-resolution global ocean environment forecast models contain delicate and complex physical processes, and high-performance computers and large-scale parallel computing are one of the development trends of numerical models. The NEMO ocean circulation model is the latest model framework for ocean seasonal prediction and climate research. The huge amount of data and calculation requires that the computing efficiency must be improved through optimized parallel computing. In the embodiments of the present application, reasonable code performance optimization, grid optimization, dynamic load balancing and parallel optimization design are used. In a supercomputing environment, through the parallel optimization of the EMO ocean circulation model, computing resources are more reasonably applied, good optimization efficiency and acceleration ratio are obtained, and the needs of businessization are met.

[0188] The above describes a computing resource-based performance optimization method in an embodiment of the present application. The following introduces a computing resource-based performance optimization device (such as a server) that executes the above computing resource-based performance optimization method.

[0189] In order to facilitate better implementation of the performance optimization method based on computing resources provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above-mentioned performance optimization method based on computing resources. The meanings of the terms are the same as those in the above-mentioned performance optimization method based on computing resources, and the specific implementation details can refer to the description in the method embodiment.

[0190] See also Figure 7 , Figure 7 A schematic diagram of the structure of a computing resource-based performance optimization device provided in an embodiment of the present application, wherein the computing resource-based performance optimization device 700 may include a code optimization module 701, a data acquisition module 702, a grid optimization module 703, a data assimilation module 704, and a forecast module 705, wherein:

[0191] A code optimization module is used to optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model;

[0192] A data acquisition module is used to acquire the marine environment forecast data required for marine environment forecast;

[0193] The grid optimization module is used to optimize the grid division method in the optimized ocean circulation model code to determine the optimized global ocean environment forecast system;

[0194] A data assimilation module, used for performing data assimilation on the marine environment forecast data under the target ocean circulation mode to obtain the marine environment forecast data after data assimilation;

[0195] The forecast module is used to use the ocean environment forecast data after the data assimilation to perform target ocean circulation model calculation in the optimized global ocean environment forecast system to achieve ocean environment forecast.

[0196] In one embodiment of the present application, the target ocean circulation pattern is the NEMO ocean circulation pattern;

[0197] The code optimization module is specifically used for:

[0198] Optimizing the compilation options of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the code after the compilation options are optimized;

[0199] Use a preset performance analysis tool to locate the hotspot function in the code after the compilation option optimization, wherein the hotspot function is a function whose operation time is preset in the NEMO ocean circulation mode;

[0200] In the code optimized by the compilation option, performing algorithm optimization on the hotspot function to obtain the algorithm optimized code;

[0201] Performing single instruction multiple data flow optimization on the algorithm-optimized code to achieve automatic code vectorization and obtain automatically vectorized code;

[0202] The temporary array storing the intermediate results in the vectorized code is reconstructed into a subroutine storing the intermediate results, so as to obtain the optimized ocean circulation model code under the target ocean circulation model, and the subroutine is used to call when the corresponding intermediate results are needed in the loop.

[0203] In one embodiment of the present application, the code optimization module is specifically used for:

[0204] Adjust and modify the code of the hotspot function to reduce the number of hotspot function loops, optimize the data structure of the hotspot function, simplify the judgment logic of the hotspot function, or reduce unnecessary conditional branches related to the hotspot function;

[0205] Adjust and modify the code of the hotspot function to reduce unnecessary calls in the hotspot function;

[0206] The code of the hotspot function is adjusted and modified to reduce the use of variables in the hotspot function and optimize the use of local variables and global variables in the hotspot function.

[0207] In one embodiment of the present application, the code optimization module is specifically used for:

[0208] The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option enabling the highest optimization level so that the compiler generates the highest instruction set supported by the current processor;

[0209] The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option that enables interprocedural optimization, so as to achieve interprocedural optimization between compilation optimization enabled files, and enable the compiler to perform inline function expansion on functions defined in separate files;

[0210] For the ocean circulation model code of the global marine environment forecast system under the target ocean circulation model, the floating point division of the NEMO ocean circulation model is optimized using the optimized floating point division compilation option to convert the division into the form of multiplication of the inverse number for calculation.

[0211] In one embodiment of the present application, the code optimization module is specifically used for:

[0212] If the code after the algorithm optimization includes a first dynamic array and a second dynamic array, and the compiler cannot determine whether the first dynamic array and the second dynamic array have data dependency, it is determined that the first dynamic array and the second dynamic array cannot implement code automatic vectorization;

[0213] Splitting the code statements that the first dynamic array and the second dynamic array depend on into two loops, so that each loop meets the automatic vectorization condition, so as to realize the automatic vectorization of the first dynamic array and the second dynamic array;

[0214] If the target pointer is used as a temporary array in the code after the algorithm optimization, the target pointer is converted into a dynamic array to achieve automatic vectorization of the target pointer.

[0215] In one embodiment of the present application, the grid optimization module is specifically used to:

[0216] In the optimized ocean circulation model code, set the global ocean circulation grid space;

[0217] Establishing a parallel computing grid block matrix in the global ocean circulation grid space;

[0218] Removing all land calculation blocks in the grid block matrix, and marking adjacent ocean calculation blocks in the grid block matrix as adjacent, to obtain a first grid space;

[0219] The grid resolution of the first grid space is optimized through a grid refinement control strategy to achieve a higher resolution for grids near the land coastline and a lower resolution for grids in the open ocean, so as to determine an optimized global ocean environment forecasting system.

[0220] In one embodiment of the present application, the optimized global marine environment forecast system includes a target main program and a file output program;

[0221] The forecast module is specifically used for:

[0222] When the optimized global ocean environment forecast system performs target ocean circulation model calculation, the target main program and the file output program are run in parallel through the parallel mode of MPMD, and the data stream of the ocean environment forecast data after the data assimilation is processed in parallel to realize the ocean environment forecast;

[0223] Among them, the target main program includes multiple forecast operation processes, the file output program includes multiple file output processes, the number of the file output processes is less than the number of forecast operation processes, each file output process corresponds to multiple forecast operation processes, the multiple forecast operation processes are used to parallelly process the data stream of the marine environment forecast data after the data assimilation, and the file output process is used to receive the calculation results of the multiple forecast operation processes corresponding to itself, and perform single file output or parallel multiple file output.

[0224] Compared with the prior art, in an embodiment of the present application, the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized to obtain the optimized ocean circulation model code under the target ocean circulation model; the ocean environment forecast data required for the ocean environment forecast is obtained; the grid division method in the optimized ocean circulation model code is grid optimized to determine the optimized global ocean environment forecast system; the ocean environment forecast data is data assimilated under the target ocean circulation model to obtain the assimilated ocean environment forecast data; the assimilated ocean environment forecast data is used to perform the target ocean circulation model operation in the optimized global ocean environment forecast system to realize the ocean environment forecast. Since the embodiment of the present application first optimizes the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, and on this basis performs grid optimization and data assimilation on the target ocean circulation model, and uses the ocean environment forecast data after the data assimilation to perform target ocean circulation model operations to achieve ocean environment forecasting, the present application improves the computing efficiency of the global ocean environment forecast model under the existing computing resources by means of performance optimization, can more reasonably apply computing resources, obtain good optimization efficiency and acceleration ratio, and better match business needs.

[0225] The present application also provides a server, such as Figure 8 As shown, it shows a schematic diagram of the structure of the server involved in the embodiment of the present application, specifically:

[0226] The server may include one or more processing core processors 801, one or more computer-readable storage media memories 802, a power supply 803, an input unit 804 and other components. Those skilled in the art will appreciate that Figure 8The server structure shown in the figure does not constitute a limitation on the server, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:

[0227] The processor 801 is the control center of the server, and uses various interfaces and lines to connect various parts of the entire server. By running or executing software programs and / or modules stored in the memory 802, and calling data stored in the memory 802, the processor 801 performs various functions of the server and processes data, thereby monitoring the server as a whole. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operation storage medium, user interface and application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 801.

[0228] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and data processing by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating storage medium, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.

[0229] The server also includes a power supply 803 for supplying power to each component. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management storage medium, so as to manage charging, discharging, and power consumption through the power management storage medium. The power supply 803 can also include any components such as one or more DC or AC power supplies, recharge storage media, power failure detection circuits, power converters or inverters, and power status indicators.

[0230] The server may further include an input unit 804, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0231] Although not shown, the server may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 801 in the server will load the executable files corresponding to the processes of one or more application programs into the memory 802 according to the following instructions, and the processor 801 will run the application programs stored in the memory 802, thereby realizing various functions, as follows:

[0232] Optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model;

[0233] Obtain the marine environment forecast data required for marine environment forecast;

[0234] The grid division method in the optimized ocean circulation model code was optimized to determine the optimized global ocean environment forecast system;

[0235] Performing data assimilation on the marine environment forecast data under the target ocean circulation model to obtain the marine environment forecast data after data assimilation;

[0236] The ocean environment forecast data after data assimilation is used to perform target ocean circulation model calculations in an optimized global ocean environment forecast system to achieve ocean environment forecasting.

[0237] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0238] To this end, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in any one of the performance optimization methods based on computing resources provided in the embodiments of the present application. For example, the computer program can be loaded by a processor to execute the following steps:

[0239] Optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model;

[0240] Obtain the marine environment forecast data required for marine environment forecast;

[0241] The grid division method in the optimized ocean circulation model code was optimized to determine the optimized global ocean environment forecast system;

[0242] Performing data assimilation on the marine environment forecast data under the target ocean circulation model to obtain the marine environment forecast data after data assimilation;

[0243] The ocean environment forecast data after data assimilation is used to perform target ocean circulation model calculations in an optimized global ocean environment forecast system to achieve ocean environment forecasting.

[0244] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0245] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0246] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0247] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0248] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0249] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can 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 can be stored in a computer-readable storage medium.

[0250] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0251] The computer program product includes one or more computer instructions. When the computer program is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0252] The technical solutions provided in the embodiments of the present application are introduced in detail above. The principles and implementation methods of the embodiments of the present application are explained by using specific examples in the embodiments of the present application. The description of the above embodiments is only used to help understand the methods and core ideas of the embodiments of the present application. At the same time, for those skilled in the art, according to the ideas of the embodiments of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the embodiments of the present application.

Claims

1. A performance optimization method based on computing resources, characterized in that: The method comprises: Optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model; Obtain the marine environment forecast data required for marine environment forecast; The grid division method in the optimized ocean circulation model code was optimized to determine the optimized global ocean environment forecast system; Performing data assimilation on the marine environment forecast data under the target ocean circulation model to obtain the marine environment forecast data after data assimilation; The ocean environment forecast data after data assimilation is used to perform target ocean circulation model calculations in an optimized global ocean environment forecast system to achieve ocean environment forecasting.

2. The performance optimization method based on computing resources according to claim 1, characterized in that: The performance optimization of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is performed to obtain the optimized ocean circulation model code under the target ocean circulation model, including: Optimizing the compilation options of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the code after the compilation options are optimized; Use a preset performance analysis tool to locate the hotspot function in the code optimized by the compilation option, wherein the hotspot function is a function with a previously preset calculation time consumption under the target ocean circulation mode; In the code optimized by the compilation option, performing algorithm optimization on the hotspot function to obtain the algorithm optimized code; Performing single instruction multiple data flow optimization on the algorithm-optimized code to achieve automatic code vectorization and obtain automatically vectorized code; The temporary array storing the intermediate results in the vectorized code is reconstructed into a subroutine storing the intermediate results, so as to obtain the optimized ocean circulation model code under the target ocean circulation model, and the subroutine is used to call when the corresponding intermediate results are needed in the loop.

3. The performance optimization method based on computing resources according to claim 2, characterized in that: The algorithm optimization of the hotspot function includes the following items: Adjust and modify the code of the hotspot function to reduce the number of hotspot function loops, optimize the data structure of the hotspot function, simplify the judgment logic of the hotspot function, or reduce unnecessary conditional branches related to the hotspot function; Adjust and modify the code of the hotspot function to reduce unnecessary calls in the hotspot function; The code of the hotspot function is adjusted and modified to reduce the use of variables in the hotspot function and optimize the use of local variables and global variables in the hotspot function.

4. The performance optimization method based on computing resources according to claim 2, characterized in that: The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized by compiling options to obtain the code after compiling option optimization, including the following items: The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option enabling the highest optimization level so that the compiler generates the highest instruction set supported by the current processor; The ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model is optimized using a compilation option that enables interprocedural optimization, so as to achieve interprocedural optimization between compilation optimization enabled files, and enable the compiler to perform inline function expansion on functions defined in separate files; For the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model, the floating point division of the target ocean circulation model is optimized using the optimized floating point division compilation option to convert the division into the form of multiplication and reciprocal for calculation.

5. The performance optimization method based on computing resources according to claim 2, characterized in that: The performing single instruction multiple data flow optimization on the algorithm-optimized code to realize automatic code vectorization to obtain the automatically vectorized code includes: If the code after the algorithm optimization includes a first dynamic array and a second dynamic array, and the compiler cannot determine whether the first dynamic array and the second dynamic array have data dependency, it is determined that the first dynamic array and the second dynamic array cannot implement code automatic vectorization; Splitting the code statements that the first dynamic array and the second dynamic array depend on into two loops, so that each loop meets the automatic vectorization condition, so as to realize the automatic vectorization of the first dynamic array and the second dynamic array; If the target pointer is used as a temporary array in the code after the algorithm optimization, the target pointer is converted into a dynamic array to achieve automatic vectorization of the target pointer.

6. The performance optimization method based on computing resources according to claim 1, characterized in that: The grid division method in the optimized ocean circulation model code is optimized to determine the optimized global ocean environment forecast system, including: In the optimized ocean circulation model code, set the global ocean circulation grid space; Establishing a parallel computing grid block matrix in the global ocean circulation grid space; Removing all land calculation blocks in the grid block matrix, and marking adjacent ocean calculation blocks in the grid block matrix as adjacent, to obtain a first grid space; The grid resolution of the first grid space is optimized through a grid refinement control strategy to achieve a higher resolution for grids near the land coastline and a lower resolution for grids in the open ocean, so as to determine an optimized global ocean environment forecasting system.

7. The performance optimization method based on computing resources according to claim 1, characterized in that: The optimized global marine environment forecast system includes the target main program and file output program; The method of using the ocean environment forecast data after data assimilation to perform target ocean circulation model calculation in the optimized global ocean environment forecast system to achieve ocean environment forecast includes: When the optimized global ocean environment forecast system performs target ocean circulation model calculation, the target main program and the file output program are run in parallel through the parallel mode of MPMD, and the data stream of the ocean environment forecast data after the data assimilation is processed in parallel to realize the ocean environment forecast; Among them, the target main program includes multiple forecast operation processes, the file output program includes multiple file output processes, the number of the file output processes is less than the number of forecast operation processes, each file output process corresponds to multiple forecast operation processes, the multiple forecast operation processes are used to parallelly process the data stream of the marine environment forecast data after the data assimilation, and the file output process is used to receive the calculation results of the multiple forecast operation processes corresponding to itself, and perform single file output or parallel multiple file output.

8. A performance optimization device based on computing resources, characterized in that: The device includes: A code optimization module is used to optimize the performance of the ocean circulation model code of the global ocean environment forecast system under the target ocean circulation model to obtain the optimized ocean circulation model code under the target ocean circulation model; A data acquisition module is used to acquire the marine environment forecast data required for marine environment forecast; The grid optimization module is used to optimize the grid division method in the optimized ocean circulation model code to determine the optimized global ocean environment forecast system; A data assimilation module, used for performing data assimilation on the marine environment forecast data under the target ocean circulation mode to obtain the marine environment forecast data after data assimilation; The forecast module is used to use the ocean environment forecast data after the data assimilation to perform target ocean circulation model calculation in the optimized global ocean environment forecast system to achieve ocean environment forecast.

9. A computer device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the performance optimization method based on computing resources as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the performance optimization method based on computing resources as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Ocean forecasting method and ocean forecasting system

    CN116611551A

  • Lightweight shipborne marine environment forecasting method and system and shipborne terminal

    CN117540869A

  • Marine environment forecasting method, system and equipment

    CN118297443A