Verification method and system for scientific calculation hybrid programming model

By analyzing the differences in hybrid programming models for scientific computing and porting hotspot functions, combined with performance analysis and the construction of verification functions, the efficiency and accuracy issues of hybrid programming model verification in existing technologies have been resolved, achieving efficient and accurate discovery of program vulnerabilities and verification of results.

CN121997340APending Publication Date: 2026-05-08COMP NETWORK INFORMATION CENT CHINESE ACADEMY OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
COMP NETWORK INFORMATION CENT CHINESE ACADEMY OF SCI
Filing Date
2026-01-26
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing scientific computing hybrid programming models are difficult to verify efficiently, especially large-scale coupled simulation software where the software code porting workload is large and there is a lack of effective high-precision verification methods.

Method used

By analyzing the differences between the original programming model and the high-performance programming model, initializing physical and computational parameters, using performance analysis tools to identify hot functions, establishing a matching mapping mechanism, porting hot functions, and constructing verification functions for unit testing and integration testing, the verification results are output.

Benefits of technology

It achieves efficient verification of multiple hybrid programming models, can accurately discover program vulnerabilities during the porting process, reduces the workload of recompiling and manually comparing results, supports the verification of multiple programming models, and ensures the accuracy and stability of calculation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121997340A_ABST
    Figure CN121997340A_ABST
Patent Text Reader

Abstract

The invention discloses a verification method and system for a scientific calculation-oriented hybrid programming model, and relates to the technical field of information, and the method comprises the steps: carrying out the difference analysis of an original programming model and a high-performance programming model; performing initialization of physical parameters and calculation parameters and distributed topology on the original programming model; analyzing the original programming model by adopting a performance analysis tool to obtain a hotspot function; establishing a matching mapping mechanism of the original programming model and the high-performance programming model, and performing hotspot function transplantation; and constructing a verification function, carrying out hybrid compiling with the original programming model, respectively carrying out unit testing and integration testing, and outputting to obtain a verification result. Program vulnerabilities in the transplantation process can be found, and the overload workload of a large amount of output data manual comparison results is avoided. The method supports verification of various hybrid programming models, and can be used as an intermediate process method for conversion of two or more kinds of programming to verify correctness of target codes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and more specifically to a verification method and system for a hybrid programming model for scientific computing. Background Technology

[0002] Numerical simulation is a method of simulating real-world physical phenomena using mathematical models and computer technology. It plays a crucial role in scientific research and engineering design, especially in situations difficult to observe or test directly through experiments. The establishment of numerical simulations has significantly promoted the development of scientific computing. However, with the rapid iteration of computer hardware and programming technologies, the original programming models of numerical simulation software can no longer meet the demands of real-world computations. To improve the performance of numerical simulation software, researchers have begun to explore high-performance programming models for application acceleration. However, software code porting is a significant undertaking, especially for large-scale coupled simulation software involving complex call relationships and diverse data structures. Therefore, a compromise solution has been proposed: porting the software's hot-spot functions to improve performance.

[0003] By combining the original programming model of scientific software with a high-performance programming model, the software performance problem was solved. However, achieving high-precision verification of the hybrid programming model became a challenge. Domain professionals can evaluate the correctness of results through data visualization and experience. But when the calculation results are inaccurate, domain professionals need to analyze the algorithm more meticulously and verify the correctness of the hypothesized problem location step by step, a relatively complex process. For those without relevant knowledge, it is difficult to find the core of the problem at the algorithmic level.

