Quantum mechanical model construction method and system based on GPU cluster and mode awareness

By constructing a pattern-aware quantum mechanical model, the problem of low computational efficiency of EC-MRCI on GPU clusters is solved. It achieves efficient two-electron integration and load balancing, improving the speed and scalability of EC-MRCI computation, and is suitable for the study of complex strongly correlated systems.

CN121211984AActive Publication Date: 2025-12-26COMP NETWORK INFORMATION CENT CHINESE ACADEMY OF SCI
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202511748285.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2025-12-26
Estimated Expiration
2045-11-26

AI Technical Summary

Technical Problem

Existing EC-MRCI methods face challenges in computation on GPU clusters due to irregular memory access and load balancing issues associated with dual-electron integration, resulting in low computational efficiency, especially in parallel computation on large-scale GPU clusters.

Method used

We adopt a GPU cluster-based and pattern-aware quantum mechanical model construction method, and optimize the EC-MRCI computation process by combining a task sampling load prediction mechanism and a three-level load partitioning strategy with systematic computational pattern decomposition and irregular memory access merging (IAM) GPU algorithm.

Benefits of technology

It significantly improves GPU computing efficiency, achieving speed improvements of up to 1-2 orders of magnitude and peak performance improvements of 5x, enhances the scalability of large-scale parallelism, and can efficiently handle dynamic correlation calculations in complex and strongly correlated systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121211984A_ABST
    Figure CN121211984A_ABST
Patent Text Reader

Abstract

The invention discloses a quantum mechanical model construction method and system based on a GPU cluster and mode awareness, and relates to the technical field of data processing. The method comprises the following steps: acquiring a reference state, a single electron integral and a double electron integral of a target chemical system; constructing a Hamiltonian matrix according to the reference state, the single electron integral and the double electron integral, and obtaining the energy of the reference state through diagonalizing the Hamiltonian matrix; excited states are generated according to electron transition of the reference state, the excited states are divided into multiple groups, and each group is shrunk into a shrunk state; constructing a new Hamiltonian matrix according to the reference state, the contraction state, the single electron integral and the double electron integral, and solving an eigenvector corresponding to the minimum eigenvalue of the new Hamiltonian matrix; and constructing a quantum mechanical model for describing the target chemical system according to the eigenvector, the reference state and the contraction state. According to the method, the building efficiency of the quantum mechanical model and the calculation efficiency of the physical property can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method and system for constructing quantum mechanical models based on GPU clusters and pattern awareness. Background Technology

[0002] Accurate calculation of dynamic electronic correlation energies is crucial for understanding key molecular properties in strongly correlated chemical systems, such as transition metal chemistry, photochemical processes, and magnetic molecules. Traditional single-reference methods (e.g., Kohn-Sham Density Functional Theory, KS-DFT; Coupled Cluster Singles and Doubles with Perturbative Triples, CCSD(T)) are insufficient to accurately describe such systems. Multi-reference (MR) methods are typically used to capture dynamic electronic correlations. However, due to the exponential growth of the number of configurations with the number of correlated electrons, MR methods are limited to systems with small active spaces. The Externally Contracted Multi-Reference Configuration Interaction (EC-MRCI) method reduces the number of variational parameters through external contraction approximation and, combined with the Density Matrix Renormalization Group (DMRG) method, holds promise for calculating dynamic correlations in systems with large active spaces. Current research, such as PASCI, extends EC-MRCI computation to multi-GPU clusters, but its parallel computation on GPU clusters still faces the problem of low computational efficiency, especially in the EC-MRCI Hamiltonian matrix element computation, which accounts for more than 80% of the total computation time. 1. Irregular Memory Access to Two-Electron Integrals: In EC-MRCI calculations, access to two-electron integrals exhibits high irregularity. This stems from differences in the excitation modes of the active space between different matrix elements, as well as orbital index permutations caused by Coulomb integration and exchange integration within a single matrix element, resulting in significant jumps in memory access addresses. As shown in the performance analysis of the NVIDIA A100 GPU, this irregular access increases uncoordinated memory access, severely weakens the locality of the L1 cache, and leads to a decrease in effective bandwidth utilization, thereby increasing memory latency and reducing computational throughput.

[0003] 2. Load Balancing Challenges: The computational logic of EC-MRCI matrix elements is complex, making it difficult to accurately predict the execution time of each computational task. This variability stems from: (1) computational differences between different computational modes, such as some modes involving more conditional branches and more inner products; (2) unpredictable factors such as unaligned memory access and instruction pipeline efficiency (affected by branch prediction). These factors lead to huge and unpredictable differences in task load, significantly increasing communication overhead during dynamic task scheduling (such as task stealing), thereby reducing parallel efficiency, especially when scaling to large-scale GPU clusters. Summary of the Invention

[0004] To address the problems encountered by existing EC-MRCI methods when computing on GPU clusters, this invention discloses a method and system for constructing quantum mechanical models based on GPU clusters and pattern awareness, which can improve the efficiency of quantum mechanical model construction and the computational efficiency of physical properties.

[0005] To achieve the above objectives, the technical solution of the present invention includes the following:

[0006] A method for constructing quantum mechanical models based on GPU clusters and pattern awareness, the method comprising: Obtain the reference state, single-electron integral, and two-electron integral of the target chemical system; The Hamiltonian matrix is ​​constructed based on the reference state, single-electron integral, and two-electron integral, and the reference state energy is obtained by diagonalizing the Hamiltonian matrix. Excited states are generated based on electronic transitions from the reference state. The excited states are divided into multiple groups, and each group is contracted into a contracted state. The contraction coefficient during the contraction process is obtained based on the reference state energy, single-electron integral, and two-electron integral. Based on the reference state, contracted state, single-electron integral, and two-electron integral, a new Hamiltonian matrix is ​​constructed, and the eigenvectors corresponding to the minimum eigenvalues ​​of the new Hamiltonian matrix are solved. Based on the eigenvectors, reference state, and contraction state, a quantum mechanical model describing the target chemical system is constructed.

