Minimizing Communication in Linear Algebra
Grey Ballard, James Demmel, Olga Holtz, Oded Schwartz
Introduction
Algorithms have two kinds of costs: arithmetic and communication, by which we mean either moving data between levels of a memory hierarchy (in the sequential case) or over a network connecting processors (in the parallel case). There are two costs associated with communication: bandwidth (proportional to the total number of words of data moved) and latency (proportional to the number of messages in which these words are packed and sent). For example, we may model the cost of sending words in a single message as , where is the latency (measured in seconds) and is the reciprocal bandwidth (measured in seconds per word). Depending on the technology, either latency or bandwidth costs may be larger, often dominating the cost of arithmetic. So it is of interest to have algorithms minimizing both communication costs.
In this paper we prove a general lower bound on the amount of data moved (i.e., bandwidth) by a general class of algorithms, including most dense and sparse linear algebra algorithms, as well as some graph theoretic algorithms. Our model is the result of Hong and Kung [HK81] which says that to multiply two dense -by- matrices on a machine with a large slow memory (in which the matrices initially reside) and a small fast memory of size (too small to store the matrices, but arithmetic may only be done on data in fast memory), words of data must be moved between fast and slow memory. This lower bound is attained by a variety of “blocked” algorithms. This lower bound may also be expressed as (#arithmetic_operations / ) The sequential communication model used here is sometimes called the two-level I/O model or disk access machine (DAM) model (see [AV88], [BBF+07], [CR06]). Our model follows that of [HK81] and [ITT04] in that it assumes the block-transfer size is one word of data ( in the common notation). .
This result was proven differently by Irony, Toledo and Tiskin [ITT04] and generalized to the parallel case, where processors multiply two -by- matrices. In the “memory-scalable” case, where each processor stores the minimal words of data, they obtain the lower bound (#arithmetic_operations_per_processor / = , which is attained by Cannon’s algorithm [Can69] [Dem96, Lecture 11]. The paper [ITT04] also considers the “3D” case, which does less communication by replicating the matrices and so using times as much memory as the minimal possible.
Here we begin with the proof in [ITT04], which starts with the sum , and uses a geometric argument on the lattice of indices to bound the number of updates that can be performed when a subset of matrix entries are in fast memory. This proof generalizes in a number of ways: in particular it does not depend on the matrices being dense, or the output being distinct from the input. These observations let us state and prove a general Theorem 2 in section 2, that a lower bound on the number of words moved into or out of a fast or local memory of size is (#arithmetic operations / ). This applies to both the sequential case (where is a fast memory) and the parallel case; in the parallel case further assumptions about whether the algorithm is memory balanced (to estimate the effective ) are needed to get a lower bound on the overall algorithm.
Corollary 3 of Theorem 2 provides a simple lower bound on latency (just the lower bound on bandwidth divided by the largest possible message size, namely the memory size ). Both bandwidth and latency lower bounds apply straightforwardly to a nested memory hierarchy with more than two layers, bounding from below the communication between any adjacent layers in the hierarchy [Sav95, BDHS09].
In Section 3, we present simple corollaries applying Theorem 2 to conventional (non-Strassen-like) implementations of matrix multiplication and other BLAS operations [BLA, BDD+02, BDD+01] (dense or sparse), LU factorization, Cholesky factorization and “” factorization. These factorizations may also be dense or sparse, with any kind of pivoting, and be exact or “incomplete”, e.g., ILU [Saa96] (some of these results can be also obtained, just for dense matrices, by suitable reductions from [HK81] or [ITT04], and we point these out).
Section 4 considers lower bounds for algorithms that apply orthogonal transformations to the left and/or right of matrices. This class includes the QR factorization, the standard algorithms for eigenvalues and eigenvectors, and the singular value decomposition (SVD). For reasons explained there, the counting techniques of [HK81] and [ITT04] do not apply, so we need a different but related lower bound argument.
Section 5 shows how to extend our lower bounds to more general computations where we compose a sequence of simpler linear algebra operations (like matrix multiplication, LU decomposition, etc.), so the outputs of one operation may be inputs to later ones. If these intermediate results do not need to be saved in slow memory, or if some inputs are given by formulas (like ) and so do not need to be fetched from memory, or if the final output is just a scalar (the norm or determinant of a matrix), then it is natural to ask whether there is a better algorithm than just using optimized versions of each operation in the sequence. We give examples where this simple approach is optimal, and when it is not. We also exploit the natural correspondence between matrices and graphs to derive communication lower bounds for certain graph algorithms, like All-Pairs-Shortest-Path.
Finally, Section 6 discusses attainability of these lower bounds, and open problems. Briefly, in the dense case all the lower bounds are attainable (in the parallel case, this is modulo factors, and assuming the minimal storage per processor); see Tables 1 and 2 (some of these algorithms are also pointed out in sections 3 and 4). The optimal algorithms for square matrix multiplication are well known, as mentioned above. Optimal algorithms for dense LU, Cholesky, QR, eigenvalue problems and the SVD are more recent, and not part of standard libraries like LAPACK [ABB+92] and ScaLAPACK [BCC+97]. Only in the case of Cholesky do we know of a sequential algorithm that both minimizes bandwidth and latency across arbitrary levels of memory hierarchy. No optimal algorithm is known for architecture mixing parallelism and multiple memory hierarchies, i.e., most real architectures. Optimal “3D” algorithms for anything other than matrix-multiplication, and optimal sparse algorithms for anything are unknown. For highly rectangular dense matrices (e.g., matrix-vector multiplication), or for sufficiently sparse matrices, our new lower bound is sometimes lower than the trivial lower bound (#inputs + #outputs), and so it is not always attainable.
First Lower Bound
Let be the memory address of a destination to put a computed result, where and are integer indices (thus will contain the actual value). All we assume is that is a one-to-one function on a set of pairs for destinations we want to compute; in other words all for are distinct. On a parallel machine refers to a location on some processor; the processor number is implicitly part of .
Similarly, let and be memory addresses of operands, also one-to-one on sets made explicit below. We make no assumptions about whether or not some can ever equal some ; they may or may not. Similarly, the addresses given by and , or by and , may overlap arbitrarily. We assume that the result to be stored at each is computed only once.
Now let and be “nontrivial” functions in a sense we make clear below. The computation we want to perform is for all :
Here depends nontrivially on its arguments which in turn depend nontrivially on their arguments and , in the following sense: we need at least one word of space to compute (which may or may not be ) to act as “accumulator” of the value of , and we need the values and in fast memory before evaluating . Note also that we may not know until after the computation what , , , or “any other arguments” were, since they may be determined on the fly (e.g., pivot order).
The question is how many slow memory references are required to perform this computation, when all we are allowed to do is compute the in a different order, and compute and store the is a different order. This appears to restrict possible reorderings to those where is computed correctly, since we are not assuming it is an associative or commutative function, or those reorderings that avoid races because some may be used later as inputs. But there is no need for such restrictions: the lower bound applies to all reorderings, correct or incorrect. Using only structural information, e.g., about the sparsity patterns of the matrices, we can sometimes deduce that the computed result is exactly zero, to possibly avoid a memory reference to store the result at . Section 3.3 discusses this possibility more carefully, and shows how to carefully count operations to preserve the validity of our lower bounds.
The argument, following [ITT04], is: (1) Break the stream of instructions executed into segments, where each segment contains exactly load and store instructions (i.e., that cause communication), where is the fast (or local) memory size. (2) Bound from above the number of evaluations of functions that can be performed during any segment, calling this upper bound . (3) Bound from below the number of (complete) segments by the total number of evaluations of (call it ) divided by , i.e., . (4) Bound from below the number of loads and stores by times the minimum number of complete segments, .
Now we compute the upper bound using a geometric theorem of Loomis and Whitney [LW49, BZ88]. We need only the simplest version of their result here:
[LW49, BZ88]. Let be a finite set of lattice points in , i.e., points with integer coordinates. Let be the projection of in the -direction, i.e., all points such that there exists an so that . Define and similarly. Let denote the cardinality of a set. Then .
Now we must bound the maximum number of possibly different (or corresponding “accumulators”), , and that can reside in fast memory during a segment. Since we want to accommodate the most general case where input and output arguments can overlap, we need to use a more complicated model than in [ITT04], where no such overlap was possible. To this end, we consider each input or output operand of (1) that appears in fast memory during a segment of slow memory operations. It may be that an operand appears in fast memory for a while, disappears, and reappears, possibly several times (we assume there is at most one copy at a time in the sequential model, and at most one for each processor in the parallel model; this obviously is consistent with obtaining a lower bound). For each period of continuous existence of an operand in fast memory, we label its Source (how it came to be in fast memory) and its Destination (what happens when it disappears):
Source S1: The operand was already in fast memory at the beginning of the segment, and/or read from slow memory. There are at most such operands altogether, because the fast memory has size , and because a segment contains at most reads from slow memory.
Source S2: The operand is computed (created) during the segment. Without more information, there is no bound on the number of such operands.
Destination D1: An operand is left in fast memory at the end of the segment (so that it is available at the beginning of the next one), and/or written to slow memory. There are at most such operands altogether, again because the fast memory has size , and because a segment contains at most writes to slow memory.
Destination D2: An operand is neither left in fast memory nor written to slow memory, but simply discarded. Again, without more information, there is no bound on the number of such operands.
We may correspondingly label each period of continuous existence of any operand in fast memory during one segment by one of four possible labels Si/Dj, indicating the Source and Destination of the operand at the beginning and end of the period. Based on the above description, the total number of operands of all types except S2/D2 is bounded by (the maximum number of S1 operands plus the number of D1 operands, an upper bound) More careful but complicated accounting can reduce this upper bound to .. The S2/D2 operands, those created during the segment and then discarded without causing any slow memory traffic, cannot be bounded without further information. For our simplest model, adequate for matrix multiplication, LU decomposition, etc., we have no S2/D2 arguments; they reappear when we analyze the QR decomposition in Section 4.
Using the set of lattice points to represent each function evaluation , and assuming there are no S2/D2 arguments, then by Lemma 1 their number is then bounded by , so the total number of loads and stores is bounded by . This proves the first lower bound:
In the notation defined above, and in particular assuming there are no S2/D2 arguments (created and discarded without causing memory traffic) the number of loads and stores needed to evaluate (1) is at least .
We may also write this as (#arithmetic_operations / ) understanding that we only count arithmetic operations required to evaluate the for and . We note that a more careful, problem-dependent analysis that depends on how much the three arguments can overlap, may sometimes increase the lower bound by a factor of as much as 8, but for simplicity we omit this.
This lower bound is not always attainable, even for dense matrix multiplication: If the matrices are so small that they all fit in fast memory simultaneously, so , then the number of loads and stores may be just , which can be much larger than . So a more refined lower bound is #inputs + #outputs). We generally omit this detail from statements of later corollaries.
Theorem 2 is a lower bound on bandwidth, the total number of words communicated. But it immediately provides a lower bound on latency as well, the minimum number of messages that need to be sent, where each message may contain many words.
In the notation defined above, the number of messages needed to evaluate (1) is at least = #evaluations_of_.
The proof is simply that the largest possible message size is the fast (or local) memory size , so we divide the lower bound from Theorem 1 by .
On a parallel computer it is possible for a processor to pack words into a single message to be sent to a different processor. But on a sequential computer the words to be sent in a single message must generally be located in contiguous memory locations, which depends on the data structures used. This assumption is appropriate to capture the behavior of real hardware, e.g., cache lines, memory prefetching, disk accesses, etc. This means that to attain the latency lower bound on a sequential computer, rather different matrix data structures may be required than row-major or column-major [BDHS09, FLPR99, EGJK04, AGW01, AP00].
Finally, we note that real computers typically don’t have just one level of memory hierarchy, but many, each with its own underlying bandwidth and latency costs. So it is of interest to minimize all communication, between every pair of adjacent levels of the memory hierarchy. As has been noted before [Sav95, BDHS09], when the memory hierarchy levels are nested (the L2 cache stores a subset of L3 cache, etc.) we can apply lower bounds like ours at every level in the hierarchy.
We now show how Theorem 2 applies to a variety of conventional algorithms from numerical linear algebra, by which we mean algorithms that would cost arithmetic operations when applied to dense -by- matrices, as opposed to Strassen-like algorithms.
It is natural to ask whether algorithms exist that attain these lower bounds. We point out cases where we know such algorithms exist, which are therefore optimal in the sense of minimizing communication. In the case of dense matrices, many optimal algorithms are known, though not yet in all cases. In the case of sparse matrices, little seems to be known.
We begin with matrix multiplication, on which our model in Equation (1) is based:
is the bandwidth lower bound for multiplying explicitly stored matrices on a sequential machine, where is the number of multiplications performed in evaluating all the , and is the fast memory size. In the special case of multiplying a dense -by- matrix times a dense -by- matrix, this lower bound is .
This nearly reproduces a result in [ITT04] for the case of two distinct, dense matrices, whereas we need no such assumptions; their bound is times larger than ours, but as stated before our bound could be improved by specializing it to this case. We note that this result could have been stated for sparse and in [HK81]: Combine their Theorem 6.1 (their is the number of multiplications) with their Lemma 6.1 (whose proof does not require and to be dense).
As noted in the previous section, an independent lower bound on the bandwidth is simply the total number of inputs that need to be read plus the number of outputs that need to be written. But counting the number of inputs is not as simple as counting the number of nonzero entries of and : if and are sparse, and column of is filled with zeros only, then row of need not be loaded at all, since does not depend on it. An algorithm that nevertheless loads row of will still satisfy the lower bound. And an algorithm that loads and multiplies by explicitly stored zero entries of or will also satisfy the lower bound; this is an optimization sometimes used in practice [VDY05].
When and are dense and distinct, there are well-known algorithms mentioned in the Introduction that (nearly) attain the combined lower bound
see [ITT04] for a more complete discussion. Attaining the corresponding latency lower bound of Corollary 3 requires a different data structure than the usual row-major or column-major orders, so that words to be sent in a single message are contiguous in memory, and is variously referred to as recursive block storage or storage using space filling curves, see [FLPR99, EGJK04, BDHS09] for discussion. Some of these algorithms also minimize bandwidth and latency for arbitrarily many levels of memory hierarchy. Little seems to be known about the attainability of this lower bound for general sparse matrices.
Now we consider the parallel case, with processors. Let be the number of nonzero entries of ; then is a lower bound on the total memory required to store the inputs and outputs. We need to make some assumption about how this data is spread across processors (each of which has its own memory), since if , and were all stored in one processor, and all arithmetic done there (i.e., no parallelism at all), then no communication would be needed. So we assume that each processor stores an equal share of this data, and perhaps at most more words, a kind of memory-balance or memory-scalability assumption. Also, at least one processor must perform at least multiplications, where is the total number of multiplications. Combining all this with Theorem 2 yieldsWe present the conclusions for the parallel model in asymptotic notation. One could instead assume that each processor had memory of size for some constant , and obtain the hidden constant of the lower bounds as a function of , as done in [ITT04].
Suppose we have a parallel algorithm on processors for multiplying matrices that is memory-balanced in the sense described above. Then at least one processor must communicate words, where is the number of multiplications performed. In the special case of dense -by- matrices, this lower bound is .
There are again well-known algorithms that attain the bandwidth and latency lower bounds in the dense case, but not in the sparse case.
We next extend Theorem 2 beyond matrix multiplication. The simplest extension is to the so-called BLAS3 (Level-3 Basic Linear Algebra Subroutines [BLA, BDD+01, BDD+02]), which include related operations like multiplication by (conjugate) transposed matrices, by triangular matrices and by symmetric (or Hermitian) matrices. The last two corollaries apply to these operations without change (in the case of we use the fact that Theorem 2 makes no assumptions about the matrices being multiplied not overlapping).
More interesting is the BLAS3 operation TRSM, computing where is triangular. The inner loop of the algorithm (when is upper triangular) is
which can be executed in any order with respect to , but only in decreasing order with respect to . None of this matters for the lower bound, since equation (2) still matches Equation (1), so the lower bounds apply. Sequential algorithms that attain these bounds for dense matrices, for arbitrarily many levels of memory hierarchy, are discussed in [BDHS09].
We note that our lower bound also applies to the so-called Level 2 BLAS (like matrix-vector multiplication) and Level 1 BLAS (like dot products), but the larger lower bound #inputs + #outputs is attainable.
2 LU factorization
Independent of sparsity and pivot order, the formulas describing LU factorization are as follows, with the understanding the summations may be over some subset of the indices in the sparse case, and pivoting has already been incorporated in the interpretation of the indices , and .
It is easy to see that these formulas correspond to our model in Equation (1), with identified with multiplying . The fact that the “outputs” and can overwrite the inputs does not matter, and the subtraction from and division by are all accommodated by Equation (1).
With this in mind, these formulas are also general enough to accommodate incomplete LU (ILU) factorization [Saa96] where some entries of and are omitted in order to speedup the computation. If we model an ILU implementation that is threshold based, i.e., one that computes a possible nonzero entry or and compares it to a threshold, storing it only if it is larger than the threshold and discarding it otherwise, then we should not count the multiplications that led to the discarded output. Thus we see that analogs of Corollaries 4 and 5 apply to LU and ILU as well.
A sequential dense LU algorithm that attains this bandwidth lower bound is given by [Tol97], although it does not always attain the latency lower bound [DGHL08a]. The conventional parallel dense LU algorithm implemented in ScaLAPACK [BCC+97] attains the bandwidth lower bound (modulo an factor), but not the latency lower bound. A parallel algorithm that attains both lower bounds (again modulo a factor ) is given in [DGX08], where significant speedups are reported. Interestingly, it does not seem possible to attain both lower bounds and retain conventional partial pivoting, a different (but still stable) kind of pivoting is required. We also know of no dense sequential LU algorithm that minimizes bandwidth and latency across multiple levels of a memory hierarchy (unlike Cholesky). There is an elementary reduction proof that dense LU factorization is “as hard as dense matrix multiplication” [DGHL08a], but it does not address sparse or incomplete LU, as does our approach.
Using only structural information, e.g., about the sparsity patterns of the underlying matrices, it is sometimes possible to deduce that the computed result is exactly zero, and so to possibly avoid a memory reference to location to store the result. This may either be because the values being accumulated to compute are all identically zero, or, more interestingly, because it is possible to prove there is exact cancellation (independent of the values of the nonzero arguments and ); we give an example of this below. In these cases it is possible to imagine algorithms that (1) pay no attention to these possibilities and simply load, store and compute with zeros (e.g., a “dense algorithm” applied to a sparse matrix), or (2) recognize that zeros will be computed and avoid doing any memory traffic or arithmetic to compute them, or (3) do the work of computing the zero entry, recognize it is zero (perhaps by comparing to a tiny threshold), and do not bother storing it. In this last case one might worry that our lower bounds are too high. However, such operations would not count toward our lower bound, because they do not satisfy Equation (1), since they do not lead to a write to . This may undercount the actual number of memory operations, but does not prevent our lower bound from being a right lower bound.
Here is an example to illustrate that counting the number of to get a true lower bound requires care. This is because, as suggested above, it is possible for an LU algorithm to infer from the sparsity pattern of that some (partial) sums in equation (3) are zero and so avoid computing them. For example, consider a matrix that is nonzero in its first rows and columns, and possibly in the trailing -by- submatrix; call this submatrix . First suppose , so that has rank at most , and that pivots are chosen along the diagonal. It is easy to see that the first steps of Gaussian elimination will generically fill in the entire matrix with nonzeros, but that step will cause cancellation to zero (in exact arithmetic) in all entries of . If starts as a nonzero sparse matrix, then this cancellation will not be to zero but to the sparse LU factorization of alone. So one can imagine an algorithm that may or may not recognize this opportunity to avoid work in some or all of the entries of . To accommodate all these possibilities, we will, as stated above, only count those multiplications in (3) that contribute to a result or that is stored in memory. The discussion of this paragraph also applies to QR factorization.
4 Cholesky Factorization
Now we consider Cholesky factorization. Independent of sparsity and (diagonal) pivot order, the formulas describing Cholesky factorization are as follows, with the understanding the summations may be over some subset of the indices in the sparse case, and pivoting has already been incorporated in the interpretation of the indices , and .
It is easy to see that these formulas correspond to our model in Equation (1), with identified with multiplying . As before, the fact that the “outputs” can overwrite the inputs does not matter, and the subtraction from , division by , and square root are all accommodated by Equation (1). As before, these formulas are general enough to accommodate incomplete Cholesky (IC) factorization [Saa96].
Dense algorithms that attain these lower bounds are discussed in [BDHS09], both parallel and sequential, including analyzing one that minimizes bandwidth and latency across all levels of a memory hierarchy [AP00]. We note that there was a proof in [BDHS09] showing that dense Cholesky was “as hard as dense matrix multiplication” by a method analogous to that for LU.
Hoffman, Martin, and Rose [HMR73] and George [Geo73] prove that a lower bound on the number of multiplications required to compute the sparse Cholesky factorization of an -by- matrix representing a 5-point stencil on a 2D grid of nodes is . This lower bound applies to any matrix containing the structure of the 5-point stencil. This yields:
In the case of the sparse Cholesky factorization of the matrix representing a 5-point stencil on a two-dimensional grid of nodes, the bandwidth lower bound is .
George [Geo73] shows that this arithmetic lower bound is attainable with a nested dissection algorithm in the case of the 5-point stencil. Gilbert and Tarjan [GT87] show that the upper bound also applies to a larger class of structured matrices, including matrices associated with planar graphs.
We next show that analogous lower bounds apply to the symmetric indefinite factorization , where is block diagonal with 1-by-1 and 2-by-2 blocks, and is a lower triangular matrix with 1 on its diagonal elements. If is positive definite then all the blocks of are 1-by-1. It sufficient to consider the lower bound for the positive definite case, as any decomposition algorithm for the general case has to deal with this case as well. Independent of sparsity and (diagonal) pivot order, the formulas describing Cholesky factorization are as follows, with the understanding the summations may be over some subset of the indices in the sparse case, and pivoting has already been incorporated in the interpretation of the indices , and .
It is easy to see that these formulas correspond to our model in Equation (1), with identified with multiplying , thus the lower bounds apply to decomposition as well. As in the Cholesky case, the only difference is that the number of multiplications is about half as large (), as is the memory size .
Applying Orthogonal Transformations
In this section we consider algorithms that compute and apply sequences of orthogonal transformations to a matrix, which includes the most widely used algorithms for least squares problems (the QR factorization), eigenvalue problems, and the SVD. We need to treat algorithms that apply orthogonal transformations separately because Loomis-Whitney alone is not enough to bound the number of arithmetic operations that can occur in a segment.
The QR factorization of a rectangular matrix is more subtle to analyze than LU or Cholesky, because there is more than one way to represent the factor (e.g., Householder reflections and Givens rotations), because the standard ways to reorganize or “block” QR to minimize communication involve using the distributive law, not just summing terms in a different order [BVL87, SVL89, Pug92, Dem97, GVL96], and because there may be many intermediate terms that are computed, used, and discarded without causing any slow memory traffic. This forces us to use a different argument than Loomis-Whitney to bound the number of arithmetic operations in a segment.
To be concrete, we consider the widely used Householder reflections, in which an -by- elementary real orthogonal matrix is represented as , where is a column vector called a Householder vector, and . A single Householder reflection is chosen so that multiplying zeros out selected rows in a particular column of , and modifies one other row in the same column (for later use, we let be index of this other row).
Once entries in a column are zeroed out, they are not operated on again, and remain zero; this fact will be critical to our later counting argument. This means that a sequence of Householder reflections is chosen to zero out a common set of selected rows of a sequence of columns of by forming . Each zeros out a subset of the rows zeroed out in the previous column (so that once created, zeros are preserved). We furthermore model the way libraries like LAPACK [ABB+92] and ScaLAPACK [BCC+97] may “block” Householder vectors, writing , where is -by-, and is -by-. is nonzero only in the rows being modified, and furthermore column of is zero in entries ,…, and nonzero in entry . (In conventional algorithms for dense matrices this means , and is lower trapezoidal with nonzero diagonal.) Furthermore , which may be computed recursively from , is lower triangular with nonzero diagonal. Our lower bound considers all possible sequences of Householder transformations that preserve previously created zeros, and all possible ways to collect them into blocks.
Next, we will apply such block Householder transformations to a (sub)matrix by inserting parentheses as follows: , which is also the way Sca/LAPACK does it. Finally, we overwrite the output onto , which is how all fast implementations do it, analogously to LU decomposition, to minimize memory requirements.
But we do not need to assume any more commonality with the approach in Sca/LAPACK, in which a vector is chosen to zero out all of column of below the diagonal. For example, we can choose each Householder vector to zero out only part of a column at a time, as is the case with the algorithms for dense matrices in [DGHL08a, DGHL08b]. Nor do we even need to assume we are zeroing out any particular set of entries, such as those below the main diagonal as the usual QR algorithm; later this generality will let us apply this result to algorithms for eigenproblems and the SVD. As stated before, all we assume is that the algorithm “makes progress” in the sense that a Householder transformation in column is not allowed to fill in zeros that were deliberately created by other Householder transformations in columns .
To get our lower bound, we consider just the multiplications in all the different applications of block Householder transformations . We argue in Section 4.1.1 that this constitutes a large fraction of all the multiplications in the algorithm. There are two challenges to straightforwardly applying our previous approach to the matrix multiplications in all the updates . The first challenge is that we need to collect all these multiplications into a single set indexed in an appropriate one-to-one fashion by . The second challenge is that need not be read from memory, rather it may be computed on-the-fly from and and discarded without necessarily ever being read or written from memory. So we have to account for its memory traffic more carefully. Furthermore, each Householder vector (column of ) is created on the fly by modifying certain (sub)columns of , so it is both an output and an input. So we will have to account for the memory operations for and more carefully.
Here is how we address the first challenge: Let index indicate the number of the Householder vector; in other words are all the entries of -th Householder vector (the ordering is arbitrary). Thus is not the column of from which arises (there may be many Householder vectors associated with a given column as in [DGHL08a]) but does uniquely identify that column. Then the operation may be rewritten as , where the sum is over the Householder vectors making up that both lie in column and have entries in row . The use of this index lets us combine all the operations for all different Householder vectors into one collection
where all operands and are uniquely labeled by the index pairs and , resp.
For the second challenge, we revisit the model of section 2, where we distinguished arguments by their sources (S1 or S2) and destinations (D1 or D2). Unlike the algorithms in section 3, we now have the possibility of S2/D2 arguments, , which are created during the segment and then discarded without causing any slow memory traffic. To bound the number of S2/D2 arguments, we need to exploit the mathematical structure of Householder transformations.
Now let us consider the possible labels Si/Dj for the arguments in model (7). We assume each required value is only computed once (reflecting practical implementations).
Every operand is destined either to be output (eg as an entry of the factor) or converted into a Householder vector. So the only possible S2/D2 operands from are (sub)columns that become Householder vectors, and hence become S2 operands of . We bound the number of these as follows.
All operands are eventually output, so there are no D2 operands of (recall that we may only compute each result once, so it cannot be discarded). So all S2 operands are also D1, and so there are at most of them. This also bounds the number of S2/D2 operands , and so bounds the total number of operands by .
There are possible S2/D2 operands, as many as the product of the number of columns and the number of columns that can reside entirely in fast memory during the segment.
Unlike LU and matrix multiplication, the number of arguments is not bounded by , so we cannot hope to apply Loomis-Whitney to bound the number of arithmetic operations, see Section 4.1.1 for an example. So our proof has to try to bound the number of arithmetic operations possible in a segment without using Loomis-Whitney. We do this by exploiting the mathematical structure of Householder transformations, and the bound on the number of and entries in fast memory during a segment, to still bound the maximum number of multiplies during a segment by , which is all we need to get our ultimate lower bound.
In the case that all are S2/D2 operands, according to (7), the maximum number of arithmetic operations for column of is the number of entries, , if every possible is nonzero. So the maximum total number of arithmetic operations is times the maximum number of columns of that can be present. The maximum number of columns of is in turn the total number of entries that can be present () divided by the minimum number of rows present from each column of . So the question is: what is the fewest number of rows in which we can pack Householder vector entries? We need to rely on the fact that these Householder vectors must satisfy the dependency relationship of QR, that previously created zeros in previous columns are preserved. So the fewest rows are touched when the nonzero Householder vector entries in each column lie in a strict subset of the rows occupied by nonzero Householder vector entries in previous columns (this follows by induction on columns from right to left). Note that if the matrix is sparse, these Householder vectors are not necessarily in adjacent columns. So if there are nonzero Householder vector entries in the leftmost occupied column, there can be at most in the next occupied column, and so on, and so at most nonzero Householder vector entries altogether in rows. So if there are nonzero Householder vector entries altogether, residing in rows, then or . Then the maximum number of columns of that can be present is bounded by or , and the maximum number of multiplications that can be performed is , as desired.
In the case that some are S2/D2 operands and some are not, we must use Loomis-Whitney and the above argument to bound the number of multiplies within a segment. Since there are no more that non-S2/D2 operands in a segment, the Loomis-Whitney argument bounds the number of multiplies involving such operands by , so with the above argument, the total number of multiplies is less than .
The rest of the proof is similar to before: A lower bound on the number of segments is then , so a lower bound on the number of slow memory accesses is . For dense -by- matrices with , the conventional algorithm does multiplies. Altogether, this yields the following theorem:
is the bandwidth lower bound for computing the QR factorization of a matrix on a sequential machine, where is computed as a product of (arbitrarily blocked) Householder transformations, and is the number of multiplications performed when updating , i.e., adding multiples of Householder vectors to the matrix. In the special case of a dense -by- matrix with , this lower bound is .
An analogous result holds for parallel QR.
Regarding related work, a lower bound just for the dense case appears in [DGHL08a], which also discusses algorithms that meet (some of) these lower bounds, and shows significant speedups. The proof in [DGHL08a] assumed each was written to memory (which we do not here), and so could use the Loomis-Whitney approach. For example, the sequential algorithm in [EG98, EG00], as well as LAPACK’s DGEQRF, can minimize bandwidth, but not latency. The paper [DGHL08a] also describes sequential and parallel QR algorithms that do attain both bandwidth and latency lower bounds; this was accomplished by applying block Householder transformations in a tree-like pattern, each one of which zeroing out only part of a block column of . We know of no sequential QR factorization algorithm that minimizes communication across more than 2 levels of the memory hierarchy.
To get our lower bound, we consider just the multiplications in all the different applications of block Householder transformations , where . We argue that under a natural “genericity assumption” this constitutes a large fraction of all the multiplications in the algorithm. (although this is not necessary to get a valid lower bound). Suppose is nonzero; the amount of work to compute this is at most proportional to the total number of entries stored (and so treated as nonzeros) in column of . Since is triangular and nonsingular, this means will be generically nonzero as well, and will be multiplied by column of and added to column of , which costs at least as much as computing . The cost of the rest of the computation, forming and multiplying by and computing the actual Householder vectors, are lower order terms in practice; the dimension of is chosen small enough by the algorithm to try to assure this. Thus, for a lower bound of total multiplies for a dense -by- matrix given by [DGHL08a], there are multiplies of the form given by (7).
Unlike LU and matrix multiplication, the number of arguments is not bounded by , so we cannot hope to apply Loomis-Whitney to bound the number of arithmetic operations. As an example, suppose we do QR on the matrix where each is -by-, and the matrix just fits in fast memory, so that . Suppose that we have performed QR on using 2-by-2 Householder transformations (for example zeroing the subdiagonal entries of from column 1 to column , and from bottom to top in each column). Now suppose we want to bound the number of the operations (7) gotten from applying these Householder transformations to . Then there is one (generically) nonzero for each pair consisting of a Householder vector and a column of , or values of in all. This is too large to use Loomis-Whitney to bound the number of multiplications in the (single) segment constituting the algorithm, which is still .
We note that we cannot use the fact that , so that is the Cholesky factor of , to get a lower bound based on our lower bound for Cholesky, because QR works very differently than Cholesky. For example, when is -by- with , its factor will have the same shape and cost operations to compute, but will be -by-, as will its Cholesky factor, which would cost to compute. Similarly, when is sparse, may be much denser. So there is no simple relationship between the two algorithms.
We note that a Givens rotation may be replaced by a 2-by-2 Householder reflection, and so we conjecture that algorithms using Givens rotations are covered by this analysis.
2 Eigenvalue and Singular Value Problems
Standard algorithms for computing eigenvalues and eigenvectors, or singular values and singular vectors (the SVD), start by applying orthogonal transformations to both sides of to reduce it to a “condensed form” (Hessenberg, tridiagonal or bidiagonal) with the same eigenvalues or singular values, and simply related eigenvectors or singular vectors [Dem97]. We begin this section by getting communication lower bounds for these reductions, and then discuss the communication complexity of the algorithms for the condensed forms. Finally, we briefly discuss a completely different family of algorithms that does attain the same lower bounds for all these eigenvalue problems and the SVD, but at the cost of doing more arithmetic.
We extend our argument from the last section as follows. We can have some arbitrary interleaving of (block) Householder transformations applied on the left:
Of course there are lots of possible dependencies ignored here, much as we wrote down a similar formula for LU. But we do assume that two-sided factorizations “make progress” in the same sense as one-sided QR: entries that are zeroed out remain zeroed out by subsequent Householder transformations, from the left or right. By the same argument as the previous section, we can classify the Sources and Destinations of the components of (8) as follows:
Every operand is destined either to be output (e.g., as an entry of the eventual Hessenberg, tridiagonal or bidiagonal matrix) or converted into a left or right Householder vector. So the only possible S2/D2 operands from are (sub)columns or (sub)rows that become Householder vectors, and hence become S2 operands of either or . We bound the number of these as follows.
All operands are eventually output, so there are no D2 operands of (recall that we may only compute each result once, so it cannot be discarded). So all S2 operands are also D1, and so there are at most of them. This also bounds the number of S2/D2 operands that become S2 operands of .
This is analogous to . Again, bounds the number of S2/D2 operands that become S2 operands of .
Finally, since S2/D2 operands of must either be S2 operands of or , there are at most of these.
Thus, in one segment, there can be at most entries , entries and entries . Since there are no more than non-S2/D2 operands and non-S2/D2 operands in a segment, the Loomis-Whitney argument bounds the number of multiplies or involving such operands by . An argument similar to the one given in section 4 bounds the number of multiplies involving S2/D2 operands by . Thus, the upper bound on the total number of multiplies within a segment is , so the final lower bound on the number of memory operations is #multiplies/.
This extends our lower bound to any algorithm that applies any sequence of left/right Householder transformations, under the restriction of “making progress”, and so cover reduction to tridiagonal, bidiagonal or Hessenberg forms. In all these cases, for dense -by- matrices, #multiplies is a multiple of .
is the bandwidth lower bound for reducing a matrix to Hessenberg, tridiagonal or bidiagonal form on a sequential machine, where the reduction is done by multiplying on the left and right by products of (arbitrarily blocked) Householder transformations, and is the number of multiplications performed when adding multiples of Householder vectors to the matrix. In the special case of a dense -by- matrix, this lower bound is .
Again, an analogous result holds for parallel reductions.
None of the reduction algorithms in LAPACK [ABB+92] attain these bounds, instead having bandwidth (the worst possible, asymptotically, even though these algorithm try to do as much work with matrix-matrix multiplication as possible). ScaLAPACK’s tridiagonal and bidiagonal reduction routines minimize bandwidth but not latency [BCC+97, Table 5.8].
Now we consider the rest of the eigenvalue or singular value problem. Once a (symmetric) matrix has been reduced to tridiagonal form , it of course requires much less memory to store, just . Assuming is at least a few times larger than , there are a variety of classical algorithms to compute some or all of ’s eigenvalues also using just fast memory. There is also a well-known algorithm [DPV06, DP04] (routine xSTEMR in LAPACK [ABB+92]) to compute ’s eigenvalues and eigenvectors one-at-a-time using flops, and requiring fast memory in general. So in the common case that is at least a few times smaller than the fast memory size , this can be done with as many slow memory references as there are inputs and outputs, which is a lower bound. A similar discussion applies to the SVD of a bidiagonal matrix , although there are open numerical stability problems regarding extending the algorithm in xSTEMR to the SVD. Once the eigenvectors of or singular vectors of have been computed, they must be multiplied by the orthogonal matrices used in the reduction to get the final eigenvectors or singular vectors of . Our previous analysis of applying Householder transformations applies here.
Now we consider the more challenging computation of the eigenvalues and eigenvectors of a Hessenberg matrix . Our analysis applies to one pass of standard QR iteration on a dense upper Hessenberg matrix to find its eigenvalues, but this does flops on data, and so does not improve the trivial lower bound of the input size. We conjecture that improvements of Braman, Byers and Mathias [BBM02a, BBM02b] to combine passes into one increase the flop count to , so we get a lower bound of . This starts to get interesting as soon as . In practice, for numerical reasons, is usually chosen to be 256 or lower, which limits the applicability of this result.
We conjecture that our analysis applies to solving the generalized eigenvalues problem of a matrix pencil : The standard algorithm begins by reducing the pair to Hessenberg/triangular form by applying orthogonal transformations to the left and right of and . After this the QZ algorithm is used to find eigenvalues and eigenvectors.
Finally, there is a completely different, divide-and-conquer approach to solving dense eigenproblems and the SVD [DDH07, BDD09], that only uses QR factorization and matrix multiplication to do its work, and attains the communication lower bounds described above. We discuss this briefly in Section 6.
Lower Bounds for Compositions of Linear Algebra Operations
We next demonstrate how our lower bounds can be applied to more general computations where any or all of the following apply:
We might do a sequence of basic operations (matrix multiplication, LU, etc.).
The outputs of one operation are the inputs to a later one but do not necessarily need to be saved in slow memory,
The inputs may be computed by formulas (like ) requiring no memory traffic.
The ultimate output written to slow memory may just be a scalar, like the norm of a matrix.
An algorithm might compute but discard some results rather than save them to memory (e.g., ILU might discard entries of L or U whose magnitudes falls below a threshold).
In particular we would like a lower bound where we are allowed to arbitrarily interleave all the instructions from all basic operations in the computation together, and so get a lower bound for a global optimization of the entire program. For example, if two different matrix multiplications share a common input matrix, is it worth trying to interleave instructions from these two different matrix multiplications?
A natural question is whether it is good enough to just use optimal implementations of the basic operations, like matrix multiplication, to attain the global lower bound. This would clearly be the simplest way to implement the program. We know from experience that this is not always the case. For example, LU itself can be decomposed in many ways in terms of operations like matrix multiplication. Yet only recently have optimal LU algorithms been constructed. Previous LU algorithms did not attain optimal bandwidth and latency, even when each of their composing operations had optimal bandwidth and latency.
We give some examples, such as computing matrix powers, where it is indeed good enough to use repeated calls to an optimal matrix multiplication, as opposed to needing a new algorithm, and another example where the straightforward composition does not suffice, and a more careful interleaving of the computation is needed in order to attain the lower bound.
In this example we consider a single linear algebra operation, where inputs are given by formulas and the output is a scalar (e.g., norm of the product of two matrices given by formulas, each used once; computing the determinant of a matrix with entries given by formulas, where one does the decomposition and takes the product of the diagonal elements of , etc.)
Even though this seems to eliminate a large number of reads and writes, we can prove (for this and similar examples) that the communication lower bound is still , by using a technique of imposing reads and writes: We take an algorithm to which Theorem 2 does not apply, because it may potentially have S2/D2 operands, and add (impose) memory traffic to eliminate such operands. Then we use Theorem 2 to bound below the communication of this modified algorithm, and subtract the amount of imposed communication to get a lower bound for the original algorithm.
Here is an example. Consider computing , where and are given by formulas. Let . Whenever the final value of some is computed, squared, and added to , we impose a write (if it is missing) so that is saved in slow memory, and so has destination D1 instead of possibly D2 (it may still have source S2). Thus no entries of can be S2/D2. Whenever the value of some or is computed by a formula, we impose a read to get it from a location in slow memory, so it has source S1 instead of S2 (it may still have destination D2). Now, no entries of or can be S2/D2. Thus this modified algorithm has lower bound by Theorem 2.
To get a lower bound for the original algorithm, we need to bound how many reads and writes we imposed. There are clearly at most imposed writes. If the original algorithm only evaluates each formula for and once, and keeps their computed values in memory if necessary for later use, then the number of imposed reads is , and the communication lower bound for the original algorithm is , close to standard dense matrix multiplication.
On the other hand, if the original algorithm evaluates the formulas for and whenever it needs them, so times, then the communication lower bound for the original algorithm becomes , which degenerates to zero.
1.2 A sequence of basic linear algebra operations
In the following example, we compose a sequence of basic linear algebra operations where intermediate outputs are used as inputs later, and never written to memory (e.g., computing consecutive powers of a matrix, or repeated squaring). Again, even though this seems to eliminate a large number of reads and writes, we show that in some cases the lower bound is still , by imposing reads and writes and merging all the operations into a single set satisfying Equation (1). This means that in such cases we can simply call a sequence of individually optimized linear algebra routines and do asymptotically as well as we would do with any arbitrary interleaving.
Let be an -by- matrix, and let be a sequential algorithm that computes , , … , , but only needs to save in slow memory. Let be the total number of multiplications performed (e.g., if is dense), where we assume that each entry of each is computed at most once. Then no matter how the operations of are interleaved, its bandwidth lower bound is (if the are sparse, we can subtract less than and get a better lower bound).
We give two proofs, each of which may be applied to other examples. For the first proof, we show how all the operations , … , , may be combined into one set to which Equation (1), and so Theorem 2, applies. For Equation (1) to apply, we must show that all the inputs, outputs and multiplications can be indexed by one index set in the one-to-one manner described in section 2; this is most easily seen by writing all the operations as
Recall that Equation (1) permits inputs and output to overlap, and “” and “” inputs to overlap, but the “” inputs alone must be indexed one-to-one, and similarly the “” inputs alone must be indexed one-to-one; this is the case above.
Next, we impose writes of all the intermediate results , yielding a new algorithm . This means that there are no S2/D2 arguments, so Theorem 2 applies to . Thus the bandwidth lower bound of is , and the bandwidth lower bound of is lower by the number of imposed writes, at most (less if the matrices are sparse).
Now we present a second proof, which uses the Loomis-Whitney-based analysis of a segment more directly. We let be the number of entries of in fast memory during a segment of . From the definition of a segment, we can bound . Applying Loomis-Whitney to each multiplication that one might do (some of) during a segment, we can bound the number of multiplications during a segment by . We can now bound subject to the constraint , yielding
This yields the ultimate bandwidth lower bound of . ∎
Both proof techniques also apply to repeated squaring: for , the first proof via the identity
and the second proof by bounding the number of multiplications during a segment by maximizing subject to (here denotes the number of entries of available during a segment).
1.3 Interleaved vs. Phased Sequences of Operations
In some cases, one can combine and interleave basic linear algebra operations, (e.g., a sequence of matrix multiplications) so that the resulting algorithm no longer agrees with Equation (1), although the algorithms for performing each of the basic linear algebra operations separately do agree with Equation (1). This may lead to an algorithm whose minimum communication is not proportional to #flops, but asymptotically better.
Before giving an example, we first observe that a “phased” algorithm, consisting of a sequence of calls to individually optimized basic linear algebra operations (like matrix multiplication), where each such basic linear algebra operation (phase) must complete before the next can begin, can offer no such asymptotic improvements. Indeed, if we perform , … , in phases, where has bandwidth lower bound , then the sequence has bandwidth lower bound . If each is proportional to the operation count of , then is proportional to the total operation count. (the modest improvement arises since we can possibly avoid a little communication by using the results left in fast memory by ).
Let us now look at an example, where the interleaved algorithm can do asymptotically less communication than the phased algorithm: Consider computing the dense matrix multiplications for where .
The idea is that having both and in fast memory lets us do up to evaluations of . Moreover, the union of all these operations does not match Equation (1), since the inputs cannot be indexed in a one-to-one fashion. However, we can still give a non-trivial lower bound as follows, analyzing the algorithm segment by segment. Let us begin with the lower bound, then show an algorithm attaining this lower bound.
No operands in a segment are S2/D2. By the same argument as in Section 2, a maximum of arguments of , and any ’s are available during a segment. We want to bound the number of ’s that we can do during such a segment. Let and denote the number of each type of argument available during the segment. Then by Loomis-Whitney (applied times) the maximum number of ’s is bounded by . We want to maximize subject to the constraint . Applying Cauchy-Schwarz as before yields
The number of segments is thus at least and the number of memory operations at least . This is smaller than the “phased” lower bound for matrix multiplications in sequence, , by an asymptotic factor of .
We next show that this bound is indeed attainable, using a different blocked matrix multiplication algorithm whose block sizes and depend on and (see Algorithm 1). The bandwidth count for this algorithm is as follows. In the innermost loop we read/write blocks of , of words each. So we have reads/writes for the innermost loop. Before this loop we read two blocks (of and ) of words each. This adds up to read/writes. This is performed times. So the total bandwidth count is .
2 The Parallel Case
The techniques in the above Section 5.1 for composing sequential linear algebra operations can be extended to the parallel case in two different ways. When we impose reads and writes to get an algorithm to which our previous lower bounds apply, we need to decide which processor’s memory will participate in those reads and writes. The first option is to create a “twin processor” for each processor, whose memory will hold this data. This doubles the number of processors to which the previous lower bound applies, and also requires us to bound the total memory per processor not by (again assuming memory is balanced among processors) but by the maximum of and the largest number of reads and writes imposed on any processor. The second option is to have all the imposed reads and writes be in the local processor’s memory. This keeps the number of processors constant, but increases by adding the largest number of imposed reads and writes on each processor. The details are algorithm-dependent. For example, similar to the sequential case, we obtain a tight lower bound for repeated matrix multiplication and for repeated matrix squaring.
3 Applications to Graph Algorithms
Matrix multiplication algorithms are used to solve many graph related problems. Thus our lower bounds may hold, as long as the matrix multiplication algorithm that is used agrees with Equation (1). The bounds do not apply when using Strassen-like algorithm (e.g., [YZ05]).
In some cases, one can directly match the flops performed by an algorithm to Equation (1), and obtain a communication lower bound. We next consider, for example, matrix-multiplication-like recursive algorithms for finding the shortest path between any pair of vertices in a graph (the All-Pairs Shortest-Path problem). For tight upper and lower bounds for the bandwidth of Floyd-Warshall and other related algorithms, see [MPP02]. The algorithm works as follows [CLRS01]. Let be the minimum weight of any path from vertex to vertex that contains at most edges, where the weight of the edge is . Then , and the recursive naive algorithm for the All-Pairs Shortest-Path problems performs exactly these computations. If all values are written to slow memory, then, by Theorem 2, the bandwidth lower bound is . Although this may not be the case —some of the intermediate values may never reach the slow memory— there are fewer than intermediate values. Thus, by imposing reads and writes, the bandwidth lower bound is (note that here, similar to the repeated matrix multiplication arguments of Corollary 9, after imposing writes, no two operations use the same two inputs, so Equation 1 applies). Similarly, the recursive algorithm for APSP has intermediate values, therefore, by Theorem 2 and imposing reads and writes, the bandwidth lower bound is .
Note that these lower bounds are attainable. As noted before (see e.g., [CLRS01]) any matrix powering algorithm can be converted into a APSP algorithm, by using ‘’ instead of ‘’ and ‘’ instead of summation. Starting with any of the communication-avoiding optimal matrix-multiplication algorithms (e.g., [FLPR99]) guarantees a bandwidth upper bound of and respectively. Using recursive-block data structure further guarantees optimal latency for both algorithms.
The above repeated-matrix-squaring-like algorithm may, in some cases, perform better than the communication-avoiding implementation of Floyd-Warshall algorithm [MPP02]. Consider the problem of finding the neighbors of distance of every vertex.
One can use the above repeated-matrix-squaring-like algorithm for phases, obtaining a running time of and communication complexity for dense graphs. For sparse input graphs this may further reduce. For example, when is a union of cycles and paths, the running time and communication bandwidth are and (as the degree of a vertex of the th phase is at most ).
If, however, we use the Floyd-Warshall algorithm for this purpose, we have to run it all the way through, regardless of the input graph, resulting in running time of and communication complexity of (assuming the above communication-avoiding implementation). Thus, for the repeated-matrix-squaring-like algorithm performs better for constant-degree inputs, both from flops count and from communication bandwidth perspectives.
Attaining the lower bounds, and open problems
A major problem is to find algorithms that attain the lower bounds described in this paper, for the various linear algebra problems, for dense and sparse matrices, and for sequential and parallel machines. Tables 1 and 2 summarize the current state-of-the-art (to the best of our knowledge) for the communication complexity of dense algorithms. Briefly, all the lower bounds are attainable in the dense sequential case (Table 1), and in the dense parallel case (Table 2, assuming minimal memory per processor, and modulo terms). However, only a few of these algorithms appear in standard libraries like LAPACK [ABB+92] and ScaLAPACK [BCC+97]; the complexity of ScaLAPACK implementations is taken from [BCC+97, Table 5.8]. Other libraries may well attain similar bounds [GGHvdG01, vdG].
Best understood are dense matrix-multiplication, other BLAS routines, and Cholesky, which have algorithms that attain (perhaps modulo factors) both bandwidth and latency lower bounds on parallel machines, and on sequential machines with multiple levels of memory hierarchy. The optimal sequential Cholesky algorithm cited in Table 1 was presented in [AP00], but first analyzed later in [BDHS09]. The complexity of ScaLAPACK’s parallel Cholesky cited in Table 2 assumes that the largest possible block size is chosen ( in line “PxPOSV” in [BCC+97, Table 5.8]).
More recently, optimal dense LU and QR algorithms have been proposed that attain both bandwidth and latency lower bounds in parallel or sequentially (with just 2 levels of memory hierarchy). Interestingly, conventional partial pivoting must apparently be abandoned in order to minimize both latency and bandwidth in LU [DGX08]; we can retain partial pivoting if we only want to minimize bandwidth [Tol97]. Similarly, we must apparently change the standard representation of the Q matrix in QR in order to minimize both latency and bandwidth [DGHL08a]; we can retain the usual representation if we only want to minimize bandwidth [EG98]. See the above references for large speedups reported over algorithms that do not try to minimize communication. The ideas behind communication-optimal dense QR first appear in [GPS88], and include [BLKD07, GG05, EG98]; see [DGHL08a] for a more complete list of references.
ScaLAPACK’s parallel symmetric eigensolver and SVD routine also minimize bandwidth (modulo a factor), but not latency, sending messages. ScaLAPACK’s nonsymmetric eigensolver communicates much more, indeed just the Hessenberg QR iteration has -times higher bandwidth. LAPACK’s symmetric and nonsymmetric eigensolvers and SVD minimize neither bandwidth nor latency, with bandwidth. Recently proposed algorithms in [BDD09, DDH07] for the symmetric and nonsymmetric eigenproblems, generalized nonsymmetric eigenproblems and SVD do appear to attain the desired communication complexity (modulo factors) but at the cost of doing a possibly large constant factor more arithmetic. (This is in contrast to the new dense LU and QR algorithms, which do at most more arithmetic than their conventional counterparts.) We note that our lower bound in Section 4 does not apply to the first phase of the conventional algorithm for the generalized nonsymmetric eigenproblem (reducing the pair to (Hessenberg,triangular) form), but we conjecture that it can be extended to do so. The lower bound does apply for the generalized nonsymmetric eigenvalue algorithm in [BDD09, DDH07].
Otherwise, for , for “3D” parallel algorithms other than matrix-multiplication [ITT04] that replicate data and so use more memory in order to reduce communication, for Strassen-like algorithms, and for sparse matrices in general, the problems are open.
We note that for sufficiently rectangular dense matrices (e.g., matrix-vector multiplication) or for sufficiently sparse matrices, our lower bound may be lower than the trivial lower bound (#inputs + #outputs) and so not be attainable. In this case the natural question is whether the maximum of the two lower bounds is attainable (as it is for dense matrix multiplication).