[0004] Therefore, how to propose a verification method and system for hybrid programming models for scientific computing and overcome the shortcomings of existing technologies is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] This invention provides a verification method and system for hybrid programming models in scientific computing, enabling efficient verification of multiple hybrid programming models. By analyzing the computational flow and variables involved in the original hotspot functions, new storage space is allocated based on a high-performance programming model for data computation. Simultaneously, to address issues such as variable incompatibility due to syntax differences between different programming models and accurately detecting memory overflow problems during hotspot function migration, the computation results of the high-performance model are transferred to the storage of the original computational model. The computation results of the original model are compared with those of the high-performance programming model, ultimately achieving effective verification of the data results. The testing and verification process is based on the Dongfang supercomputing platform, which can schedule computing resources, implement computational tasks, and conduct verification work according to the type of hybrid programming model involved in the numerical simulation and application requirements. To achieve the above objectives, this invention adopts the following technical solution: A verification method for a hybrid programming model for scientific computing includes: A difference analysis was conducted between the original programming model and the high-performance programming model; Initialize the physical and computational parameters and the distributed topology of the original programming model; The original programming model was analyzed using performance analysis tools to identify hotspot functions. Establish a matching mapping mechanism between the original programming model and the high-performance programming model to port hotspot functions; After porting the hotspot functions, a verification function is built based on the type of the high-performance programming model. Unit tests and integration tests are performed on the verification function, and hybrid compilation is carried out to output the verification results.

[0006] Optionally, the initialization of physical and computational parameters of the original programming model includes: The physical parameters include horizontal wind field, surface temperature, and three-dimensional air temperature, and the calculation parameters include calculation grid point information.

[0007] Optionally, the difference analysis between the original programming model and the high-performance programming model includes: The original programming model is deployed to the supercomputing platform. For the compiler used by the original programming model on the supercomputing platform, the syntax rules of variables and functions in the original programming model are determined. At the same time, the syntax rules of variables and functions of the high-performance programming model on the supercomputing platform are determined.

[0008] Optionally, the distributed topology includes: If the original programming model is an MPI programming model, establish a mapping relationship between the MPI process topology and the computing grid, and perform grid equalization partitioning. If the original programming model is a serial programming model, then a single CPU processor is used to compute the entire grid.

[0009] Optionally, the step of using performance analysis tools to analyze the original programming model and obtain hotspot functions includes: using performance analysis tools to test and analyze the original programming model, identifying hotspot functions as target functions to be ported.

[0010] Optionally, the mechanism for establishing a matching mapping between the original programming model and the high-performance programming model includes: establishing variable and function associations between the original programming model and the high-performance programming model based on their commonalities, and determining unified and unique variable and function identifiers, specifically: ; ; ; in, Represents the original programming model. It is the set of variables in the original programming model. It is a collection of functions from the primitive programming model. This represents a high-performance programming model. It is a set of variables in a high-performance programming model. It is a collection of high-performance programming model functions. This represents the identifier mapping relationship from the original programming model to the high-performance computing programming model.

[0011] Optionally, it also includes: modular management and transformation of hot functions, including: Manage variables involved in hot functions using header files, place C / C++ global variables converted from Fortran in header files to reduce duplicate variable declarations, and gradually port sub-functions involved in hot functions according to functional modules.

[0012] Optionally, construct a verification function, including: If the underlying layer of the high-performance programming model is based on CPU machine instructions, then establish the variable and function relationships between programming models, then port the hot functions, and finally output the calculation results to the memory of the high-performance programming model for comparison. If the high-performance programming model uses non-CPU machine instructions, the original programming model is converted into an intermediate programming model most similar to the high-performance programming model, and then converted into the high-performance programming model. Simultaneously, variable and function relationships are established between the programming models. Using the conversion mechanism, new storage space is allocated based on the high-performance programming model, and the input data of hot functions is transferred to the new space for data computation. The results are then output to the memory space allocated by the intermediate programming model, and the computation results are compared. Specifically: ; ; ; ; ; ; ; ; in, Represents the original programming model. It is the set of variables in the original programming model. It is a collection of functions from the primitive programming model. This represents a high-performance programming model. It is a set of variables in a high-performance programming model. It is a collection of high-performance programming model functions. This represents an intermediate programming model. It is a collection of variables in the intermediate programming model. It is a collection of intermediate programming model functions. Indicates from the original programming model To intermediate programming model The transformation relationship of variable sets, Indicates from the original programming model To intermediate programming model Function set transformation relationship, This indicates variables that are referenced or simplified using an intermediate programming model. This indicates a function that uses an intermediate programming model to reference or rename the original programming model. This represents the identifier mapping relationship from the intermediate programming model to the high-performance computing programming model.