[0007] Furthermore, obtaining the reference state, single-electron integral, and two-electron integral of the target chemical system includes: A multi-configuration reference wavefunction is generated based on the density matrix renormalization group algorithm. Based on Monte Carlo sampling, a complete active space or entanglement-driven genetic algorithm is used to obtain a set of reference states from a multi-configuration reference wavefunction, as well as the single-electron and two-electron integrals of the target chemical system.

[0008] Furthermore, the Hamiltonian matrix is ​​constructed based on the reference state, the single-electron integral, and the two-electron integral, including: The construction of the Hamiltonian matrix is ​​divided into multiple task blocks and distributed equally to each process; Each process obtains the corresponding reference state, single-electron integral, and double-electron integral as input according to its own task block, and calculates the corresponding Hamiltonian matrix element. Using the SLEPc function library and pre-computed Hamiltonian matrix elements, a distributed storage Hamiltonian matrix is ​​constructed.

[0009] Furthermore, based on the electronic transitions of the reference state to generate excited states, the excited states are divided into multiple groups, each group contracting into a contracted state, including: Different types of excitation kernels are generated based on the reference state, and the different types of excitation kernels are evenly distributed to each process to ensure that the difference in the number of excitation states generated by each process is less than a set threshold. Each process generates the final excited state based on its own excited kernel, and calculates the contraction coefficient on the GPU based on the excited state, reference state, single-electron integral, and two-electron integral. Each process shrinks each set of excited states into a contracted state according to the contraction coefficient.

[0010] Furthermore, based on the reference state, the contracted state, the single-electron integral, and the two-electron integral, a new Hamiltonian matrix is ​​constructed, including: Based on the differences in the contracted state or reference state contained in each matrix element, several different types of matrix element patterns are defined; The feature data of each matrix element pattern is obtained in order to build a performance model using the ridge regression algorithm; The construction of the new Hamiltonian matrix is ​​divided into multiple task blocks, and the task blocks are evenly distributed to each process in combination with the performance model, so that the difference in the total prediction time of the tasks contained in each process is less than a set threshold. Each process filters out matrix elements with a value of zero in the task block and forms at least one task queue according to the matrix element pattern. All task queues and the reference states, excited states, contraction coefficients, single-electron integrals, and two-electron integrals required by the tasks are passed into the GPU's video memory. Different GPU kernel functions are called in sequence to execute each task queue to obtain the matrix elements of each task. Based on the matrix elements of all tasks, each process constructs a new Hamiltonian matrix for distributed storage using the SLEPc function library.

[0011] Furthermore, the process of obtaining the matrix elements for each task includes: Obtain the subtasks involved in the task; Based on the computational patterns involved in each subtask, generate a set of several subtasks; Each set of subtasks is assigned sequentially to different threads on the thread block; Each thread obtains the corresponding contraction coefficient, single-electron integral, and two-electron integral based on the reference state or excited state involved in the subtask, and calculates the weighted sum; After calculating all subtasks, sum all weighted sums to obtain the matrix element value corresponding to the task.

[0012] Furthermore, the process of obtaining the computational patterns involved in each subtask includes: Obtain the matrix element pattern corresponding to this subtask; Based on the matrix element mode and the electron occupancy of the excited / reference states, the corresponding sub-modes are obtained; Based on the sub-pattern, the computational pattern involved in the sub-task is obtained; wherein, the computational pattern is generated by merging the contraction state type / reference state type of the sub-pattern and the difference in the occupied orbit of the outer space.

[0013] Furthermore, the process of obtaining the two-electron integral includes: Based on the computation mode of the current subtasks of all threads, find the double-electron integral that all subtasks need to access; All threads work together to transfer the dual-electron integral from the GPU's global memory to shared memory; All threads retrieve the double-electron integral from shared memory when computing their respective subtasks.

[0014] Furthermore, the method also includes: Calculate the expected value of the quantum mechanical model based on different physical operators; Based on this expected value, the physical properties of the target chemical system are obtained; When the physical operator is a position operator, the physical property is the average position of the particle; when the physical operator is a momentum operator, the physical property is the average momentum; when the physical operator is a Hamiltonian operator, the physical property is the ground state energy; when the physical operator is a spin operator, the physical property is spin polarization.

[0015] A quantum mechanical model construction system based on GPU clusters and pattern awareness, the system comprising: The data acquisition module is used to acquire the reference state, single-electron integral, and two-electron integral of the target chemical system. The reference space solving module is used to construct the Hamiltonian matrix based on the reference state, single-electron integral, and two-electron integral, and obtain the reference state energy by diagonalizing the Hamiltonian matrix; The excited state generation module is used to generate excited states based on the electronic transitions of the reference state, divide the excited states into multiple groups, and shrink each group into a contracted state; wherein, the contraction coefficient in the contraction process is obtained based on the reference state energy, single-electron integral and two-electron integral; The excitation space solution module is used to construct a new Hamiltonian matrix based on the reference state, contracted state, single-electron integral, and two-electron integral, and to solve for the eigenvector corresponding to the minimum eigenvalue of the new Hamiltonian matrix. The quantum mechanical model generation module is used to construct a quantum mechanical model describing the target chemical system based on the eigenvectors, reference state, and contraction state.

