Memory management method for CAE (Computer Aided Engineering) software iterative solution method
By preloading the memory management library and establishing a memory pool when the CAE software starts, and dynamically adjusting the memory pool size, the problem of low memory management efficiency in the iterative solution method of CAE software is solved, and computing performance and development efficiency are improved.
Patent Information
- Application Number
- CN202511234176.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-01
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-09-01
AI Technical Summary
The memory management efficiency of existing CAE software iterative solution methods is low, resulting in poor overall performance. Existing methods have defects such as sparse matrix compression accuracy loss, heterogeneous computing compatibility bottlenecks, asynchronous communication data consistency issues and hardware computing power limitations.
Preload the memory management library when the CAE software starts, establish the front-end central memory pool and the front-end process memory pool, dynamically adjust the central and process memory pools through the memory portrait database, reduce memory allocation and release operations, and optimize memory management.
It improves the memory management efficiency of CAE software, enhances computing performance and development efficiency, and strengthens market competitiveness.
Smart Images

Figure CN120743560A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of CAE software, and in particular provides a memory management method for an iterative solution method of CAE software. Background Art
[0002] Computer-aided engineering (CAE) software (such as ANSYS, COMSOL, and LS-DYNA) is widely used in fields such as structural mechanics, fluid simulation, and electromagnetic analysis. Its computational processes involve large-scale numerical solutions (e.g., finite element method (FEM) and computational fluid dynamics (CFD)), placing extremely high demands on memory management. Iterative solutions (such as the conjugate gradient method (CG), GMRES, and the multigrid method (MG)) require repeated reads and writes to memory, and their memory management efficiency directly impacts computational efficiency and the scale of solvable problems.
[0003] To improve the memory management efficiency of CAE software iterative solution methods, there are several existing solutions: 1. Algorithm optimization, such as mixed-precision storage. However, this approach suffers from precision loss in sparse matrix compression and real-time performance issues in dynamic memory management.
[0004] 2. Hardware acceleration, such as GPU acceleration and new storage media. However, this approach faces the compatibility bottleneck of heterogeneous computing and the reliability risk of new storage media.
[0005] 3. Distributed computing. However, this approach suffers from data consistency issues caused by asynchronous communication and overall performance degradation due to the mathematical complexity of load balancing.
[0006] 4. Emerging technologies, such as AI prediction and quantum hybrid computing. However, AI prediction lacks generalization capabilities, and quantum hybrid computing is limited by hardware computing power.
[0007] Existing methods have a nonlinear relationship between optimization benefits and complexity in engineering practice, and there is a risk of collaborative conflict when multiple methods are used simultaneously. Summary of the Invention
[0008] In order to overcome the above-mentioned defects, the present invention is proposed to provide a solution to the problem of low overall performance of the iterative solution method of CAE software caused by low memory management efficiency.
[0009] The present invention provides a memory management method for CAE software iterative solution method, comprising the steps of: S1: Preload the memory management library when the CAE software starts; S2: During the first iteration of the CAE software, the memory management library is called to allocate memory and establish the front-end central memory pool and the front-end process memory pool; S3: Collect memory profile information during the first iteration and establish a memory profile database; S4: In subsequent iterations of the CAE software, the memory management library establishes a central memory pool based on the memory profile database; S5: Before each iteration of the CAE software begins, a process memory pool is established for each process based on the memory profile database.
[0010] Furthermore, the step S1 specifically includes: When the CAE software is started, the memory management library is loaded through the dynamic link library; Call the initialization function of the dynamic link library to check whether the hardware support and the total amount of system memory meet the minimum requirements. If initialization fails, fall back to the system default allocator and record the log; Register a hook function to forward memory allocation requests to the memory management library.
[0011] Furthermore, establishing the front-end central memory pool includes allocating a continuous large block of memory from the system and reserving the address space, which is divided into fixed-size blocks.
[0012] Furthermore, establishing the front process memory pool includes pre-allocating sub-pools according to the number of processes, and each sub-pool cuts a fixed proportion from the front central memory pool according to the provisions of equal distribution or weighted by process priority.
[0013] Furthermore, the memory portrait information includes the total size of memory allocation, the memory size allocated by each process, and the total size of memory release.
[0014] further, In subsequent iterations of the CAE software, the memory management library establishes a central memory pool based on the total size of memory allocations in the memory profile database; Before each iteration of the CAE software begins, the corresponding memory is allocated from the central memory pool according to the memory size of each process in the memory portrait database, and a process memory pool is established for each process.
[0015] Furthermore, the method further comprises the steps of: After each iteration of the CAE software, it determines whether the total memory requirement of the current iteration is greater than the size of the central memory pool. If so, it triggers the expansion of the central memory pool. If the total memory requirement for the preset number of iterations is less than the preset memory size, the central memory pool is triggered to shrink.
[0016] Furthermore, the method further comprises the steps of: In subsequent iterations of the CAE software, if the memory requirement of the process is greater than the allocated process memory pool size, the expansion of the process memory pool is triggered; If the idle rate of the process memory pool is greater than the preset ratio of the process memory pool for a continuous period of time, the process memory pool is triggered to shrink.
[0017] Furthermore, memory allocation is intercepted in real time in the memory management library so that memory is allocated through the process memory pool. If the process memory pool is insufficient, the size of the process memory pool is dynamically adjusted first. If it still cannot meet the allocation requirements, the size of the central memory pool is dynamically adjusted until the memory allocation is successful.
[0018] Furthermore, the memory management library intercepts memory release in real time, filters out process memory release belonging to the CAE software, and manages the released memory through the central memory pool. After the CAE software is completely solved, the central memory pool memory is returned to the system.
[0019] Working principle and beneficial effects of the present invention: In implementing the technical solution of this invention, a memory statistics database is established by counting memory access behavior during the first iteration of CAE software. Subsequent iterations use this database to dynamically adjust the central memory pool and process memory pool in the memory management library. This reduces memory allocation and release operations between the memory allocation library and the system, reduces memory allocation time, and improves memory management efficiency, thereby enhancing CAE software performance. This efficient memory management method improves CAE software development efficiency and enhances its market competitiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The disclosure of the present invention will be more easily understood with reference to the accompanying drawings. Those skilled in the art will readily appreciate that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. Furthermore, similar numbers in the drawings represent similar components, wherein: Figure 1 The present invention is a flow chart of the main steps of a memory management method for an iterative solution method of CAE software. DETAILED DESCRIPTION
[0021] Some embodiments of the present invention are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0022] Example 1 Figure 1 This is a flow chart of the main steps of a memory management method for CAE software iterative solution method of the present invention. Figure 1 As shown, a memory management method for CAE software iterative solution method in this embodiment mainly includes the following steps S1 to S5.
[0023] Step S1: Preload the memory management library when the CAE software starts.
[0024] In one embodiment, step S1 specifically includes: When the CAE software starts, the memory management library is loaded through a dynamic link library (such as .so on Linux or .dll on Windows) to prepare for calling the memory management interface. Use dlopen (Linux) or LoadLibrary (Windows) to explicitly load the library to avoid implicit dependencies.
[0025] Call the dynamic link library initialization function (such as init_memory_manager()) to check hardware support (such as the need to bind memory nodes for the NUMA architecture) and whether the total system memory meets the minimum requirements (such as 20% of the total physical memory). If initialization fails, fall back to the system default allocator and log it.
[0026] Register a hook function to forward memory allocation requests to the memory management library.
[0027] Step S2: During the first iteration of the CAE software, the memory management library is called to allocate memory and establish a front-end central memory pool and a front-end process memory pool for use in the first iteration process.
[0028] In one embodiment, the steps for establishing the front central memory pool are to allocate a large continuous block of memory from the system (e.g., 10% of the total physical memory), use mmap (Linux) or VirtualAlloc (Windows) to reserve the address space, and divide it into fixed-size blocks (e.g., 4KB aligned) to reduce fragmentation.
[0029] In one embodiment, the step of establishing the front process memory pool is to pre-allocate sub-pools according to the number of processes, and each sub-pool cuts a fixed proportion (such as evenly or weighted by process priority) from the front central memory pool.
[0030] Furthermore, after the first iteration, the destroy_pre_memory_pool() function is called to release all the memory of the pre-central memory pool and the pre-process memory pool to the system to avoid residual memory.
[0031] Step S3: During the first iteration, memory portrait information is collected and a memory portrait database is established.
[0032] In one embodiment, the memory profile information includes the total size of memory allocation, the memory size allocated by each process, and the total size of memory release.
[0033] Step S4: In subsequent iterations of the CAE software, the memory management library establishes a central memory pool based on the total size of memory allocation.
[0034] In one implementation, contiguous physical memory is allocated using mmap / VirtualAlloc to create a central memory pool, supporting large pages to reduce TLB misses. A sentinel value (such as 0xDEADBEEF) is filled in during initialization for leak debugging.
[0035] Furthermore, the central memory pool is divided into multiple regions (e.g., by NUMA nodes), each of which is controlled by an independent manager.
[0036] Step S5: Before each iteration of the CAE software begins, the corresponding memory is allocated from the central memory pool according to the memory size allocated to each process in the memory profile database, and a process memory pool is established for each process.
[0037] Based on the above steps S1 to S5, a memory statistical information database is established by counting the memory access behavior of the first iteration of the CAE software. In subsequent iterative steps, the central memory pool and process memory pool are dynamically adjusted in the memory management library based on this database, reducing memory allocation and release operations between the memory allocation library and the system, thereby improving memory management efficiency.
[0038] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.
[0039] Example 2 Based on the above embodiment 1, it also includes dynamically adjusting the size of the central memory pool and the size of the process memory pool.
[0040] Dynamically adjust the central memory pool size based on the total memory requirements of subsequent CAE software iterations, including: After each iteration, it is determined whether the total memory requirement of the current iteration is greater than the size of the central memory pool. If so, the expansion of the central memory pool is triggered.
[0041] If the total memory requirement for a preset number of iterations is less than the preset memory size (such as 30% of the central memory pool), the central memory pool is triggered to shrink (such as releasing 50% of the central memory pool).
[0042] Dynamically adjust the process memory pool size based on the memory requirements of the process during subsequent CAE software iterations, including: In subsequent iterations of the CAE software, if the memory demand of the process is greater than the allocated process memory pool size, the expansion of the process memory pool is triggered (the corresponding memory is allocated from the central memory pool to the process memory pool).
[0043] If the idle rate of the process memory pool is greater than the preset ratio of the process memory pool (such as 70%) for a continuous period of time, the process memory pool is triggered to shrink (such as reclaiming 50% of the space to the central memory pool).
[0044] Example 3 On the basis of Example 1, it also includes memory allocation and release.
[0045] Memory allocation is intercepted in real time in the memory management library so that memory is allocated through the process memory pool. If the process memory pool is insufficient, the size of the process memory pool is first dynamically adjusted according to the method of Example 2. If the allocation demand is still not met, the size of the central memory pool is dynamically adjusted according to Example 2 until the memory allocation is successful.
[0046] Memory release is intercepted in real time in the memory management library, and memory release by processes belonging to the CAE software is screened out. The released memory is managed through the central memory pool and not returned to the system. The central memory pool memory is returned to the system only after the CAE software has completely solved the problem.
[0047] Thus far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art may make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will fall within the scope of protection of the present invention.
Claims
1. A memory management method for an iterative solution method of CAE software, characterized in that: Including steps: S1: Preload the memory management library when the CAE software starts; S2: During the first iteration of the CAE software, the memory management library is called to allocate memory and establish the front-end central memory pool and the front-end process memory pool; S3: Collect memory profile information during the first iteration and establish a memory profile database; S4: In subsequent iterations of the CAE software, the memory management library establishes a central memory pool based on the memory profile database; S5: Before each iteration of the CAE software begins, a process memory pool is established for each process based on the memory profile database.
2. A memory management method for CAE software iterative solution method according to claim 1, characterized in that: The step S1 specifically includes: When the CAE software is started, the memory management library is loaded through the dynamic link library; Call the initialization function of the dynamic link library to check whether the hardware support and the total amount of system memory meet the minimum requirements. If initialization fails, fall back to the system default allocator and record the log; Register a hook function to forward memory allocation requests to the memory management library.
3. The memory management method for CAE software iterative solution method according to claim 1, characterized in that: Building the front-end central memory pool involves allocating a large contiguous block of memory from the system and reserving the address space, which is divided into fixed-size blocks.
4. The memory management method for CAE software iterative solution method according to claim 1, characterized in that: Establishing the front process memory pool includes pre-allocating sub-pools according to the number of processes, and each sub-pool cuts a fixed proportion from the front central memory pool according to the provisions of equal distribution or weighted by process priority.
5. The memory management method for CAE software iterative solution method according to claim 1, characterized in that: The memory profile information includes the total size of memory allocation, the memory size allocated to each process, and the total size of memory release.
6. The memory management method for CAE software iterative solution method according to claim 5, characterized in that: In subsequent iterations of the CAE software, the memory management library establishes a central memory pool based on the total size of memory allocations in the memory profile database; Before each iteration of the CAE software begins, the corresponding memory is allocated from the central memory pool according to the memory size of each process in the memory portrait database, and a process memory pool is established for each process.
7. The memory management method for CAE software iterative solution method according to claim 1, characterized in that: Also includes the steps: After each iteration of the CAE software, it determines whether the total memory requirement of the current iteration is greater than the size of the central memory pool. If so, it triggers the expansion of the central memory pool. If the total memory requirement for the preset number of iterations is less than the preset memory size, the central memory pool is triggered to shrink.
8. The memory management method for CAE software iterative solution method according to claim 1, characterized in that: Also includes the steps: In subsequent iterations of the CAE software, if the memory requirement of the process is greater than the allocated process memory pool size, the expansion of the process memory pool is triggered; If the idle rate of the process memory pool is greater than the preset ratio of the process memory pool for a continuous period of time, the process memory pool is triggered to shrink.
9. The memory management method for CAE software iterative solution method according to claim 1, characterized in that: Memory allocation is intercepted in real time in the memory management library, so that memory is allocated through the process memory pool. If the process memory pool is insufficient, the process memory pool size is dynamically adjusted first. If it still cannot meet the allocation requirements, the central memory pool size is dynamically adjusted until the memory allocation is successful.
10. The memory management method for CAE software iterative solution method according to claim 1, characterized in that: Memory release is intercepted in real time in the memory management library, and the process memory release belonging to the CAE software is screened out. The released memory is managed through the central memory pool. After the CAE software is completely solved, the central memory pool memory is returned to the system.
Citation Information
Patent Citations
Configuration method and device for built-in system memory pool
CN101937398A
Internal memory dynamic distribution method and system
CN104111892A
Internal memory pool debugging method used in Linux environment
CN107451054A
Embedded software memory management system
CN108132842A
A memory management method and apparatus
CN109522113A