[0013] Optionally, the step of performing unit tests and integration tests separately, performing mixed compilation, and outputting verification results includes: In the initial verification phase, the sub-functions are ported and unit tested. The original sub-functions and their corresponding functions using the high-performance programming model are compiled together, the executable files are submitted, and the real-time running results are viewed. After the sub-functions are ported, integration testing is performed. The original hot functions and their corresponding functions using the high-performance programming model are recompiled, the executable file is submitted, and the real-time running results are viewed.

[0014] Optionally, a verification system for a hybrid programming model for scientific computing includes: a difference analysis module for performing difference analysis on the original programming model and the high-performance programming model; Initialization module: Used to initialize the physical and computational parameters of the original programming model and the distributed topology; Performance Analysis Module: Used to analyze the original programming model using performance analysis tools to identify hot functions; Hotspot function porting module: Used to establish a matching mapping mechanism between the original programming model and the high-performance programming model, and to port hotspot functions; Verification module: After the hotspot function is ported, it is used to build verification functions based on the type of the high-performance programming model. Based on the verification functions, unit tests and integration tests are performed on the sub-functions of the hotspot function, and mixed compilation is performed to output the verification results.

[0015] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a verification method and system for hybrid programming models for scientific computing, which has the following beneficial effects: A verification method for hybrid programming models in scientific computing includes: performing a difference analysis on the original programming model and the high-performance programming model; initializing the physical and computational parameters and distributing the topology of the original programming model; analyzing the original programming model using performance analysis tools to identify hotspot functions; establishing a matching mapping mechanism between the original programming model and the high-performance programming model to port the hotspot functions; after porting the hotspot functions, constructing verification functions based on the type of the high-performance programming model; performing unit tests and integration tests based on the verification functions; performing hybrid compilation; and outputting the verification results. This hybrid programming model verification method is applicable to a wide range of scientific computing applications and engineering, and can efficiently and accurately discover program vulnerabilities during the porting process. Furthermore, compared to the method of outputting the computational results of the original programming model and the high-performance programming model separately for comparison, it reduces the need for recompilation and execution, and avoids the excessive workload of manually comparing large amounts of output data. This invention supports the verification of various hybrid programming models, including but not limited to: hybrid programming of Fortran programming models with heterogeneous programming models (HIP, CUDA, etc.) and Fortran programming models with high-level language programming models (C / C++). This invention supports hybrid verification of distributed programming models (such as MPI) and heterogeneous programming models (HIP, CUDA, etc.), enabling parallel dynamic real-time verification with multiple processes and unlimited iterations, thus laying the foundation for numerical stability in large-scale simulations. This invention can serve as an intermediate method for verifying the correctness of the target by bridging two or more programming conversions. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0017] Figure 1 This is a schematic diagram of a verification method for a hybrid programming model for scientific computing provided by the present invention.

[0018] Figure 2 This is a schematic diagram illustrating the unit test verification of the hybrid programming model of Fortran and HIP provided by this invention.

[0019] Figure 3 This is a schematic diagram illustrating the integrated testing and verification of the hybrid programming model of Fortran and HIP provided by this invention. Detailed Implementation

[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] This invention discloses a verification method for a hybrid programming model for scientific computing, comprising: A difference analysis was conducted between the original programming model and the high-performance programming model; Initialize the physical and computational parameters and the distributed topology of the original programming model; The original programming model was analyzed using performance analysis tools to identify hotspot functions. Establish a matching mapping mechanism between the original programming model and the high-performance programming model to port hotspot functions; After porting the hotspot functions, a verification function is built based on the type of the high-performance programming model. Unit tests and integration tests are performed on the verification function, and hybrid compilation is carried out to output the verification results.