[0016] Compared with the prior art, the present invention has at least the following beneficial effects.

[0017] 1) Significantly improves GPU computing efficiency: Through systematic computational pattern decomposition and pattern-aware Irregular Access Merge (IAM) GPU algorithms, the bottleneck of irregular access in dual-electron integration in EC-MRCI computation is effectively solved, significantly reducing unmerged memory access and memory latency, and improving GPU computational throughput. Under specific computational modes, speed improvements of up to 1-2 orders of magnitude and peak performance improvements of up to 5x can be achieved.

[0018] 2) Enhanced scalability of massive parallelism: The task sampling-based load prediction mechanism and three-level load partitioning strategy can accurately predict task load and efficiently distribute tasks among thousands of GPU processors, significantly reducing the communication overhead of dynamic scheduling, enabling EC-MRCI computing to be efficiently scaled up to 4000 GPUs.

[0019] 3) Promoting accurate simulation of complex strongly correlated systems: This invention is the first to extend EC-MRCI dynamic electronic correlation calculation to such a large-scale parallel computing, providing a powerful computational tool for studying complex strongly correlated systems (such as macromolecules, catalysts, and photochemical systems) that were previously difficult to handle.

[0020] 4) Reduce development and optimization complexity: By adopting a strategy-oriented design pattern, the general optimization logic is decoupled from the pattern-specific computational details, which effectively reduces the workload required for multiple computational patterns and improves the modularity and reusability of the system. Attached Figure Description

[0021] Figure 1 This is a schematic diagram of the overall process of the system of the present invention.

[0022] Figure 2 This is a schematic diagram illustrating the classification of EC-MRCI calculation modes according to the present invention.

[0023] Figure 3 This is a schematic diagram illustrating the definition of computation modes and computation sub-modes in this invention.

[0024] Figure 4 The IAM algorithm of this invention is designed for sub-computation modes. A schematic diagram illustrating the implementation. Detailed Implementation

[0025] In the following description, the invention will be further described by way of specific embodiments so that those skilled in the art can have a more thorough understanding of the features and advantages of the invention.

[0026] This invention systematically identifies different computational modes in EC-MRCI computation and designs GPU algorithms and load balancing strategies accordingly, thereby significantly improving the efficiency of quantum mechanical model construction and large-scale parallel scalability.

[0027] The present invention provides a method for constructing quantum mechanical models based on GPU clusters and pattern awareness, such as... Figure 1 As shown, the present invention includes the following steps S1 to S5.

[0028] Step S1: Obtain the reference state, single-electron integral, and two-electron integral of the target chemical system.

[0029] The computational process begins with obtaining the system's reference state, single-electron integral, and two-electron integral. To accurately describe the strong correlation effect, the density matrix renormalization group (DMRG) method is employed (Zhen Luo, Yingjin Ma, Xicun Wang, and Haibo Ma. 2018. Externally-Contracted Multireference ConfigurationInteraction Method Using a DMRG Reference Wave Function). J. Chem. TheoryComput. (14, 9 (2018), 4747-4755.) High-quality multi-configuration reference wavefunctions are generated. Subsequently, a reconstructed complete active space based on Monte Carlo sampling (SRCAS) is utilized (Katharina Boguslawski, Konrad HMarti, and Markus Reiher. 2011. Construction of CASCI-type wave functions for very large active spaces). J. Chem. Phys.134, 22 (2011), 224101.) or Entanglement-Driven Genetic Algorithm (EDGA) (Zhen Luo, Yingjin Ma, Chungen Liu, and Haibo Ma. 2017. Efficient Reconstruction of CAS-CI-Type Wave Functions for a DMRG State Using Quantum Information Theory and a Genetic Algorithm). J. Chem. TheoryComput. Wavefunction reconstruction techniques, such as 13,10 (2017), 4699-4710, are used to obtain linear combinations of reference states from multi-configuration reference wavefunctions, as well as single-electron and two-electron integrals of the target chemical system. Finally, a set of reference states is obtained based on the linear combination of reference states.

[0030] Step S2: Construct the Hamiltonian matrix based on the reference state, single-electron integral, and two-electron integral, and obtain the reference state energy by diagonalizing the Hamiltonian matrix.

[0031] Based on the reference state, single-electron integral, and two-electron integral, the Hamiltonian matrix of the reference space is constructed and diagonalized, and its matrix elements are... The calculation is performed according to the Slater-Condon rule. By diagonalizing the matrix, its lowest eigenvalue, i.e., the reference state energy, is obtained. .this This will serve as the zero-order energy benchmark for subsequent perturbation calculations. Indicates a reference state. Represents the Hamiltonian operator. Indicates the reference state number.

[0032] In one embodiment, the present invention constructs the Hamiltonian matrix using a CPU. Specifically, the construction of the Hamiltonian matrix is ​​first divided into multiple task blocks and evenly distributed to each process. Then, each process obtains the corresponding reference state, single-electron integral, and two-electron integral as input based on its own task block, and calculates the corresponding Hamiltonian matrix elements. Finally, the distributed storage Hamiltonian matrix is ​​constructed using the SLEPc function library and the calculated Hamiltonian matrix elements.

[0033] Step S3: Generate excited states based on the electronic transitions of the reference state, divide the excited states into multiple groups, and shrink each group into a contracted state; wherein, the contraction coefficient in the contraction process is obtained based on the reference state energy, single-electron integral and two-electron integral.

[0034] Step S31: Generate different types of excitation kernels based on the reference state, and distribute the different types of excitation kernels equally to each process to ensure that the difference in the number of excitation states generated by each process is less than a set threshold.

