Optimization method and device for large eddy simulation and electronic equipment
By modifying the accuracy type of the hotspot function variable of the large eddy simulation code, the problems of high computational complexity and memory requirements of large eddy simulation are solved, and more efficient computing and lower memory requirements are achieved, which is suitable for handling larger scale and complex flow problems.
Patent Information
- Application Number
- CN202411820446.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-11
AI Technical Summary
Large eddy simulations limit their application when dealing with larger-scale and more complex flow problems due to their high computational complexity and high memory requirements.
By performing performance analysis of the large eddy simulation code, hotspot functions are determined, and the high-precision variable accuracy type is modified to low-precision in these functions, and the code is rerun until the accuracy difference threshold is met.
It significantly reduces the calculation time of large eddy simulation code, improves running speed, reduces memory requirements, adapts to high-performance computing environments, and improves simulation performance.
Smart Images

Figure CN119808623A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computers, and in particular to an optimization method, device and electronic equipment for large eddy simulation. Background Art
[0002] Large eddy simulation is a computational fluid dynamics method used to simulate fluid mechanics problems, mainly used to simulate turbulent phenomena. Fluid mechanics simulations usually involve millions or even billions of computing units. Although large eddy simulations have made significant progress in providing high resolution, physical accuracy, and engineering applications, their high computational complexity has become one of the main challenges limiting their widespread application. In order to make the simulation more accurate, the parameters involved in large eddy simulations usually use high-precision floating-point numbers. The improvement in accuracy is often accompanied by extremely high computing requirements. Therefore, large eddy simulations usually require high-performance computing loads and large-scale memory support. For larger and more complex flow problems, traditional high-precision calculations may lead to memory bottlenecks, limiting the scale and complexity of the simulation. Summary of the invention
[0003] The present disclosure provides an optimization method, device, electronic device and storage medium for large eddy simulation to at least solve the above technical problems existing in the prior art.
[0004] According to a first aspect of the present disclosure, there is provided an optimization method for large eddy simulation, the method comprising: obtaining an initial result of running a large eddy simulation code; performing a performance analysis on the large eddy simulation code to determine the resources consumed by the running of the large eddy simulation code; determining a hotspot function in the large eddy simulation code, the hotspot function being a function whose resource consumption ratio during the running of the large eddy simulation code is higher than a first threshold; modifying the precision type of the variable in the hotspot function from high precision to low precision; re-running the modified large eddy simulation code to obtain an running result; comparing the running result with the initial result to obtain a comparison result, and determining whether the modification of the large eddy simulation code meets the standard according to the comparison result; if the modification of the large eddy simulation code does not meet the standard, re-modifying the precision type of the variable in the hotspot function, and running the modified large eddy simulation code.
[0005] In one possible implementation, the resources include time resources and computing resources, and determining the hotspot functions in the large eddy simulation code includes: determining the time resources and computing resources consumed by the execution of each function in the large eddy simulation code; and determining as a hotspot function a function that consumes time resources greater than a time threshold and consumes computing resources greater than a computing threshold.
[0006] In one possible implementation manner, determining whether the modification of the large eddy simulation code meets the requirements based on the comparison result includes: if the comparison result indicates that the difference in accuracy between the operating result and the initial result satisfies a second threshold, then the modification of the large eddy simulation code meets the requirements; if the comparison result indicates that the difference in accuracy between the operating result and the initial result does not meet the second threshold, then the modification of the large eddy simulation code does not meet the requirements.
[0007] In one embodiment, the method further includes: analyzing the accuracy requirements corresponding to each step of the large eddy simulation to determine steps with high precision requirements and steps with low precision requirements; modifying the precision type of the variables in the code corresponding to the steps with high precision requirements to high precision, and modifying the precision type of the variables in the code corresponding to the steps with low precision requirements to low precision.
[0008] In one possible implementation, after the modification of the large eddy simulation code fails to meet the requirements, the method further includes: for each hotspot function, determining the hotspot sub-functions contained therein, the hotspot sub-functions being sub-functions whose resource consumption ratio during execution is higher than a third threshold; modifying the precision type of the variables in the hotspot sub-function; and re-running the modified large eddy simulation code to obtain the corresponding running results.
[0009] In one embodiment, the method further includes: performing a performance analysis on the modified large eddy simulation code to determine resources consumed by the operation of the modified large eddy simulation code; and determining whether the modified large eddy simulation code meets the requirements based on the consumed resources.
[0010] According to a second aspect of the present disclosure, an optimization device for large eddy simulation is provided, the device comprising: an acquisition module, used to obtain an initial result of the operation of a large eddy simulation code; a first analysis module, used to perform performance analysis on the large eddy simulation code, and determine the resources consumed by the operation of the large eddy simulation code; a first determination module, used to determine a hotspot function in the large eddy simulation code, the hotspot function being a function whose resource consumption ratio during the operation of the large eddy simulation code is higher than a first threshold; a first processing module, used to modify the precision type of the variable in the hotspot function, and change the precision type from high precision to low precision; the first processing module is also used to re-run the modified large eddy simulation code to obtain an operation result; a comparison module, used to compare the operation result with the initial result to obtain a comparison result, and determine whether the modification of the large eddy simulation code meets the standard according to the comparison result; the first processing module is also used to re-modify the precision type of the variable in the hotspot function and run the modified large eddy simulation code if the modification of the large eddy simulation code does not meet the standard.
[0011] In one possible implementation, the resources include time resources and computing resources, and the first determination module is specifically used to determine the time resources and computing resources consumed by the execution of each function in the large eddy simulation code; and determine the function whose consumed time resources are greater than a time threshold and whose consumed computing resources are greater than a computing threshold as a hotspot function.
[0012] In one embodiment, the comparison module is specifically used to: if the comparison result represents that the difference in accuracy between the operating result and the initial result meets the second threshold, then the modification of the large eddy simulation code meets the standard; if the comparison result represents that the difference in accuracy between the operating result and the initial result does not meet the second threshold, then the modification of the large eddy simulation code does not meet the standard.
[0013] In one embodiment, the device also includes: a second analysis module, used to analyze the accuracy requirements corresponding to each step of the large eddy simulation, and determine the steps with high precision requirements and the steps with low precision requirements; a second processing module, used to modify the precision type of the variables in the code corresponding to the steps with high precision requirements to high precision, and modify the precision type of the variables in the code corresponding to the steps with low precision requirements to low precision.
[0014] In one embodiment, the device also includes: a third processing module, which is used to determine, for each hotspot function, the hotspot sub-functions it contains after the modification of the large eddy simulation code does not meet the requirements, and the hotspot sub-functions are sub-functions whose resource consumption ratio during execution is higher than a third threshold; modify the precision type of the variables in the hotspot sub-function; and re-run the modified large eddy simulation code to obtain the corresponding running results.
[0015] In one embodiment, the device also includes: a third analysis module, used to perform performance analysis on the modified large eddy simulation code to determine the resources consumed by the operation of the modified large eddy simulation code; a second determination module, used to determine whether the modified large eddy simulation code meets the standards based on the consumed resources.
[0016] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0020] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0021] The present invention discloses an optimization method, device, electronic device and storage medium for large eddy simulation. The method first obtains the initial result of the large eddy simulation code running, and performs performance analysis on the large eddy simulation code to determine the resources consumed by the large eddy simulation code running; determines the hot spot function in the large eddy simulation code, which is a function in the large eddy simulation code whose resource consumption ratio is higher than a first threshold, modifies the precision type of the variable in the hot spot function from high precision to low precision, and re-runs the modified large eddy simulation code to obtain the running result, and determines whether the modification of the large eddy simulation code meets the standard based on the running result. If not, the precision type of the variable in the hot spot function is modified again until the modification of the large eddy simulation code meets the standard.
[0022] By applying this method, by using a mixed precision algorithm that uses low precision for non-critical calculations and high precision for critical calculations, it is possible to significantly reduce the time consumed by large eddy simulation code calculations while ensuring that the accuracy of the final running results is within an acceptable range, thereby improving the overall running speed and reducing memory requirements. This method can better adapt to high-performance computing environments, effectively improve the performance of large eddy simulations, and facilitate more efficient and accurate use of computing resources when dealing with larger-scale and more complex flow phenomena.
[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0025] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0026] Figure 1 The schematic diagram shows an implementation process of an optimization method for large eddy simulation according to an embodiment of the present disclosure. Figure 1 ;
[0027] Figure 2 The schematic diagram shows an implementation process of an optimization method for large eddy simulation according to an embodiment of the present disclosure. Figure 2 ;
[0028] Figure 3A schematic diagram of a module of an optimization device for large eddy simulation according to an embodiment of the present disclosure is shown;
[0029] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0030] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0031] Figure 1 The schematic diagram shows an implementation process of an optimization method for large eddy simulation according to an embodiment of the present disclosure. Figure 1 ,include:
[0032] Step 101, obtaining the initial results of running the large eddy simulation code.
[0033] Large eddy simulation is a computational fluid dynamics method used to simulate fluid mechanics problems. The calculation process of the large eddy simulation code includes several key steps. First, the physical model of the fluid is defined, and a suitable subgrid model is selected to deal with the influence of small-scale vortices. Then, the grid is generated, the computational domain is divided, and appropriate initial and boundary conditions are set. Then, a suitable time step is selected to ensure numerical stability. The filtered Navier-Stokes equations (NS) are solved to obtain the dynamics of large-scale flow, while considering the influence of small-scale vortices. During the calculation process, the velocity field and pressure field are updated through time advancement and iteration until the preset termination conditions are met. When the preset termination conditions are met, the simulation results obtained are the initial results of the large eddy simulation code. In order to make the simulation results closer to the experimental data, the precision types of the variables involved in the large eddy simulation code are all high-precision.
[0034] Step 102: Perform performance analysis on the large eddy simulation code to determine the resources consumed by the operation of the large eddy simulation code.
[0035] Step 103, determining a hotspot function in the large eddy simulation code, wherein the hotspot function is a function whose resource consumption ratio during the running of the large eddy simulation code is higher than a first threshold.
[0036] The LES code is performance analyzed to determine the resources consumed by the LES code during its execution. The LES code includes multiple functions. The resources consumed by each function during execution are analyzed to determine the proportion of the resources consumed by each function to the total resources consumed by the LES code. Functions with resource consumption ratios higher than a first threshold are identified as hotspot functions. Hotspot functions are mostly functions that are frequently called and take a long time. The LES code can be analyzed using the perf tool to determine the hotspot functions in the LES code.
[0037] Step 104, modify the precision type of the variable in the hotspot function, and change the precision type from high precision to low precision.
[0038] Since the precision types of the variables designed by the LES code are all high-precision, the running process takes a long time and requires more computing resources. High-precision calculations may lead to memory bottlenecks and easily limit the scale and complexity of the simulation. Therefore, for the hot functions in the LES code, the precision types of the variables involved can be modified. Changing the precision type of the variables from high precision to low precision can reduce the memory consumption and computing resources of the LES code running process and improve the running efficiency. Among them, changing the precision type from high precision to low precision can be changing from double-precision floating point numbers to single-precision floating point numbers or from double-precision floating point numbers to half-precision floating point numbers.
[0039] Step 105, re-run the modified large eddy simulation code to obtain the running result.
[0040] Step 106, comparing the running result with the initial result to obtain a comparison result, and determining whether the modification of the large eddy simulation code meets the requirements according to the comparison result.
[0041] After the precision type of the variable in the hotspot function is modified to low precision, the modified large eddy simulation code is re-run to obtain the corresponding operation result. Due to the modification of the variable precision type, the accuracy of the operation result obtained by the large eddy simulation code operation will also change accordingly. Therefore, the operation result of the modified large eddy simulation code is compared with the initial result of the large eddy simulation code before the modification, mainly comparing the accuracy of the operation result and the initial result, to obtain the comparison result, and determine whether the modification of the large eddy simulation code is up to standard based on the comparison result. The present application improves the efficiency of the large eddy simulation operation by reducing the accuracy of the variable, but does not want to reduce the accuracy of the result, so when the comparison result shows that the accuracy of the operation result is acceptable, the modification of the large eddy simulation code is up to standard, and when the comparison result shows that the accuracy of the operation result is unacceptable, the modification of the large eddy simulation code is not up to standard.
[0042] Step 107, if the modification of the LES code does not meet the requirements, the precision type of the variables in the hotspot function is modified again, and the modified LES code is run.
[0043] When it is determined that the modification of the large eddy simulation code does not meet the standards, the variable quota precision type in the hotspot function is modified again. This modification can be made again on the basis of the previous modification, such as changing the precision type of some variables from low precision to high precision, and running the modified large eddy simulation code; new modifications can also be made in the original unmodified large eddy simulation code, such as changing the precision type of some variables from high precision to low precision, and running the modified large eddy simulation code.
[0044] Similarly, after each modification, the modified large eddy simulation code is run to obtain the corresponding running results, and the running results are used to determine whether the modification of the large eddy simulation code meets the standards. This iterative process is repeated until the modified large eddy simulation code meets the standards.
[0045] This application first obtains the initial results of the LES code, performs performance analysis on the LES code, determines the resources consumed by the LES code, determines the hotspot functions in the LES code based on the resources consumed by the LES code, modifies the precision type of the variables in the hotspot functions to reduce the precision of the variables, re-runs the modified LES code to obtain the running results, and determines whether the modification of the LES code meets the standards based on the running results. If not, the LES code is modified again until it meets the standards. By applying this method, by modifying the precision type of the variables and using low precision for non-critical calculations, the calculation time can be significantly reduced while ensuring the accuracy of the final results, the running speed of the LES code can be improved, and the memory requirements of the running process can be reduced, which can better adapt to the high-performance computing environment and promote the research of larger-scale and more complex flow phenomena.
[0046] In one possible implementation, resources include time resources and computing resources, and determining hot spot functions in a large eddy simulation code includes: determining the time resources and computing resources consumed by the execution of each function in the large eddy simulation code; and determining a function whose consumed time resources are greater than a time threshold and whose consumed computing resources are greater than a computing threshold as a hot spot function.
[0047] In the present application, the resources required for the operation of the large eddy simulation code may include time resources and computing resources, such as memory. After the performance analysis of the large eddy simulation code, the time and memory consumed by the operation of the large eddy simulation code can be determined. Since the large eddy simulation includes multiple steps, the large eddy simulation code involves multiple functions, and the time resources and computing resources consumed by each function involved in the large eddy simulation code are determined. The function whose time resources consumed are greater than the time threshold and whose computing resources consumed are greater than the computing threshold is determined as a hotspot function. Or for each function, the proportion of the time resources consumed by the operation to the time resources consumed by the operation of the large eddy simulation code is determined, and the proportion of the computing resources consumed by the operation to the computing resources consumed by the operation of the large eddy simulation code is determined, and the function whose proportion of the time resources consumed to the total time resources consumed by the operation of the large eddy simulation code is greater than the first proportion and the proportion of the computing resources consumed to the total computing resources consumed by the operation of the large eddy simulation code is greater than the second proportion is determined as a hotspot function.
[0048] In one possible implementation, whether the modification of the large eddy simulation code meets the standards is determined based on the comparison result, including: if the comparison result represents that the difference in accuracy between the running result and the initial result meets the second threshold, then the modification of the large eddy simulation code meets the standards; if the comparison result represents that the difference in accuracy between the running result and the initial result does not meet the second threshold, then the modification of the large eddy simulation code does not meet the standards.
[0049] This application improves the running efficiency of the large eddy simulation and reduces the memory requirements by modifying the precision type of the variables in the large eddy simulation code and reducing the precision of the variables. However, reducing the precision of the variables will definitely cause changes in the precision of the running results. In order to ensure the precision of the results of the large eddy simulation, the precision of the running results of the modified large eddy simulation code and the precision corresponding to the initial results of the large eddy simulation code running should be within a certain error range. A second threshold is set, and the running results corresponding to the modified large eddy simulation code are compared with the initial results of the large eddy simulation code running before the modification to obtain the comparison results. When the comparison result represents that the difference in precision between the running results and the initial results meets the second threshold, it is considered that the modification of the large eddy simulation code meets the standard, and the error between the precision of the corresponding results of the modified large eddy simulation code and the precision of the corresponding results of the large eddy simulation code before the modification is within an acceptable range. When the comparison result represents that the difference in precision between the running results and the initial results does not meet the second threshold, it is considered that the modification of the large eddy simulation code does not meet the standard, and the error between the precision of the corresponding results of the modified large eddy simulation code and the precision of the corresponding results of the large eddy simulation code before the modification is not within an acceptable range. The second threshold value can be determined according to actual conditions. For example, the higher the accuracy of the running result of the modified large eddy simulation code is, the smaller the second threshold value can be set.
[0050] In one embodiment, the method also includes: analyzing the accuracy requirements corresponding to each step of the large eddy simulation to determine the steps with high precision requirements and the steps with low precision requirements; modifying the precision type of the variables in the code corresponding to the steps with high precision requirements to high precision, and modifying the precision type of the variables in the code corresponding to the steps with low precision requirements to low precision.
[0051] In order to greatly improve the operation efficiency and reduce resource consumption without affecting the accuracy of the operation results, the large eddy simulation code can be preprocessed first, that is, the accuracy requirements corresponding to each step of the large eddy simulation are analyzed first, and it is determined which steps have high accuracy requirements, that is, high-precision requirements, and which steps can accept low accuracy, that is, low-precision requirements. For example, under normal circumstances, most calculations in the large eddy simulation process have low accuracy requirements, while some key steps, such as vortex calculation or boundary condition processing, have high accuracy requirements. After determining the high-precision requirement steps and low-precision requirement steps, the accuracy type of the variables in the code corresponding to the high-precision requirement steps is modified to high precision, that is, double-precision floating point numbers, and the accuracy type of the variables in the code corresponding to the low-precision requirement steps is modified to low precision, such as single-precision floating point numbers or half-precision floating point numbers.
[0052] Furthermore, the steps with low precision requirements can be further divided into: the precision type of the variables corresponding to the steps with relatively higher precision requirements in the low precision requirements steps is modified to single-precision floating point numbers, and the precision type of the variables corresponding to the steps with relatively lower precision requirements in the low precision requirements steps is modified to half-precision floating point numbers.
[0053] In one possible implementation, Figure 2 As shown, after the modification of the large eddy simulation code does not meet the requirements, the method also includes:
[0054] Step 201, for each hot function, determining the hot sub-functions contained therein, where the hot sub-function is a sub-function whose resource consumption ratio during execution is higher than a third threshold;
[0055] Step 202, modifying the precision type of the variable in the hotspot sub-function;
[0056] Step 203, re-run the modified large eddy simulation code to obtain corresponding operation results.
[0057] After modifying the precision type of the variables in the hotspot function of the large eddy simulation code and running to obtain the running result, if the accuracy corresponding to the running result is not as good as the accuracy of the initial result, the modification of the large eddy simulation code does not meet the standard, and the accuracy of the variables of the hotspot function is low. Therefore, for each hotspot function, determine the multiple sub-functions contained in the hotspot function, analyze the resources consumed by the sub-function during the execution process, and determine the sub-function whose resource consumption ratio is higher than the third threshold as the hotspot sub-function. Specifically, all sub-functions contained in the large eddy simulation code can be analyzed to determine the proportion of resources consumed during the execution of each sub-function to the resources consumed during the execution of the large eddy simulation code, and determine the sub-function whose proportion is higher than the third threshold as the hotspot sub-function; similarly, each hotspot function can also be analyzed to determine the proportion of resources consumed during the execution of each sub-function to the resources consumed during the execution of the hotspot function in which it is located, and determine the sub-function whose proportion is higher than the third threshold as the hotspot sub-function. In both cases, the selection of the third threshold can be determined according to the actual situation, and a larger value can be selected for the third threshold to obtain a higher accuracy of the running result.
[0058] After determining the hotspot sub-function, modify the precision type of the variables in the hotspot sub-function from high precision to low precision, such as changing from double-precision floating point numbers to single-precision floating point numbers or half-precision floating point numbers. The precision types of variables in other sub-functions remain high precision. Re-run the modified large eddy simulation code to obtain the running results. By modifying the precision type of the variables in the sub-function that takes a long time, the running efficiency can be improved and the memory requirement can be reduced without affecting the accuracy of the running results.
[0059] In one embodiment, the method further includes: performing a performance analysis on the modified large eddy simulation code to determine resources consumed by the operation of the modified large eddy simulation code; and determining whether the modified large eddy simulation code meets the requirements based on the consumed resources.
[0060] Perform performance analysis on the modified LES code to determine the resources consumed by the running of the modified LES code, including time resources and computing resources, and judge whether the modified LES code meets the standards based on the consumed resources. The purpose of optimizing the large eddy simulation in the present application is to further reduce the consumption of resources, that is, to improve the efficiency of the large eddy simulation, reduce the time used for calculation, and reduce the memory resources required for calculation, while the accuracy of the large eddy simulation results after optimization is acceptable. Therefore, it is necessary to perform a performance analysis on the modified large eddy simulation code to determine the time consumed and the memory and other resources required for the operation of the modified large eddy simulation code. If the resources consumed by the modified large eddy simulation code have obvious advantages over the resources consumed by the operation of the large eddy simulation code before the modification, it is determined that the modified large eddy simulation code meets the standards; if the resources consumed by the modified large eddy simulation code are more than the resources consumed by the operation of the large eddy simulation code before the modification, it is determined that the modified large eddy simulation code does not meet the standards; if the resources consumed by the operation of the modified large eddy simulation code are slightly less than the resources consumed by the operation of the large eddy simulation code before the modification, it is necessary to judge whether the modified large eddy simulation code meets the standards based on the actual situation, and whether the reduced resource consumption of the operation of the modified large eddy simulation code compared with the operation of the large eddy simulation code before the modification is worth abandoning the accuracy of the operation results.
[0061] Figure 3 A module schematic diagram of an optimization device for large eddy simulation according to an embodiment of the present disclosure is shown.
[0062] See also Figure 3 According to the second aspect of the present disclosure, an optimization device for large eddy simulation is provided, the device comprising: an acquisition module 301, used to obtain the initial result of the large eddy simulation code running; a first analysis module 302, used to perform performance analysis on the large eddy simulation code, and determine the resources consumed by the large eddy simulation code running; a first determination module 303, used to determine the hotspot function in the large eddy simulation code, the hotspot function is a function whose resource consumption ratio during the large eddy simulation code running is higher than a first threshold; a first processing module 304, used to modify the precision type of the variable in the hotspot function, and change the precision type from high precision to low precision; the first processing module 304, is also used to re-run the modified large eddy simulation code to obtain the running result; a comparison module 305, used to compare the running result with the initial result, obtain the comparison result, and determine whether the modification of the large eddy simulation code meets the standard according to the comparison result; the first processing module 304, is also used to re-modify the precision type of the variable in the hotspot function if the modification of the large eddy simulation code does not meet the standard, and run the modified large eddy simulation code.
[0063] In one embodiment, the resources include time resources and computing resources. The first determination module 303 is specifically used to determine the time resources and computing resources consumed by the execution of each function in the large eddy simulation code; and determine the function whose consumed time resources are greater than the time threshold and whose consumed computing resources are greater than the computing threshold as a hotspot function.
[0064] In one embodiment, the comparison module 305 is specifically used to determine whether the modification of the large eddy simulation code meets the requirements if the difference in accuracy between the running result and the initial result represented by the comparison result satisfies a second threshold value; if the difference in accuracy between the running result and the initial result represented by the comparison result does not meet the second threshold value, then the modification of the large eddy simulation code does not meet the requirements.
[0065] In one embodiment, the device also includes: a second analysis module 306, which is used to analyze the accuracy requirements corresponding to each step of the large eddy simulation to determine the steps with high precision requirements and the steps with low precision requirements; a second processing module 307, which is used to modify the precision type of the variables in the code corresponding to the steps with high precision requirements to high precision, and modify the precision type of the variables in the code corresponding to the steps with low precision requirements to low precision.
[0066] In one embodiment, the device also includes: a third processing module 308, which is used to determine, for each hotspot function, the hotspot sub-functions it contains after the modification of the large eddy simulation code does not meet the standards, and the hotspot sub-function is a sub-function whose resource consumption ratio during execution is higher than a third threshold; modify the precision type of the variables in the hotspot sub-function; and re-run the modified large eddy simulation code to obtain the corresponding operation results.
[0067] In one embodiment, the device also includes: a third analysis module 309, which is used to perform performance analysis on the modified large eddy simulation code and determine the resources consumed by the operation of the modified large eddy simulation code; a second determination module 310, which is used to determine whether the modified large eddy simulation code meets the standards based on the consumed resources.
[0068] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0069] Figure 4A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0070] like Figure 4 As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0071] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0072] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as an optimization method for large eddy simulation. For example, in some embodiments, an optimization method for large eddy simulation may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the optimization method for large eddy simulation described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to execute an optimization method for large eddy simulation in any other appropriate manner (for example, by means of firmware).
[0073] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0074] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0075] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0076] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0077] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0078] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0079] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0080] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0081] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. An optimization method for large eddy simulation, characterized in that: The method comprises: Get initial results from a LES code run; Performing a performance analysis on the large eddy simulation code to determine resources consumed by running the large eddy simulation code; Determine a hotspot function in the large eddy simulation code, wherein the hotspot function is a function whose resource consumption ratio during the running of the large eddy simulation code is higher than a first threshold; Modify the precision type of the variable in the hotspot function, changing the precision type from high precision to low precision; Re-run the modified large eddy simulation code to obtain the running results; Comparing the running result with the initial result to obtain a comparison result, and determining whether the modification of the large eddy simulation code meets the standard according to the comparison result; If the modification of the large eddy simulation code does not meet the requirements, the precision type of the variables in the hotspot function is modified again, and the modified large eddy simulation code is run.
2. The method according to claim 1, characterized in that The resources include time resources and computing resources. Determining a hotspot function in the large eddy simulation code comprises: Determining the time resources and computing resources consumed by running each function in the large eddy simulation code; A function that consumes more time resources than a time threshold and consumes more computing resources than a computing threshold is determined as a hotspot function.
3. The method according to claim 1, characterized in that Determining whether the modification of the large eddy simulation code meets the standard according to the comparison result includes: If the comparison result indicates that the difference in accuracy between the running result and the initial result meets a second threshold, the modification of the large eddy simulation code meets the standard; If the comparison result indicates that the difference in accuracy between the running result and the initial result does not meet the second threshold, the modification of the large eddy simulation code does not meet the standard.
4. The method according to claim 1, characterized in that The method further comprises: Analyze the accuracy requirements corresponding to each step of the large eddy simulation to determine the steps with high accuracy requirements and the steps with low accuracy requirements; The precision type of the variable in the code corresponding to the step requiring high precision is modified to high precision, and the precision type of the variable in the code corresponding to the step requiring low precision is modified to low precision.
5. The method according to claim 1, characterized in that After the modification of the large eddy simulation code fails to meet the requirements, the method further comprises: For each hotspot function, determine the hotspot sub-functions contained therein, wherein the hotspot sub-functions are sub-functions whose resource consumption ratio during execution is higher than a third threshold; Modify the precision type of the variable in the hotspot sub-function; Re-run the modified large eddy simulation code to obtain the corresponding running results.
6. The method according to claim 1, characterized in that The method further comprises: Perform performance analysis on the modified LES code to determine the resources consumed by the operation of the modified LES code; Whether the modified large eddy simulation code meets the requirements is determined based on the consumed resources.
7. An optimization device for large eddy simulation, characterized in that: The device comprises: The acquisition module is used to obtain the initial results of the large eddy simulation code run; A first analysis module is used to perform performance analysis on the large eddy simulation code to determine the resources consumed by the operation of the large eddy simulation code; A first determination module is used to determine a hotspot function in the large eddy simulation code, where the hotspot function is a function whose resource consumption ratio during the running of the large eddy simulation code is higher than a first threshold; A first processing module is used to modify the precision type of the variable in the hotspot function, changing the precision type from high precision to low precision; The first processing module is further used to re-run the modified large eddy simulation code to obtain the running result; A comparison module, used for comparing the operation result with the initial result to obtain a comparison result, and determining whether the modification of the large eddy simulation code meets the standard according to the comparison result; The first processing module is also used to re-modify the precision type of the variables in the hotspot function and run the modified large eddy simulation code if the modification of the large eddy simulation code does not meet the requirements.
8. The device according to claim 7, characterized in that The resources include time resources and computing resources, and the first determining module is specifically used to determine the time resources and computing resources consumed by the execution of each function in the large eddy simulation code; A function that consumes more time resources than a time threshold and consumes more computing resources than a computing threshold is determined as a hotspot function.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.
Citation Information
Patent Citations
Configurable resource policies
CA2779993A1
Floating point number display method and apparatus applied to 8-bit single chip microcomputer
CN105183426A