[0022] In a specific implementation, a verification method for a hybrid programming model for scientific computing, wherein the hybrid model includes a computational model involved in original scientific computing and one or more high-performance programming models, includes the following steps: A difference analysis was conducted between the original programming model and the high-performance programming model; The original calculation process was reviewed, including the initialization of the original program, reading the data files initialized from the source code, and initializing the relevant physical parameters and calculation parameters of the scientific computing simulation software. For example, the atmospheric software needs to read the NetCDF files of horizontal wind field, surface, and three-dimensional temperature to initialize the data. Among these, the initialization of physical parameters includes the initialization of information for all computational grid points.

[0023] The original program's distributed topology, if the original program is an MPI programming model, then establishes a Cartesian topology for the MPI processes and manages the process IDs in groups. Performance analysis of the original code program to identify hotspot functions; Establish a matching and mapping mechanism between programming models and high-performance programming models; Modular management of frequently used functions enables rapid code conversion; Write a verification function and establish its flow. Set the number of iterations for the program, perform unit tests and integration tests on the sub-functions of the hot-spot function, complete the mixed compilation, submit the job for execution, and view and verify the output results of the hot-spot function in real time.

[0024] Furthermore, the steps for performing a difference analysis between the original programming model and the high-performance programming model are as follows: For the compiler used in the original code on the supercomputing platform, determine the syntax rules of variables and functions in the original program, and at the same time determine the syntax rules of variables and functions of the high-performance programming model on the supercomputing platform, and analyze the differences in programming languages.

[0025] Specifically, the original code uses Fortran, while the high-performance programming model uses HIP. The two cannot directly access each other. For global variables or functions in a Fortran module, the expression "module_name_mp_variable_name_" is used to represent global variables, and the expression "module_name_mp_function_name_" is used to represent functions. For Fortran subroutine functions, the expression "function_name_" is used to represent the original function. For Fortran local variables, the target language can be used for substitution. For example, the local variable `ws` (of type `real`) in a subroutine can be assigned a new local variable "__device__doublews;" in HIP.

[0026] Furthermore, the distributed topology of the original program is sorted out. If the original program is an MPI programming model, a Cartesian topology of the MPI process is established, and the process numbers are grouped and managed. The grid is divided according to the MPI mapping method. If the original program is a serial programming model, then a single CPU processor is used to compute the entire mesh. If the original program is an MPI programming model...

[0027] Furthermore, the steps for obtaining hotspot functions in the performance analysis source code program are as follows: Use performance analysis tools to test and analyze the original code to identify hotspot functions, and thus determine the target functions to be ported.

[0028] Furthermore, the steps for establishing the matching mapping mechanism between the programming model and the high-performance programming model are as follows: Based on the commonalities between programming models and high-performance programming models, establish the relationships between variables and functions, and determine a unified and unique identifier for variables and functions.

[0029] Furthermore, the steps for modularizing hotspot functions to achieve rapid code conversion are as follows: Manage the variables involved in the hot functions using header files, place the C / C++ global variables converted from Fortran in header files to reduce duplicate variable declarations, and gradually implement portability by classifying the sub-functions involved in the hot functions as functional modules.

[0030] Furthermore, the steps for writing and establishing the verification function are as follows: If the high-performance programming model is based on CPU machine instructions, then the variable and function relationships between programming models are established. Hotspot functions are then ported, and finally, the calculation results are output to the memory of the high-performance programming model for comparison. If the high-performance programming model uses non-CPU machine instructions, it needs to be converted into an intermediate programming model that is most similar to the high-performance programming model. Then, the variable and function relationships between programming models are established. New storage space is allocated based on the high-performance programming model, the input data of the original hotspot functions is transferred to the new space for calculation, and finally, the results are output to the memory space allocated by the intermediate programming model for comparison.