[0035] Step S32: Each process generates the final excited state based on its own excited nucleus, and calculates the contraction coefficient on the GPU based on the excited state, reference state, single-electron integral and two-electron integral.

[0036] Specifically, to account for dynamic electronic correlations, excited states are systematically generated. This process is accomplished by exciting one or two electrons from the active space orbital occupied by the reference state to the external space orbital, forming a single or double excited state.

[0037] The contraction coefficient is pre-determined in this invention using first-order perturbation theory. This is based on a single-excitation contraction state. For example ( Shrinkage coefficient, (This is an excited state), and each coefficient is calculated according to the following formula:

[0038] This step fixes the internal structure of each contracted state, greatly reducing the dimensionality of the variational problem.

[0039] Step S33: Each process shrinks each set of excited states into a contracted state according to the contraction coefficient.

[0040] According to the "external contraction" approximation, all excited states with the same active space electron occupancy are contracted into a single "contracted state" (single-excitation contracted state). or This greatly reduces the dimensionality of the problem to be solved.

[0041] The contraction state is constructed based on the external contraction approximation. Its core characteristic is that all excited states belonging to the same contraction state... They have exactly the same electron occupancy in active space; the only difference is the electron orbital they occupy in external space.

[0042] Based on this characteristic, contracted states can be classified according to the excitation method of electrons from the active space to the outer space. Specifically, the classification is based on the spin and number of excited electrons. The contracted states involved in this invention are mainly divided into the following five types, and this classification method is the cornerstone for subsequent matrix element mode division: • Single α-electron excited contraction state An alpha spin electron is excited from the active space into the outer space; • Single β-electron excited contraction state A β spin electron is excited from the active space into the outer space; • Double α-electron excited contraction state Two α spin electrons are excited from the active space into the outer space; • Double β-electron excited contraction state Two β spin electrons are excited from the active space into the outer space; • Mixed αβ electronically excited contraction state An α spin electron and a β spin electron are excited from the active space into the outer space, respectively.

[0043] Step S4: Construct a new Hamiltonian matrix based on the reference state, the contracted state, the single-electron integral, and the two-electron integral, and obtain the eigenvectors by diagonalizing the new Hamiltonian matrix.

[0044] Step S41: Define several different types of matrix element patterns based on the differences in the contracted state or reference state contained in each matrix element.

[0045] This step is responsible for systematically decomposing the EC-MRCI matrix element calculation. Based on the Slater-Condon rule in quantum chemistry and the excitation modes of electrons in active and external spaces, the EC-MRCI matrix element calculation can be decomposed into a series of subtasks with defined matrix element patterns. This invention identifies 45 such subtasks (as shown in the appendix). Figure 2 (As shown) different matrix element modes. Each matrix element mode is defined by the difference and similarity of the electron-occupied orbitals in the left and right vectors. For example, a matrix element mode can be represented as where both the left and right vectors (containing reference or excited states) are excited from the active space by a... Electron and one Electrons are released into external space, and they contain two electrons in the active space. Different occupying orbits without Different occupied orbits (represented as) (Sub-patterns). This decomposition lays the foundation for subsequent targeted GPU algorithm optimization and load prediction, simplifying GPU kernel function calculations by separating the logic of different matrix element patterns.

[0046] Specifically, the definition of matrix element patterns is physically based on the Slater-Condon rule. This rule states that two states... and Hamiltonian matrix elements between The matrix element is non-zero only in three cases: (1) the two states are identical; (2) the two states differ in only one set of spin orbitals; and (3) the two states differ in two sets of spin orbitals. When the number of differing orbitals is greater than 2, the matrix element is always zero.

[0047] This invention applies this rule to the contractile state level. Since all component excited states of the same contractile state have the same active space occupied orbitals, therefore, the matrix element... Whether it is possible for the value to be nonzero depends first on the orbital difference in its active space. If two contracted states... and If the occupied orbital differences in the active space exceed two pairs, then any combination of excited states they contain... The values ​​of all elements will be zero, thus the entire contracted state matrix will also be zero. For example, in Figure 2, the elements with strikethrough lines will be zero. , and According to the aforementioned rules, the matrix element values ​​corresponding to all computational patterns included in these three combinations are always zero. Therefore, this invention eliminates all computational processes involving these three combinations at the algorithmic level.

[0048] Therefore, a "matrix element pattern" can be defined based on the types of the left and right vectors constituting the matrix elements, and the differences in their orbital occupancy in the active space. The orbital differences can be represented as... ,in and These represent the number of differential α and β spin orbitals, respectively. According to the Slater-Condon rule, the total number of differential orbitals cannot exceed two pairs (i.e., four orbitals), therefore... The value cannot exceed 4.

[0049] by Taking a matrix element of type [type] as an example. Since both the left and right vectors are double α-electron excitations, they occupy the same number of orbitals in their active space. According to the Slater-Condon rule, a matrix element can only be non-zero if the difference between their active space orbitals is no more than two pairs. Differences in matrix element values ​​that may result in non-zero values ​​include: • 0α0β: The active space occupies the same orbitals; • 2α0β: The active space has a pair of distinct α-occupied orbitals; • 0α2β: The active space has a pair of distinct β-occupied orbitals; • 2α2β: Each active space has a different pair of α and β occupied orbitals; • 4α0β: The active space has two different pairs of α-occupied orbitals; • 0α4β: The active space has two pairs of different β-occupied orbitals.

[0050] Therefore, only The interactions of this set of contracted states can be classified into the six different matrix element patterns mentioned above. Conversely, the matrix elements of certain combinations are always zero. For example... Since the left vector excites two α electrons and the right vector excites two β electrons, the difference in the orbitals occupied by these electrons in the active space and the outer space must exceed two pairs. Therefore, this type of matrix element does not need to be calculated.

[0051] By considering all possible combinations of contracted and reference states (e.g.) , By conducting similar analyses, this invention ultimately identified a total of 45 matrix element patterns with non-zero computational value.

[0052] In one embodiment, such as Figure 3 As shown, this invention also implements sub-pattern division and merging of computation patterns for the matrix element pattern.

[0053] (1) Computational sub-pattern partitioning based on external space differences After identifying 45 matrix element patterns based on differences in the active space, this invention further subdivides the computation within each pattern, defining "computational sub-patterns." The sub-pattern division is also based on the Slater-Condon rule, but this time the focus is on orbital differences in the outer space. The core principle is that the sum of the number of orbital differences in the active space and the number of orbital differences in the outer space cannot exceed 4 (two pairs).

[0054] This invention uses parentheses () to mark sub-pattern types. (e.g., matrix element pattern) For example, this matrix element pattern has determined that there exists a pair of distinct α-occupied orbitals in the active space (the number of occupied orbital differences is 2). In order to ensure that the total number of occupied orbital differences does not exceed 4, the number of orbital differences in its outer space can only be 0 pairs or 1 pair.

[0055] • If the outer space orbits are exactly the same, the sub-mode is: The total number of orbital differences in the active space is 1 pair, which is non-zero.

[0056] • If there is a pair of distinct α orbitals in outer space, the submode is: The total number of orbital differences, including those in the active space, is 2 pairs, which is non-zero.

[0057] • If there are two different pairs of α orbitals in outer space, the submode is: In addition, the total orbital differences in the active space will reach 3 pairs. According to the Slater-Condon rule, their contribution is always zero, and therefore they do not constitute a valid computational sub-pattern.

[0058] Since both contraction states are double α excitations, there cannot be β electrons in their outer space, so no submodes involving β orbitals will appear.

[0059] Therefore, for This matrix element model, its actual computation is decomposed into and Two sub-patterns.

[0060] This invention defines a complete computational task as a combination of "matrix element pattern + sub-pattern", for example... Through this detailed analysis of all 45 matrix element patterns, the present invention ultimately identified a total of 77 unique computational sub-patterns.

[0061] (2) Merging of computation patterns.

[0062] Writing and optimizing computational code separately for each of the 77 different sub-patterns (especially implementing the kernel on a GPU) is a tedious and inefficient task. Another key innovation of this invention lies in the summarization and merging of these sub-patterns. This invention discovers that the main factor determining the core computational logic and data access methods is the type of the sub-pattern, i.e., the orbital differences in the outer space, while the differences in the active space within the parent matrix element pattern are less relevant. For example, for sub-patterns... Regardless of its parent mode still Their core computations (involving the looping and integration of outer space orbits) follow similar logic. This means they can share the same highly optimized GPU kernel implementation.

[0063] In its implementation, this invention employs a policy-oriented design pattern, decoupling general IAM optimization strategies from pattern-specific computational logic. For example, for matrix element types... ,for The unique sub-pattern development utilizes a GPU kernel based on the IAM GPU algorithm described below. This GPU kernel can be used by matrix element types. Different main modes are reused (i.e.) The different computational parts of each mode are implemented by passing in functors. According to this method, the present invention summarizes a large number of sub-modes (77 types) into a smaller number (17 types) of unique sub-modes for optimization. All sub-modes and the summarized unique sub-modes can be found in the appendix. Figure 2 .

[0064] Step S42: Obtain the feature data of each matrix element pattern to build a performance model using the ridge regression algorithm.

[0065] The key features of the matrix element model include: the number of non-zero matrix elements, memory access entropy, and the time consumed by each task in the EC-MRCI matrix element computation.

[0066] Regarding the time consumption of each task in the EC-MRCI matrix element calculation, this invention first samples the acquired tasks, performs a small amount of actual calculation on different calculation modes of the sampled tasks, and records the calculation time.

[0067] For memory access entropy Its definition is

[0068]

[0069] in Let r be the probability of visiting each row r, and N be the total number of rows visited. It is the frequency of accessing line r.

[0070] Finally, based on the feature data of the matrix element pattern, this invention uses the ridge regression algorithm to establish a performance model.

[0071] Step S43: Divide the construction of the new Hamiltonian matrix into multiple task blocks, and distribute the task blocks equally to each process in combination with the performance model, so that the total prediction time difference of the tasks contained in each process is less than a set threshold.

[0072] This step first predicts the computation time of all tasks within the process based on the performance model, providing a foundation for efficient dynamic load balancing in the future. Then, each process summarizes the predicted computation time of all tasks and uses a greedy algorithm to statically and as evenly as possible distribute all tasks to all processes, completing the initial static load balancing.

[0073] In one embodiment, the present invention implements load balancing among processors using a combination of static and dynamic methods. This load balancing mainly consists of the following:

[0074] • A hybrid static-dynamic load balancing strategy is adopted. Initially, all tasks are relatively evenly distributed to each process according to the aforementioned load balancing module.

[0075] • To address prediction bias while reducing the overhead of dynamic task acquisition, each process's tasks are divided into locally exclusive tasks and shared tasks. Locally exclusive tasks are computed only by the process itself, while shared tasks can be stolen by other processes. When a process completes its locally exclusive task, it attempts to steal a task from a predefined, smaller subset of "neighboring" processes (rather than all other processes). This stealing method reduces communication bottlenecks caused by global stealing. Thanks to the relatively balanced initial static load balancing, this stealing method can still achieve good load balancing.

[0076] • By using CPU multithreading technology, the computation of the current task is overlapped with the prefetching of the input data for the next task (via MPI communication), thus masking communication delays.

[0077] Step S44: Each process filters out matrix elements with a value of zero in the task block and forms at least one task queue according to the matrix element pattern.

[0078] According to the Slater-Condon rule, if the active space occupancy orbital differences between the two states (reference state and contracted state) contained in a matrix element exceed two pairs, the value of that matrix element can be considered 0. This invention calculates the active space occupancy orbital differences between the two states in each matrix element on the GPU, quickly filtering out matrix elements whose values ​​are definitely 0. Then, the remaining matrix elements with non-zero values ​​are grouped according to their matrix element patterns, forming several task queues.

[0079] Step S45: Transfer all task queues and the reference states, excited states, contraction coefficients, single-electron integrals, and two-electron integrals required by the tasks into the GPU's video memory, and sequentially call different GPU kernel functions to execute each task queue to obtain the matrix elements of each task.

[0080] In one embodiment, the present invention utilizes a dynamic load balancing algorithm between GPU blocks to retrieve tasks from the task queue. This dynamic load balancing algorithm between GPU blocks mainly includes the following: • Each GPU Block statically obtains its initial task based on its ID.

[0081] • After calculating the initial task, each Block dynamically retrieves subsequent tasks from the shared task queue through atomic addition operations.

[0082] In one embodiment, the process by which the present invention calculates the matrix elements for each task is as follows: Step S451: Obtain the subtasks involved in the task.

[0083] Step S452: Generate a set of several subtasks based on the computational patterns involved in each subtask.

[0084] In one embodiment, the process of obtaining the computational pattern includes: obtaining the matrix element pattern corresponding to the subtask; obtaining the corresponding sub-pattern based on the matrix element pattern and the electron occupancy of the excited state / reference state; and obtaining the computational pattern involved in the subtask based on the sub-pattern; wherein the computational pattern is generated by merging the contraction state type / reference state type of the sub-pattern and the difference in the occupied orbits in outer space.

[0085] Step S453: Assign each subtask set to different threads on the thread block in sequence.

[0086] In one embodiment, the present invention utilizes a static load balancing algorithm between GPU threads to sequentially distribute each set of subtasks to different threads on a thread block. This static load balancing algorithm between GPU threads mainly includes the following: • Within a single GPU thread block, for finer-grained calculations (such as inner product calculations), since the computational load is relatively uniform under the same calculation mode, static load balancing can be used to achieve load balancing among threads within the same GPU thread block.

[0087] • After all the inner products of a matrix element have been calculated, a GPU thread block-level reduction operation is performed to obtain the final matrix element value.

[0088] Step S454: Each thread obtains the corresponding contraction coefficient, single-electron integral, and two-electron integral based on the reference state or excited state involved in the subtask, and calculates the weighted sum.

[0089] This invention discloses a pattern-aware irregular access merging module for calculating weighted sums. The core of this module lies in solving the irregular memory access problem of two-electron integrals. After identifying the calculation patterns, the IAM algorithm designs targeted optimization methods for each calculation pattern.

[0090] Key idea: Leveraging the characteristic that a large number of computational steps repeatedly access the same two-electron integrator under certain computational patterns. Two-electron integrators typically depend only on different occupied orbitals. By merging accesses to these shared integrators, the efficiency of memory access can be significantly improved.

[0091] Specific embodiments (with) For example, sub-patterns Figure 4 (as shown) The calculation of this weighted sum can be simplified to the formula:

[0092] in, It is a fixed differentially occupied orbital in the active space. It is in outer space Differences occupy the track, They are the same orbital space in outer space. Indicates the number of orbits in outer space.

[0093] Due to fixed Yes, both require dual-electronic integration. and But they will be used for all those with different In the calculation of the index, the IAM algorithm will have the same... Yes, but different Left sagittal contraction coefficient and right sagittal contraction coefficient The calculations are combined and share the same two-electron integral. Therefore, this invention can utilize shared memory to merge accesses to the shared two-electron integral, thereby accelerating access speed. The process of merging accesses to the two-electron integral includes: identifying the two-electron integral that all subtasks need to access based on the calculation mode of all threads' current subtasks; all threads jointly transferring the two-electron integral from the GPU's global memory to shared memory; and all threads retrieving the two-electron integral from shared memory when calculating their corresponding subtasks.

[0094] Furthermore, to accommodate the limited shared memory of GPUs, the IAM algorithm also includes a coefficient matrix. The process is divided into blocks, with each block being processed in a batch (combining one or more blocks). Within a batch, threads are organized into multiple groups, with threads within the same group processing the same tasks. and different This improves computational parallelism. Similar strategies are applied to other sub-patterns.

[0095] In one embodiment, the IAM algorithm calculates the number of dual-electron integrals and shrinkage coefficients that can be accommodated in each batch using the following formula, based on the shared memory size.

[0096]

[0097]

[0098] in, Represent a The number of two-electron integrals included. This indicates the number of two-electron integrals contained in a block, and also the number of blocks contained in a batch. Depending on the matrix pattern, it equals or , This indicates the number of blocks in a batch that have a shrinkage factor. This indicates the number of contraction coefficients contained in a block. This represents the total number of left vector contraction coefficients in a batch. It equals the number of rows of the left vector contraction coefficient multiplied by the number of columns in each row. This represents the total number of right vector contraction coefficients in a batch. This indicates the maximum number of double data items that a GPU hardware's shared memory can contain.

[0099] Step S455: After calculating all subtasks, sum all weighted sums to obtain the matrix element value corresponding to the task.

[0100] Step S46: Based on the matrix elements of all tasks, each process constructs a new Hamiltonian matrix for distributed storage using the SLEPc function library, and solves for the eigenvector corresponding to the smallest eigenvalue of the new Hamiltonian matrix.

[0101] After calculating all matrix elements for each task block, the values ​​of the matrix elements are temporarily stored locally using functions provided by SLEPc. After completing the calculation of all task blocks, distributed storage of the overall Hamiltonian matrix is ​​achieved through MPI communication. After constructing the distributed Hamiltonian matrix, this invention calls the Krylov subspace iteration method provided by SLEPc to solve in parallel for the eigenvectors corresponding to the minimum eigenvalues ​​of the new Hamiltonian matrix.

[0102] Step S5: Based on the eigenvectors, reference state, and contraction state, construct a quantum mechanical model describing the target chemical system.

[0103] After obtaining the eigenvectors, each component of the eigenvectors can be regarded as a linear combination coefficient of the corresponding reference state and contracted state. By linearly superimposing these reference states and contracted states, the quantum mechanical model of the target chemical system can be obtained. .

[0104]

[0105] Among them, the quantum mechanical model The constraints are: , The components of the eigenvector, It is a contracted state or a reference state. This represents the total number of reference states and contracted states.

[0106] Furthermore, in one embodiment, the present invention can also obtain the physical properties of the target chemical system based on the quantum mechanical model of the target chemical system constructed in step S5. The process of obtaining the physical properties includes: calculating the corresponding expected value for the quantum mechanical model according to different physical operators; and obtaining the physical properties of the target chemical system based on the expected value. Specifically, when the physical operator is a position operator, the physical property is the average position of the particle; when the physical operator is a momentum operator, the physical property is the average momentum; when the physical operator is a Hamiltonian operator, the physical property is the ground state energy; and when the physical operator is a spin operator, the physical property is spin polarization.

[0107] In summary, addressing the core challenges of EC-MRCI methods in GPU cluster computing, such as irregular memory access and computational load balancing via dual-electron integration, this invention aims to significantly improve the efficiency, parallel scalability, and overall performance of EC-MRCI computing on large GPU clusters by introducing a systematic decomposition of computational patterns, an innovative Irregular Access Merging (IAM) GPU algorithm, a task sampling-based load prediction mechanism, and a three-level hybrid load balancing and task scheduling strategy.

[0108] This invention systematically decomposes complex matrix element calculations into a finite number of independent computation modes based on the Slater-Condon rule and electronic excitation characteristics. Each mode corresponds to specific computational logic and data access methods.

[0109] This invention, based on an independent computing model, analyzes and reorganizes computational tasks to merge irregular memory accesses to the dual-electron integral. Specifically, it identifies computational portions sharing the dual-electron integral within the computing model and maximizes data reuse through techniques such as data fragmentation and shared memory optimization, reducing non-merged accesses to global memory and improving access speed.

[0110] For each process's assigned portion of tasks, this invention performs a small-scale sampling calculation to collect the actual execution time of these tasks across different computational modes. Based on this sampling data and selected features, and primarily on the computational load of the tasks across different computational modes, each process predicts the execution time of its local tasks. After summarizing the predicted execution times of all processes' local tasks, a greedy algorithm is used to statically distribute all tasks to all processes based on the prediction results, striving for load balancing.

[0111] Based on the aforementioned GPU algorithm and initial load partitioning results, this invention implements a multi-level load partitioning strategy covering inter-processor, inter-thread block within the GPU, and inter-GPU threads to dynamically adapt to load changes during the computing process and ensure efficient utilization of computing resources.

[0112] After each process completes its assigned computational task, the present invention summarizes the obtained matrix element results, finally constructs a complete new Hamiltonian matrix, and solves for the eigenvector corresponding to the lowest eigenvalue of the new Hamiltonian matrix.

[0113] This invention, leveraging its ability to efficiently process dynamic electron correlations on large GPU clusters, provides a powerful computational tool for in-depth research into the complex behavior of various strongly correlated electronic systems, and has broad application prospects in fields such as quantum chemistry, condensed matter physics, and materials science. For example, the system can be efficiently applied to: simulating the catalytic activity and magneto-optical properties of transition metal compounds, providing theoretical support for the design of novel catalysts and magnetic materials; predicting the electronic structure and spectral properties of f-electron systems, aiding in the research of rare-earth permanent magnets and luminescent materials; and simulating the properties of organic conjugated molecules, guiding the development of high-performance organic optoelectronic devices.

[0114] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can make modifications and changes to the above embodiments without departing from the spirit and scope of the invention. Therefore, the scope of protection of the present invention should be as set forth in the claims.

Claims

1. A method for constructing quantum mechanical models based on GPU clusters and pattern awareness, characterized in that, The method includes: Obtain the reference state, single-electron integral, and two-electron integral of the target chemical system; The Hamiltonian matrix is ​​constructed based on the reference state, single-electron integral, and two-electron integral, and the reference state energy is obtained by diagonalizing the Hamiltonian matrix. Excited states are generated based on electronic transitions from the reference state. The excited states are divided into multiple groups, and each group is contracted into a contracted state. The contraction coefficient during the contraction process is obtained based on the reference state energy, single-electron integral, and two-electron integral. Based on the reference state, contracted state, single-electron integral, and two-electron integral, a new Hamiltonian matrix is ​​constructed, and the eigenvectors corresponding to the minimum eigenvalues ​​of the new Hamiltonian matrix are solved. Based on the eigenvectors, reference state, and contraction state, a quantum mechanical model describing the target chemical system is constructed.

2. The method according to claim 1, characterized in that, The acquisition of the reference state, single-electron integral, and two-electron integral of the target chemical system includes: A multi-configuration reference wavefunction is generated based on the density matrix renormalization group algorithm. Based on Monte Carlo sampling, a complete active space or entanglement-driven genetic algorithm is used to obtain a set of reference states from a multi-configuration reference wavefunction, as well as the single-electron and two-electron integrals of the target chemical system.

3. The method according to claim 1, characterized in that, The Hamiltonian matrix is ​​constructed based on the reference state, single-electron integral, and two-electron integral, including: The construction of the Hamiltonian matrix is ​​divided into multiple task blocks and distributed equally to each process; Each process obtains the corresponding reference state, single-electron integral, and double-electron integral as input according to its own task block, and calculates the corresponding Hamiltonian matrix element. Using the SLEPc function library and pre-computed Hamiltonian matrix elements, a distributed storage Hamiltonian matrix is ​​constructed.

4. The method according to claim 1, characterized in that, Excited states are generated based on electronic transitions from the reference state. These excited states are divided into multiple groups, each group contracting into a contracted state, including: Different types of excitation kernels are generated based on the reference state, and the different types of excitation kernels are evenly distributed to each process to ensure that the difference in the number of excitation states generated by each process is less than a set threshold. Each process generates the final excited state based on its own excited kernel, and calculates the contraction coefficient on the GPU based on the excited state, reference state, single-electron integral, and two-electron integral. Each process shrinks each set of excited states into a contracted state according to the contraction coefficient.

5. The method according to claim 1, characterized in that, Based on the reference state, the contracted state, the single-electron integral, and the two-electron integral, construct the new Hamiltonian matrix, including: Based on the differences in the contracted state or reference state contained in each matrix element, several different types of matrix element patterns are defined; The feature data of each matrix element pattern is obtained in order to build a performance model using the ridge regression algorithm; The construction of the new Hamiltonian matrix is ​​divided into multiple task blocks, and the task blocks are evenly distributed to each process in combination with the performance model, so that the difference in the total prediction time of the tasks contained in each process is less than a set threshold. Each process filters out matrix elements with a value of zero in the task block and forms at least one task queue according to the matrix element pattern. All task queues and the reference states, excited states, contraction coefficients, single-electron integrals, and two-electron integrals required by the tasks are passed into the GPU's video memory. Different GPU kernel functions are called in sequence to execute each task queue to obtain the matrix elements of each task. Based on the matrix elements of all tasks, each process constructs a new Hamiltonian matrix for distributed storage using the SLEPc function library.

6. The method according to claim 5, characterized in that, The process of obtaining the matrix elements for each task includes: Obtain the subtasks involved in the task; Based on the computational patterns involved in each subtask, generate a set of several subtasks; Each set of subtasks is assigned sequentially to different threads on the thread block; Each thread obtains the corresponding contraction coefficient, single-electron integral, and two-electron integral based on the reference state or excited state involved in the subtask, and calculates the weighted sum; After calculating all subtasks, sum all weighted sums to obtain the matrix element value corresponding to the task.

7. The method according to claim 6, characterized in that, The process of obtaining the computational patterns involved in each subtask includes: Obtain the matrix element pattern corresponding to this subtask; Based on the matrix element mode and the electron occupancy of the excited / reference states, the corresponding sub-modes are obtained; Based on the sub-pattern, the computational pattern involved in the sub-task is obtained; wherein, the computational pattern is generated by merging the contraction state type / reference state type of the sub-pattern and the difference in the occupied orbit of the outer space.

8. The method according to claim 6, characterized in that, The process of obtaining a two-electron integral includes: Based on the computation mode of the current subtasks of all threads, find the double-electron integral that all subtasks need to access; All threads work together to transfer the dual-electron integral from the GPU's global memory to shared memory; All threads retrieve the double-electron integral from shared memory when computing their respective subtasks.

9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: Calculate the expected value of the quantum mechanical model based on different physical operators; Based on this expected value, the physical properties of the target chemical system are obtained; Specifically, when the physical operator is a position operator, the physical property is the average position of the particle; when the physical operator is a momentum operator, the physical property is the average momentum; when the physical operator is a Hamiltonian operator, the physical property is the ground state energy; and when the physical operator is a spin operator, the physical property is spin polarization.

10. A quantum mechanical model construction system based on GPU clusters and pattern awareness, characterized in that, The system includes: The data acquisition module is used to acquire the reference state, single-electron integral, and two-electron integral of the target chemical system. The reference space solving module is used to construct the Hamiltonian matrix based on the reference state, single-electron integral, and two-electron integral, and obtain the reference state energy by diagonalizing the Hamiltonian matrix; The excited state generation module is used to generate excited states based on the electronic transitions of the reference state, divide the excited states into multiple groups, and shrink each group into a contracted state; wherein, the contraction coefficient in the contraction process is obtained based on the reference state energy, single-electron integral and two-electron integral; The excitation space solution module is used to construct a new Hamiltonian matrix based on the reference state, contracted state, single-electron integral, and two-electron integral, and to solve for the eigenvector corresponding to the minimum eigenvalue of the new Hamiltonian matrix. The quantum mechanical model generation module is used to construct a quantum mechanical model describing the target chemical system based on the eigenvectors, reference state, and contraction state.

Citation Information

Patent Citations

  • Method and device for determining micro-nano-electronic structure

    CN102663149A

  • Hamiltonian quantity simulation method and device for small molecule chemical system

    CN115169565A

  • Molecular energy prediction method and device, equipment and storage medium

    CN117253558A

  • Quantum chemistry Hamiltonian rapid generation method and device based on stability sub-table

    CN120611804A

  • Quantum calculation simulation method of polaritons and related device

    CN120781994A