The optimization of tensor expressions with hundreds of terms is required for the development of accurate quantum chemistry models such as the coupled cluster method. In this paper, we address the effective exploitation of symmetry properties of tensors in performing algebraic transformations for minimizing operation count of tensor expressions. We develop rules to detect symmetries in intermediate tensors, cost models for tensor contractions with symmetries, and a canonical representation to facilitate effective common subexpression elimination. We demonstrate significant improvements to the operation counts for the coupled cluster method when compared to several state-of-the-art im-plementations. Furthermore, we show that tensor expressions optimized for a few input parameter combinations can be used to achieve operation counts within 3% of the optimal, for the entire parameter space of interest.
The optimization of tensor expressions with hundreds of terms is required for the development of accurate quantum chemistry models such as the coupled cluster method. In this paper, we address the effective exploitation of symmetry properties of tensors in performing algebraic transformations for minimizing operation count of tensor expressions. We develop rules to detect symmetries in intermediate tensors, cost models for tensor contractions with symmetries, and a canonical representation to facilitate effective common subexpression elimination. We demonstrate significant improvements to the operation counts for the coupled cluster method when compared to several state-of-the-art im-plementations. Furthermore, we show that tensor expressions optimized for a few input parameter combinations can be used to achieve operation counts within 3% of the optimal, for the entire parameter space of interest.
Many computational methods in ab initio quantum chemistry are formulated in terms of high-order tensor contractions, whose cost determines the size of system that can be studied. We introduce stochastic tensor contraction to perform such operations with greatly reduced cost, and present its application to the gold-standard quantum chemistry method, coupled cluster theory with up to perturbative triples. For total energy errors more stringent than chemical accuracy, we reduce the computational scaling to that of mean-field theory, while starting to approach the mean-field absolute cost, thereby challenging the existing cost-to-accuracy landscape. Benchmarks against state-of-the-art local correlation approximations further show that we achieve an order-of-magnitude improvement in both total computation time and error, with significantly reduced sensitivity to system dimensionality and electron delocalization. We conclude that stochastic tensor contraction is a powerful computational primitive to accelerate a wide range of quantum chemistry.
Tensor contractions are ubiquitous in computational chemistry and physics, where tensors generally represent states or operators and contractions express the algebra of these quantities. In this context, the states and operators often preserve physical conservation laws, which are manifested as group symmetries in the tensors. These group symmetries imply that each tensor has block sparsity and can be stored in a reduced form. For nontrivial contractions, the memory footprint and cost are lowered, respectively, by a linear and a quadratic factor in the number of symmetry sectors. State-of-the-art tensor contraction software libraries exploit this opportunity by iterating over blocks or using general block-sparse tensor representations. Both approaches entail overhead in performance and code complexity. With intuition aided by tensor diagrams, we present a technique, irreducible representation alignment, which enables efficient handling of Abelian group symmetries via only dense tensors, by using contraction-specific reduced forms. This technique yields a general algorithm for arbitrary group symmetric contractions, which we implement in Python and apply to a variety of representative contractions from quantum chemistry and tensor network methods. As a consequence of relying on only dense tensor contractions, we can easily make use of efficient batched matrix multiplication via Intel’s MKL and distributed tensor contraction via the Cyclops library, achieving good efficiency and parallel scalability on up to 4096 Knights Landing cores of a supercomputer.
We have developed a symbolic manipulation program and program generator (tensor contraction engine or TCE) that abstracts and automates the time-consuming, error-prone processes of deriving the working equations of a well-defined model of second-quantized many-electron theories and synthesizing efficient parallel computer programs on the basis of these equations. Provided an ansatz of a many-electron theory model, TCE performs valid contractions of creation and annihilation operators according to Wick's theorem, consolidates identical terms, and reduces the expressions into the form of multiple tensor contractions acted upon by permutation operators. It subsequently determines the binary contraction order for each multiple tensor contraction with the minimal operation and memory cost, factorizes common binary contractions (defines intermediate tensors), and identifies reusable intermediates. The resulting ordered list of binary tensor contractions, additions, and index permutations is translated into an optimized program that is combined with the NWCHEM and UTCHEM computational chemistry software packages. The programs synthesized by TCE take advantage of spin symmetry (within the spin−orbital formalisms), real Abelian point-group symmetry, and index permutation symmetry at every stage of the calculations to minimize the number of arithmetic operations and storage requirement, adjust the peak local memory usage by index-range tiling, and support parallel I/O interfaces and dynamic load balancing for parallel executions. We demonstrate the utility of TCE through automatic derivation and implementation of parallel programs for a range of predictive computational methods configuration-interaction theory (CISD, CISDT, CISDTQ), generalized many-body perturbation theory [MBPT(2), MBPT(3), MBPT(4)], and coupled-cluster theory (LCCD, CCD, LCCSD, CCSD, QCISD, CCSDT, and CCSDTQ), some for the first time and discuss the performance of the implemented programs.
The accurate modeling of the electronic structure of atoms and molecules is very computationally intensive.Many models of electronic structure, such as the Coupled Cluster approach, involve collections of tensor contractions.There are usually a large number of alternative ways of implementing the tensor contractions, representing different trade-offs between the space required for temporary intermediates and the total number of arithmetic operations.In this paper, we present an algorithm that starts with an operationminimal form of the computation and systematically explores the possible space-time trade-offs to identify the form with lowest cost that fits within a specified memory limit.Its utility is demonstrated by applying it to a computation representative of a component in the CCSD(T) formulation in the NWChem quantum chemistry suite from Pacific Northwest National Laboratory.
A constant goal of quantum chemistry is devising accurate and computationally effective methods for molecular simulations. In this work an application of tensor decompositions in the context of highly accurate coupled cluster theory, which is often considered a "gold standard", is investigated. The scheme we develop is aimed to mitigate the steep growth of the computational cost with the system size, and hence to overcome the "curse of dimensionality" common in many potent methods in electronic structure. We show how to reduce the computational effort of the restricted coupled cluster with singles and doubles (RCCSD) by two orders of magnitude by introducing alternative parameterizations of the method using "canonical polyad decomposition" (CPD) and "tensor hypercontraction" (THC) formats. After describing CPD and THC formats in detail, we demonstrate how to cast regular index based tensors into a decomposed form. The number of parameters and the accuracy of these representations depend on the expansion length (rank) of the approximation. We investigate the dependence of rank upon the size of the system and a target accuracy and show it to be low for typical tensors in electronic structure. We then provide a generic procedure to reformulate any coupled cluster method using tensor decompositions. Two specific approximate methods, THC-RCCSD and CPD-RCCSD, are derived. We demonstrate the accuracy of these new approaches by calculating energies of a large set of organic molecules, as well as by simulations of Hubbard models. Finally, it is shown how the restriction of the number of parameters in approximate coupled cluster can improve the accuracy in the challenging strong correlation regime. We conclude by discussing a connection of our findings to other new developments in the coupled cluster theory and propose possible extensions of our approach.
We present a symbolic manipulation algorithm for the efficient automated implementation of rigorously spin-free coupled cluster (CC) theories based on a unitary group parametrization. Due to the lack of antisymmetry of the unitary group generators under index permutations, all quantities involved in the equations are expressed in terms of non-antisymmetric tensors. Given two tensors, all possible contractions are first generated by applying Wick's theorem. Each term is then put down in the form of a non-antisymmetric Goldstone diagram by assigning its contraction topology. The subsequent simplification of the equations by summing up equivalent terms and their factorization by identifying common intermediates is performed via comparison of these contraction topologies. The definition of the contraction topology is completely general for non-antisymmetric Goldstone diagrams, which enables our algorithm to deal with noncommuting excitations in the cluster operator that arises in the unitary group based CC formulation for open-shell systems. The resulting equations are implemented in a new code, in which tensor contractions are performed by successive application of matrix-matrix multiplications. Implementation of the unitary group adapted CC equations for closed-shell systems and for the simplest open-shell case, i.e., doublets, is discussed, and representative calculations are presented in order to assess the efficiency of the generated codes.