[0031] Furthermore, the steps of setting the number of iterations in the program, performing unit tests and integration tests on the sub-functions of the hotspot function, compiling the hybrid programming model program, submitting the job for execution, and viewing and verifying the output results of the hotspot function in real time include: In the initial verification phase, the sub-functions are ported and unit tested. The original sub-functions and their corresponding functions using the high-performance programming model are compiled together, and the executable files are submitted to view the real-time execution results. After the sub-functions are ported, integration testing is performed. The original hotspot functions and their corresponding functions using the high-performance programming model are recompiled together, and the executable files are submitted to view the real-time execution results.

[0032] This invention proposes a verification method for hybrid programming models in scientific computing, aiming to increase the diversity and versatility of verification methods. This method, from both technical and data perspectives, supports multiple types of hybrid programming models, is easy to operate, and enables real-time verification of data results, thereby ensuring the effectiveness and reliability of the hybrid programming model. This invention can be applied to a wide range of scientific computing software. Taking the correctness verification of porting hotspot functions of atmospheric software from Fortran to HIP as an example: The software dependency environment is configured, the software is deployed to the Eastern Supercomputing Platform, and a difference analysis is performed between the original programming model Fortran and the high-performance programming model HIP; then, the computational flow of the atmospheric software is analyzed, the physical data files initialized in the source code are read, and the relevant physical parameters and computational parameters of the atmospheric software are initialized. The original code was analyzed using gprof to identify the hotspot function `tend_lin`. Furthermore, a matching mapping mechanism was established between the Fortran programming model and the HIP high-performance programming model, using C / C++ as the intermediate conversion programming language. The hotspot function `tend_lin` was modularized, porting the original Fortran programming model to the HIP high-performance programming model. The results of both Fortran and HIP were then stored on the CPU, and verification functions were written to prepare for testing. The software was compiled and run, and unit tests were performed on the sub-function `tend_lin1`, which was split from the hotspot function, with real-time monitoring of the verification results. Unit tests were also performed on the sub-function `tend_lin2`, with real-time monitoring of the verification results. Similar procedures were followed for other sub-functions. These ported sub-functions were merged to reduce redundant allocation and copying of HIP data, and then compiled and run to achieve real-time correctness verification of the hotspot function `tend_lin`.

[0033] In a specific implementation, a verification system for a hybrid programming model for scientific computing includes: a difference analysis module for performing difference analysis on the original programming model and the high-performance programming model; Initialization module: Used to initialize the physical and computational parameters of the original programming model and the distributed topology; Performance Analysis Module: Used to analyze the original programming model using performance analysis tools to identify hot functions; Hotspot function porting module: Used to establish a matching mapping mechanism between the original programming model and the high-performance programming model, and to port hotspot functions; Verification module: After the hotspot function is ported, it is used to build verification functions based on the type of the high-performance programming model. Based on the verification functions, unit tests and integration tests are performed on the sub-functions of the hotspot function, and mixed compilation is performed to output the verification results.

[0034] In a specific implementation, a verification method for hybrid programming models in scientific computing is provided. This method can achieve efficient verification of multiple types of hybrid programming models, including the verification of hybrid programming models of Fortran and C / C++ in a CPU environment, the verification of hybrid programming models of Fortran and HIP / CUDA in a CPU-GPU environment, and the verification of multi-node heterogeneous hybrid programming models of MPI+HIP / CUDA, etc. Figure 1 As shown, a verification method for a hybrid programming model for scientific computing includes: The process includes: software preparation, deployment of the original code to the supercomputing platform, analysis of the differences between the original programming model and the high-performance programming model, initialization of the original program, initial partitioning of the computational grid, analysis of the original code using performance analysis tools to identify hotspot functions, compilation of Fortran code in Dongfang to obtain its underlying variable logic rules, adaptation to C / C++ programming syntax, and then data mapping and transfer to the high-performance programming model code to establish a matching mapping mechanism between the programming model and the high-performance programming model, modular management of hotspot functions, code conversion, writing verification functions, establishing variable comparison verification accuracy logic, using relative error and absolute error methods to ensure the accuracy of the calculation results, establishing a verification process, unit testing and integration testing, and finally verifying the correctness of the results. Specifically, it includes the following steps: Step 1, Software Preparation. Set up the software environment for the original programming language Fortran, the target high-performance programming language (HIP), and their required dependency libraries, in preparation for the deployment of the scientific computing software.

[0035] Step 2: Deploy the original code to the supercomputing platform. Use module load to load the software environment, including the Intel Fortran compiler (iFort version 17.0.520170817) and the HIP compiler (HIP version 5.4.23191). Use the sbatch script to submit the job on the supercomputing platform, scheduling 8 nodes, 30 CPU cores, and 30 DCU accelerator cards. The specific operations for loading the environment are as follows: Module load compiler / intel / 2017.5.239 Module load mpi / intelmpi / 2017.4.239 Module load compiler / cmake / 3.24.1 Module load compiler / rocm / dtk / 23.04 The script for submitting computing resources for a job is as follows: #SBATCH -J practice #assignment_name #SBATCH -p normal #queue name #SBATCH -N 8# Calculate the number of nodes #SBATCH -n 30# Number of CPUs or processes #SBATCH --gres=dcu:4 #4 DCUs per node Step 3: Difference Analysis between the Original Programming Model and the High-Performance Programming Model. For the original code using the Intel ifort compiler on the supercomputing platform and the high-performance programming model using the hipcc compiler, determine the syntax rules for variables and functions in the original program, and simultaneously determine the syntax rules for variables and functions in the high-performance programming model on the supercomputing platform, analyzing the differences in programming languages. Since Fortran and HIP have significant differences in compilation syntax, conversion is required. Because Fortran is a language designed for CPUs and can be compiled into C, while HIP is a C++ extension designed for GPUs with syntax similar to C / C++, C / C++ can be used as the intermediate language for HIP programs to access Fortran variables.

[0036] Step 4, Initialization of the original program. Read the source code initialization data file to initialize the relevant physical parameters and calculation parameters of the scientific computing simulation software, including the initial field temperature and humidity.

[0037] Step 5: Calculate the original mesh partitioning method. If the original program is an MPI programming model, then establish a Cartesian topology for the MPI process, group and manage process IDs, and partition the mesh according to the MPI mapping method.

[0038] The lengths of the 3D mesh are: NX=366, NY=181, NZ=35. At the same time, the YZ direction is partitioned in parallel according to the process topology of 3×10. At this time, the mesh calculation range of process 0 is [1~366]×[1~61]×[1~3], the mesh calculation range of process 1 is [1~366]×[60~120]×[1~3], the mesh calculation range of process 2 is [1~366]×[121~181]×[1~3], and the other processes are divided into meshes in the same way.

[0039] Step 6: Analyze the original code using performance analysis tools to identify hotspot functions. Use the gprof performance analysis tool to perform performance analysis on the scientific computing software, obtaining the number of calls and time percentages of hotspot functions.

[0040] Step 7: Establish a matching mapping mechanism between the programming model and the high-performance programming model. For the target portable code HIP, C / C++ is used as an intermediate conversion programming model to achieve matching mapping between Fortran and HIP. Several scenarios need to be handled when mapping the original Fortran code to C / C++: For global variables or functions in a Fortran module, use the expression "module_module_name_mp_variable_name_" to represent global variables and "module_module_name_mp_function_name_" to represent functions. For Fortrans ubroutine functions, use the expression "function_name_" to represent the original function. For Fortran local variables, simply replace them with the target language's name. For example, a local variable `ws` (of type `real`) in a subfunction can be reassigned as a new local variable in the HIP named "__device__double ws;".

[0041] Step 8, Modular Management of Hotspot Functions. For the sub-functions of the hotspot function, implementation and porting are performed step-by-step, unit by unit. For the involved global variables, variable mapping is performed at the Fortran module level. For example... Figure 2 As shown, for the hotspot calculation function 2, its sub-functions 1, 2, 3, etc. are successively implemented.

[0042] Step 9, Code Conversion. First, convert Fortran to C / C++, establish a mapping mechanism for CPU variables, and then allocate and copy data to the variables of the high-performance programming model according to the storage length and number of CPU variables. The "calculate array variable UT using array variables U and PTU" function in Fortran is mapped to the C / C++ variables Fortran_u, Fortran_ptu, and Fortran_ptu. Then, new array variables d_u, d_ptu, and d_ut are allocated to the high-performance programming model HIP. Then, the data of Fortran_u is copied to d_u, and the data of Fortran_ptu is copied to d_ptu to calculate d_ut. Finally, d_ut is copied to the new C / C++ variable tmp_ut.

[0043] Step 10: Write the verification function. Use the Fortran variable to be verified and its corresponding HIP variable as input parameters to write the verification function. Use the Fortran variable UT from Step 9 and the C / C++ variable tmp_ut output by HIP as parameters of the verification function check_trans_iap_variable, and compare their accuracy. If the function variable error is within 1e-15, it indicates that the code has been correctly ported. This accuracy can be adjusted according to the specific requirements of the application.

[0044] Step 11, establish the verification process. For example... Figure 2 As shown, to verify the correctness of subfunction 1, the ported HIP code is called using calculation function 1 to ensure that the values ​​of the CPU variables and Fortran variables transferred to HIP are consistent. After the calculation of Fortran subfunction 1 (function name trans_iap) and other Fortran functions and the corresponding HIP functions (function name hip_trans_iap_) are completed, the verification function check_trans_iap_variable is called for verification.

[0045] Step 12, Unit Testing. For each sub-function of the hotspot function, perform HIP porting and verify the result variables. At this point, the interface parameters of the ported sub-functions are CPU variables, and the correctness of each ported sub-function is verified in real time. Based on the application requirements, write the sbatch job script, request the required amount of CPU and GPU hardware resources, compile the source code, and perform unit tests.

[0046] Step 13, Integration Testing. (For example...) Figure 3 As shown, for hot functions and their sub-functions, global variables involved in HIP porting are declared and allocated outside the hot functions. At this point, the interface parameters of the ported sub-functions are GPU variables. Finally, the global variables involved in HIP are released, thus optimizing the frequency and number of redundant HIP variable allocations. The source code is recompiled, and integration tests are performed to verify the correctness of the main function and its sub-functions in real time.

[0047] Specifically, this verification technology supports high-precision verification of 1e-15, and enables parallel verification of multiple processes and multiple accelerator cards. It also helps to better manage variables and accelerate the porting process through intermediate programming model conversion, and avoids duplicate declarations through modular management.

[0048] This invention verifies a hybrid programming model on the domestic supercomputing platform Dongfang. This invention provides a verification method for hybrid programming models in scientific computing, enabling efficient verification of multiple types of hybrid programming models. By analyzing the computational flow and variables of the original hotspot functions, new storage space is allocated based on a high-performance programming model for data computation. The computational results of the original model are compared with those of the high-performance programming model, ultimately achieving effective data verification. The testing and verification process is based on the Dongfang supercomputing platform, which can schedule computing resources, implement computational tasks, and conduct verification work according to the type of hybrid programming model involved in the numerical simulation and application requirements.

[0049] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0050] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A verification method for a hybrid programming model for scientific computing, characterized in that, include: A difference analysis was conducted between the original programming model and the high-performance programming model; Initialize the physical and computational parameters and the distributed topology of the original programming model; The original programming model was analyzed using performance analysis tools to identify hotspot functions. Establish a matching mapping mechanism between the original programming model and the high-performance programming model to port hotspot functions; After porting the hotspot functions, a verification function is built based on the type of the high-performance programming model. Unit tests and integration tests are performed on the verification function, and hybrid compilation is carried out to output the verification results.

2. The verification method for a hybrid programming model for scientific computing according to claim 1, characterized in that, The initialization of physical and computational parameters of the original programming model includes: The physical parameters include horizontal wind field, surface temperature, and three-dimensional air temperature, and the calculation parameters include calculation grid point information.

3. The verification method for a hybrid programming model for scientific computing according to claim 1, characterized in that, The difference analysis between the original programming model and the high-performance programming model includes: The original programming model is deployed to the supercomputing platform. For the compiler used by the original programming model on the supercomputing platform, the syntax rules of variables and functions in the original programming model are determined. At the same time, the syntax rules of variables and functions of the high-performance programming model on the supercomputing platform are determined.

4. The verification method for a hybrid programming model for scientific computing according to claim 1, characterized in that, The distributed topology includes: If the original programming model is the MPI programming model, then a Cartesian topology of MPI processes is established, process IDs are grouped and managed, and the grid is divided according to the MPI mapping method. If the original programming model is a serial programming model, then a single CPU processor is used to compute the entire grid.

5. The verification method for a hybrid programming model for scientific computing according to claim 1, characterized in that, The step of using performance analysis tools to analyze the original programming model and obtain hotspot functions includes: using performance analysis tools to test and analyze the original programming model, identifying hotspot functions as target functions to be ported.

6. The verification method for a hybrid programming model for scientific computing according to claim 1, characterized in that, The mechanism for establishing a matching mapping between the original programming model and the high-performance programming model includes: establishing variable and function associations between the two based on the commonalities between the original programming model and the high-performance programming model, and determining unified and unique variable and function identifiers.

7. The verification method for a hybrid programming model for scientific computing according to claim 6, characterized in that, Modular management of hot-topic functions enables code transformation, including: Manage the variables involved in the hot functions using header files, place the C / C++ global variables converted from Fortran in header files to reduce duplicate variable declarations, and gradually port the sub-functions involved in the hot functions.

8. The verification method for a hybrid programming model for scientific computing according to claim 1, characterized in that, Construct the verification function, including: If the underlying layer of the high-performance programming model is based on CPU machine instructions, then establish the variable and function relationships between programming models, then port the hot functions, and finally output the calculation results to the memory of the high-performance programming model for comparison. If the high-performance programming model uses non-CPU machine instructions, the original programming model is converted into an intermediate programming model that is most similar to the high-performance programming model, and then converted into the high-performance programming model. At the same time, the variable and function relationships between the programming models are established. Using the conversion mechanism, new storage space is allocated based on the high-performance programming model. The input data of hot functions is transferred to the new space for data calculation. The results are then output to the memory space allocated by the intermediate programming model, and the calculation results are compared.

9. The verification method for a hybrid programming model for scientific computing according to claim 1, characterized in that, The process involves performing unit tests and integration tests separately, then performing mixed compilation, and outputting verification results, including: In the initial verification phase, the sub-functions are ported and unit tested. The original sub-functions and their corresponding functions using the high-performance programming model are compiled together, the executable files are submitted, and the real-time running results are viewed. After the sub-functions are ported, integration testing is performed. The original hot functions and their corresponding functions using the high-performance programming model are recompiled, the executable file is submitted, and the real-time running results are viewed.

10. A verification system for a hybrid programming model for scientific computing, characterized in that, include: Difference Analysis Module: Used to perform difference analysis between the original programming model and the high-performance programming model; Initialization module: Used to initialize the physical and computational parameters of the original programming model and the distributed topology; Performance Analysis Module: Used to analyze the original programming model using performance analysis tools to identify hot functions; Hotspot function porting module: Used to establish a matching mapping mechanism between the original programming model and the high-performance programming model, and to port hotspot functions; Verification module: After the hotspot function is ported, it is used to build verification functions based on the type of the high-performance programming model. Based on the verification functions, unit tests and integration tests are performed on the sub-functions of the hotspot function, and mixed compilation is performed to output the verification results.