scieee AI-readable full text Open interactive document viewer

Programming matrix algorithms-by-blocks for thread-level parallelism

Quintana-Ortí, Gregorio; Quintana-Orti, Enrique S.; Van de Geijn, Robert A.; Van Zee, Field G.; Chan, Ernie

Abstract

With the emergence of thread-level parallelism as the primary means for continued improvement of performance, the programmability issue has reemerged as an obstacle to the use of architectural advances. We argue that evolving legacy libraries for dense and banded linear algebra is not a viable solution due to constraints imposed by early design decisions. We propose a philosophy of abstraction and separation of concerns that provides a promising solution in this problem domain. The first abstraction, FLASH, allows algorithms to express computation with matrices consisting of blocks, facilitating algorithms-by-blocks. Transparent to the library implementor, operand descriptions are registered for a particular operation a priori. A runtime system, SuperMatrix, uses this information to identify data dependencies between suboperations, allowing them to be scheduled to threads out-of-order and executed in parallel. But not all classical algorithms in linear algebra lend themselves to conversion to algorithms-by-blocks. We show how our recently proposed LU factorization with incremental pivoting and closely related algorithm-by-blocks for the QR factorization, both originally designed for out-of-core computation, overcome this difficulty. Anecdotal evidence regarding the development of routines with a core functionality demonstrates how the methodology supports high productivity while experimental results suggest that high performance is abundantly achievable

Full text

Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism GREGORIO QUINTANA-ORT´ı and ENRIQUE S. QUINTANA-ORT´ı Universidad Jaume I and ROBERT A. VAN DE GEIJN and FIELD G. VAN ZEE and ERNIE CHAN The University of Texas at Austin With the emergence of thread-level parallelism as the primary means for continued performance improvement, the programmability issue has reemerged as an obstacle to the use of architectural advances. We argue that evolving legacy libraries for dense and banded linear algebra is not a viable solution due to constraints imposed by early design decisions. We propose a philosophy of abstraction and separation of concerns that provides a promising solution in this problem domain. The first abstraction, FLASH, allows algorithms to express computation with matrices consisting of contiguous blocks, facilitating algorithms-by-blocks. Operand descriptions are registered for a particular operation a priori by the library implementor. A runtime system, SuperMatrix, uses this information to identify data dependencies between suboperations, allowing them to be scheduled to threads out-of-order and executed in parallel. But not all classical algorithms in linear algebra lend themselves to conversion to algorithms-by-blocks. We show how our recently proposed LU factorization with incremental pivoting and a closely related algorithm-by-blocks for the QR factorization, both originally designed for out-of-core computation, overcome this difficulty. Anecdotal evidence regarding the development of routines with a core functionality demonstrates how the methodology supports high productivity while experimental results suggest that high performance is abundantly achievable. Categories and Subject Descriptors: G.4 [Mathematical Software]: —Efficiency General Terms: Algorithms; Performance Additional Key Words and Phrases: linear algebra, libraries, high-performance, multithreaded architectures Authors’ addresses: Gregorio Quintana-Ort´ı, Enrique S. Quintana-Ort´ı, Departamento de Ingenier´ıa y Ciencia de Computadores, Universidad Jaume I, Campus Riu Sec, 12.071, Castell´on, Spain, {gquintan,quintana}@icc.uji.es. Robert A. van de Geijn, Field G. Van Zee, Ernie Chan, Department of Computer Sciences, The University of Texas at Austin, Austin, TX 78712, {rvdg,field,echan}@cs.utexas.edu. Permission to make digital/hard copy of all or part of this material without fee for personal or classroom use provided that the copies are not made or distributed for profit or commercial advantage, the ACM copyright/server notice, the title of the publication, and its date appear, and notice is given that copying is by permission of the ACM, Inc. To copy otherwise, to republish, to post on servers, or to redistribute to lists requires prior specific permission and/or a fee. c 20YY ACM 0098-3500/20YY/1200-0001 $5.00 ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY, Pages 1–25. 2·G. Quintana-Ort´ı et al. 1. INTRODUCTION For the first time in history, computer architectures are approaching physical and technological barriers which make increasing the speed of a single core exceedingly difficult and economically infeasible. As a result, hardware architects have begun to design microprocessors with multiple processing cores that operate independently and share the same address space. It appears that the advent of these multi-core architectures will finally force a radical change in how applications are programmed. Specifically, developers must consider how to direct the collaboration of many concurrent threads of execution to solve a single problem. In this paper, we present what we believe is a promising solution to what is widely perceived to be a very difficult problem, targeting the domain of dense and banded linear algebra libraries. The approach views submatrices (blocks) as units of data, algorithms as operating on these blocks (algorithms-by-blocks), and schedules the operations on blocks using out-of-order techniques similar to how superscalar processors schedule instructions and resolve dependencies on individual data. Experience gained from parallel computing architectures with complex hierarchical memories has shown that an intricate and interdependent set of requirements must be met in order to achieve the level of performance that scientific applications demand of linear algebra libraries. These requirements include data locality, load balance, and careful attention to the critical path of computation, to name a few. While it may be possible to satisfy this set of constraints when implementing a single operation on a single architecture, addressing them for an entire library of commonly used operations requires one to face the additional challenge of programmability. We propose abandoning essentially all programming conventions that were adopted when widely-used libraries like LINPACK [Dongarra et al. 1979], LAPACK [Anderson et al. 1999], and ScaLAPACK [Choi et al. 1992], denoted by LIN(Sca)LAPACK hereafter, were designed in the last quarter of the 20th century.1To us, nothing associated with programming these libraries is sacred: not the algorithms, not the notation used to express algorithms, not the data structures used to store matrices, not the APIs used to code the algorithms, and not the runtime system that executes the implementations (if one ever existed). Instead we build on the notation, APIs, and tools developed as part of the FLAME project [van de Geijn and Quintana- Ort´ı 2008], which provide modern object-oriented abstractions to increase developer productivity and user-friendliness alike. Perhaps the most influential of these abstractions is one that provides advanced shared-memory parallelism by borrowing out-of-order scheduling techniques from sequential superscalar architectures. From the outset, we have been focused on developing a prototype library that encompasses much of the functionality of the core of LAPACK, including LU, QR and Cholesky factorizations, and related solvers. The LU factorization with pivoting and Householder QR factorizations are key since algorithms-by-blocks for these 1We do not mean to deminish the contributions of the LINPACK and LAPACK projects. We merely suggest that the programming styles used by those packages, while cutting-edge at the time they were developed, need to be reconsidered. We fully recognize that these projects made tremendous contributions to the field of numerical linear algebra beyond the packages that they delivered. ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·3 operations require new algorithms. This is due to the fact that when traditional partial pivoting or traditional Householder transformations are employed, entire columns have to be examined and/or updated, which becomes a synchronization point in the computation [Quintana-Ort´ı et al. 008a; Quintana-Ort´ı et al. 008b]. Fortunately, we had already developed high-performance algorithms for out-of-core computation that were algorithm-by-blocks, except that the block size targeted the movement of data from disk to main memory rather than thread-level parallelism [Gunter and van de Geijn 2005; Joffrain et al. 2004]. Thus, we knew from the start that algorithms-by-blocks were achievable for all of these important operations. We focus on the programmability issue that developers face given that parallelism will be required in order to exploit the performance potential of multi-core and many-core systems. We point to the fact that the parallelization effort described in this paper was conceived in early September 2006. Remarkably, all results presented in this paper were already achieved by September 2007. The key has been a clear separation of concerns between the code that implements the algorithms and the runtime system that schedules tasks. We are not alone in recognizing the utility of a runtime system that dynamically schedules subproblems for parallel execution. The PLASMA project [Buttari et al. 2007; Buttari et al. 2008], independent of our efforts but with LU and QR factorization algorithms that are similarly based on our earlier work on out-of-core algorithms, has developed a similar mechanism in the context of the QR factorization. Like the SuperMatrix system described here and in [Chan et al. 007a; Chan et al. 2008; Chan et al. 007b], the PLASMA system enqueues operation subproblems as “tasks” on a queue, builds a directed acyclic graph (DAG) to encode dependencies, and then executes the subproblems as task dependencies become satisfied [Buttari et al. 2008]. However, as part of [Buttari et al. 2008] they do not provide any source code—neither example code implementing the runtime-aware algorithm nor code implementing the runtime system itself. The same authors expand on their work in [Buttari et al. 2007] to include remarks and results for the Cholesky factorization and LU factorization with incremental pivoting based on our out-of-core algorithm [Joffrain et al. 2004], which we encourage the reader to study. In contrast to the PLASMA project, we directly address the programmability issue. The primary contribution of the present paper lies with the more comprehensive description of how abstraction can be exploited to solve the programmability problem that faces linear algebra library development with the advent of multi-core architectures. In doing so, this paper references a number of conference publications [Chan et al. 007a; Chan et al. 2008; Chan et al. 007b; Quintana-Ort´ı et al. 008a; Quintana-Ort´ı et al. 008b; Quintana-Ort´ı et al. 008c] that provide evidence in support of claims that we make. As such, this is also survey paper. The paper can be viewed as consisting of two parts. The first part describes the methodology. Section 2 provides a motivating example in the form of the LU factorization (without pivoting) and makes the case that the LIN(Sca)LAPACK design philosophies are conducive neither to ease-of-programming nor efficient parallelism. Section 3 discusses algorithms-by-blocks and the challenges they present, and provides an overview of the FLASH API, including an interface for filling ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 4·G. Quintana-Ort´ı et al. Algorithm: A:= LU unb var5(A) Partition A→ AT L AT R ABL ABR ! where AT L is 0 ×0 while n(AT L)< n(A)do Repartition AT L AT R ABL ABR !→0 @ A00 a01 A02 aT 10 α11 aT 12 A20 a21 A22 1 A where α11 is a scalar α11 := α11 (no-op) aT 12 := aT 12 (no-op) a21 := a21/α11 A22 := A22 −a21aT 12 Continue with AT L AT R ABL ABR !←0 @ A00 a01 A02 aT 10 α11 aT 12 A20 a21 A22 1 A endwhile Algorithm: A:= LU blk var5(A) Partition A→ AT L AT R ABL ABR ! where AT L is 0 ×0 while n(AT L)< n(A)do Determine block size b Repartition AT L AT R ABL ABR !→0 @ A00 A01 A02 A10 A11 A12 A20 A21 A22 1 A where A11 is b×b A11 := {L\U}11 =LU unb(A11) A12 := L−1 11 A12 A21 := A21U−1 11 A22 := A22 −A21A12 Continue with AT L AT R ABL ABR !←0 @ A00 A01 A02 A10 A11 A12 A20 A21 A22 1 A endwhile Fig. 1. Unblocked and blocked algorithms (left and right, respectively) for computing the LU factorization (without pivoting). Here, n(B) stands for the number of columns of B. matrices that uses storage-by-blocks. Section 4 gives an overview of the SuperMatrix runtime parallel execution mechanism in the context of the LU factorization. Upon finishing this first part, the reader will understand the general approach and, hopefully, the opportunities that it enables. The second part of the paper argues that the methodology has the potential of solving the programmability problem in the domain of dense and banded linear algebra libraries. It does so primarily by expanding upon results from our other recent conference publications related to the FLAME project, thereby providing better perspective on the new techniques. Section 5 recounts the authors’ work in parallelizing the level-3 Basic Linear Algebra Subprograms (BLAS) operations using SuperMatrix. Section 6 expands the discussion of operations to the LU factorization with partial and incremental pivoting. This section goes into quite a bit more detail because it is important to show how new algorithms can be formulated so that the methodology can be exploited. Section 7 briefly summarizes how these results extend to advanced linear algebra operations. Performance results are reported in Section 8. Finally, Section 9 contains concluding remarks including a discussion of possible future extensions. 2. A MOTIVATING EXAMPLE: THE LU FACTORIZATION WITHOUT PIVOTING The LU factorization (without pivoting) of an n×nmatrix Ais given by A=LU where Lis n×nunit lower triangular and Uis n×nupper triangular. In traditional algorithms for this factorization, the triangular factors overwrite A, with the strictly lower triangular part of Lstored on the subdiagonal elements of Aand the upper triangular part of Ustored on those elements of Aon and above the diagonal. We ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·5 FLA_Error FLA_LU_blk_var5( FLA_Obj A, int nb_alg ) { FLA_Obj ATL, ATR, A00, A01, A02, ABL, ABR, A10, A11, A12, A20, A21, A22; int b; FLA_Part_2x2( A, &ATL, &ATR, &ABL, &ABR, 0, 0, FLA_TL ); while ( FLA_Obj_width( ATL ) < FLA_Obj_width( A ) ) { b = min( FLA_Obj_length(ABR), nb_alg ); FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &A01, &A02, /* ************* */ /* ******************** */ &A10, /**/ &A11, &A12, ABL, /**/ ABR, &A20, /**/ &A21, &A22, b, b, FLA_BR ); /*---------------------------------------------*/ FLA_LU_unb_var5( A11 ); FLA_Trsm( FLA_LEFT, FLA_LOWER_TRIANGULAR, FLA_NO_TRANSPOSE, FLA_UNIT_DIAG, FLA_ONE, A11, A12 ); FLA_Trsm( FLA_RIGHT, FLA_UPPER_TRIANGULAR, FLA_NO_TRANSPOSE, FLA_NONUNIT_DIAG, FLA_ONE, A11, A21 ); FLA_Gemm( FLA_NO_TRANSPOSE, FLA_NO_TRANSPOSE, FLA_MINUS_ONE, A21, A12, FLA_ONE, A22 ); /*---------------------------------------------*/ FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, A01, /**/ A02, A10, A11, /**/ A12, /* *************** */ /* ****************** */ &ABL, /**/ &ABR, A20, A21, /**/ A22, FLA_TL ); } return FLA_SUCCESS; } FLA_Error FLASH_LU_by_blocks_var5( FLA_Obj A ) { FLA_Obj ATL, ATR, A00, A01, A02, ABL, ABR, A10, A11, A12, A20, A21, A22; FLA_Part_2x2( A, &ATL, &ATR, &ABL, &ABR, 0, 0, FLA_TL ); while ( FLA_Obj_width( ATL ) < FLA_Obj_width( A ) ) { FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &A01, &A02, /* ************* */ /* ******************** */ &A10, /**/ &A11, &A12, ABL, /**/ ABR, &A20, /**/ &A21, &A22, 1, 1, FLA_BR ); /*---------------------------------------------*/ FLA_LU_unb_var5( FLASH_MATRIX_AT( A11 ) ); FLASH_Trsm( FLA_LEFT, FLA_LOWER_TRIANGULAR, FLA_NO_TRANSPOSE, FLA_UNIT_DIAG, FLA_ONE, A11, A12 ); FLASH_Trsm( FLA_RIGHT, FLA_UPPER_TRIANGULAR, FLA_NO_TRANSPOSE, FLA_NONUNIT_DIAG, FLA_ONE, A11, A21 ); FLASH_Gemm( FLA_NO_TRANSPOSE, FLA_NO_TRANSPOSE, FLA_MINUS_ONE, A21, A12, FLA_ONE, A22 ); /*---------------------------------------------*/ FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, A01, /**/ A02, A10, A11, /**/ A12, /* *************** */ /* ****************** */ &ABL, /**/ &ABR, A20, A21, /**/ A22, FLA_TL ); } return FLA_SUCCESS; } Fig. 2. Left: FLAME/C implementation of the blocked algorithm in Figure 1 (right). Right: FLASH implementation of the algorithm-by-blocks, which is described in Section 3.3. denote this as A:= {L\U}. 2.1 A typical algorithm In Figure 1 we give unblocked and blocked algorithms, in FLAME notation [Gunnels et al. 2001], for overwriting a matrix Awith the triangular factors Land U. The unblocked algorithm on the left involves vector-vector and matrix-vector operations, which perform O(1) floating-point arithmetic operations (flops) for every memory operation (memop). This ratio renders low performance on current cache-based processors as memops are considerably slower than flops on these architectures. The blocked algorithm on the right of that figure is likely to attain high performance since most computation is cast in terms of the matrix-matrix product (gemm)A22 := A22 −A21A12, which performs O(b) flops for every memop. In [Gunnels et al. 2001] five algorithmic variants for computing the LU factorization are identified. The var5 that is part of the algorithm name indicates the given algorithm corresponds to Variant 5 in that paper. Using the FLAME/C API [Bientinesi et al. 2005], an equivalent blocked algorithm can be represented in code as presented in Figure 2 (left). Comparing and contrasting Figures 1 and 2 (left) shows how the FLAME notation, which departs from the commonly encountered loop-based algorithms, translates more naturally into code when an appropriate API is defined for the target programming language. And thus we abandon conventional algorithm notation and the LIN(Sca)LAPACK style of programming. ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 6·G. Quintana-Ort´ı et al. A11 A21 A12 A22 A11 A21 A12 A22 First iteration Second iteration Fig. 3. First two iterations of the blocked algorithm in Figure 1 (right). 2.2 The trouble with evolving legacy code to multithreaded architectures A commonly employed approach to parallelizing dense linear algebra operations on multithreaded architectures has been to push parallelism into multithreaded versions of the BLAS [Dongarra et al. 1990; Dongarra et al. 1988; Lawson et al. 1979]. The rationale behind this is to make minimal changes to existing codes. In the case of the LU factorization, this means parallelism is attained only within the two trsm and the gemm operations: A12 := L−1 11 A12, A21 := A21U−1 11 , A22 := A22 −A21A12. While we will see that this works well when the matrix is large and there are relatively few processors, a bottleneck forms when the ratio of the matrix dimension to the number of processors is low. In particular, the block size (variable bin Figures 1 (right) and 2 (left), respectively) must be relatively large (in practice, in the 128−256 range) so that the gemm subproblems, which form the bulk of the LU computation, deliver high performance [Goto and van de Geijn 2008]. As a result, the LU factorization of A11, typically computed by only a single processor, leaves other threads idle and therefore hinders parallel efficiency. Thus, this approach to extracting parallelism is inherently limited. One technique that attempts to overcome such a bottleneck is to “compute ahead.” Consider the illustration in Figure 3 of the partitionings of Aat the beginning of the first two iterations of the blocked algorithm for the LU factorization. In this technique, the update of A22 during the first iteration is broken down into the update of the part of A22 that will become A11 in the next iteration (see Figure 3), followed by the update of the rest of A22. This then allows the factorization of the next A11 to be scheduled before the update of the remaining parts of the current A22, thus overcoming the bottleneck. Extensions of this idea compute ahead several iterations in a similar manner. The problem with this idea is that it greatly complicates the code that implements the algorithm if coded in a traditional style [Addison et al. 2003; Kurzak and Dongarra 2006; Strazdins 2001]. While feasible for a single, relatively simple algorithm like the LU factorization without pivoting or the Cholesky factorization, re-implementing a linear algebra library like LAPACK would become a daunting task if this strategy were employed. ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·7 3. ALGORITHMS-BY-BLOCKS Fred Gustavson (IBM) has long advocated an alternative to the blocked algorithms in LAPACK [Agarwal and Gustavson 1989; Elmroth et al. 2004; Gustavson et al. 2007]. The solution, algorithms-by-blocks, proposes algorithms that view matrices as collections of submatrices and express their computation in terms of these submatrix blocks. 3.1 Basic idea The idea is simple. When moving from algorithms that cast most computation in terms of matrix-vector operations to algorithms that mainly operate in terms of matrix-matrix computations, rather than improving performance by aggregating the computation into matrix-matrix computations, the developer should raise the granularity of the data by replacing each element in the matrix by a submatrix (block). Algorithms are then written as before, except with scalar operations replaced by operations on the blocks. For example, consider the LU factorization of the partitioned matrix: A→  A00 a01 A02 aT 10 α11 aT 12 A20 a21 A22  =       ¯α00 . . . ¯α0k. . . ¯α0,n−1 . . ..... . ..... . . ¯αk0. . . ¯αkk . . . ¯αk,n−1 . . ..... . ..... . . ¯αn−1,0. . . ¯αn−1,k . . . ¯αn−1,n−1        where α11 and ¯αij, 0 ≤i, j < n, are all scalars. The unblocked algorithm in Figure 1 (left) can be turned into an algorithm-by-blocks by recognizing that if each element in the matrix is itself a matrix, as in A→  A00 A01 A02 A10 A11 A12 A20 A21 A22  =           ¯ A00 . . . ¯ A0K. . . ¯ A0,N−1 . . ..... . ..... . . ¯ AK0. . . ¯ AKK . . . ¯ AK,N−1 . . ..... . ..... . . ¯ AN−1,0. . . ¯ AN−1,K . . . ¯ AN−1,N−1           with A11 and ¯ Aij , 0 ≤i, j < N, are all b×bblocks, then: (1) α11 := α11(no-op) becomes the LU factorization of the matrix element A11: A11 := {L\U}11 ={¯ L\¯ U}KK . (2) a21 becomes the column vector of blocks A21 so that a21 := a21/α11 is replaced by a triangular solve with multiple right-hand sides with the updated upper triangular matrix in A11 and each of the blocks in A21: A21 := A21U−1 11 =  ¯ AK+1,K . . . ¯ AN−1,K  ¯ U−1 KK =  ¯ AK+1,K ¯ U−1 KK . . . ¯ AN−1,K ¯ U−1 KK  . ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 8·G. Quintana-Ort´ı et al. (3) aT 12 becomes a row vector of blocks A12 so that aT 12 := aT 12(no-op) becomes a triangular solve with multiple right-hand sides with the updated lower triangular matrix in A11 and each of the blocks in A12: A12 := L−1 11 A12 =¯ L−1 KK (¯ AK,K+1 . . . ¯ AK,N−1) = ( ¯ L−1 KK ¯ AK,K+1 . . . ¯ L−1 KK ¯ AK,N−1). (4) Each element in A22 describes a block that needs to be updated via a matrixmatrix product using blocks from the updated vectors of blocks A21 and A12: A22 := A22 −A21A12 =  ¯ AK+1,K+1 . . . ¯ AK+1,N−1 . . ..... . . ¯ AN−1,K+1 . . . ¯ AN−1,N−1  −  ¯ AK+1,K . . . ¯ AN−1,K  (¯ AK,K+1 . . . ¯ AK,N−1) =  ¯ AK+1,K+1 −¯ AK+1,K ¯ AK,K+1 . . . ¯ AK+1,N−1−¯ AK+1,K ¯ AK,N−1 . . ..... . . ¯ AN−1,K+1 −¯ AN−1,K ¯ AK,K+1 . . . ¯ AN−1,N−1−¯ AN−1,K ¯ AK,N−1  . Below we will show that the algorithm-by-blocks approach also facilitates the highperformance implementation and parallel execution of matrix operations on SMP and multi-core architectures. 3.2 Obstacles A major obstacle to algorithms-by-blocks lies with the complexity that is introduced into the code when matrices are manipulated and stored by blocks. A number of solutions have been proposed to solve this problem, ranging from storing the matrix in arrays with four or more dimensions and explicitly exposing intricate indexing into the individual elements [Guo et al. 2008], to template programming using C++ [Valsalam and Skjellum 2002], and to compiler-based solutions [Wise et al. 2001]. None of these have yielded a consistent methodology that allows the development of high-performance libraries with functionality that rivals LAPACK or FLAME. The problem is programmability. 3.3 The FLASH API for algorithms-by-blocks Several recent efforts [Elmroth et al. 2004; Herrero 2006; Low and van de Geijn 2004] follow an approach different from those mentioned above. They view the matrix as a matrix of smaller matrices, just as it is conceptually described. Among these, the FLASH API [Low and van de Geijn 2004], which is an extension of the FLAME API, exploits the fact that FLAME encapsulates matrix information in objects by allowing elements of a matrix to themselves be descriptions of matrices. This approach supports (multi-level) hierarchical storage of matrices by submatrices (blocks). We note that, conceptually, these ideas are by no means new. The notion of storing matrices hierarchically goes back to the early 1970s [Skagestein 1972] and was rediscovered in the 1990s [Collins and Browne 1995]. Using the FLASH API, code for an algorithm-by-blocks for the LU factorization is given in Figure 2 (right). Note the similarity between that implementation and the blocked implementation for the LU factorization on the left of the same figure. That code maintains the traditional layering of subroutine calls that im- ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·9 plement linear algebra operations, which illustrates that we are willing to preserve conventions from the BLAS/LIN(Sca)LAPACK efforts that continue to benefit programmability. However, it is worth pointing out that we actually advocate a deeper layering, one that allows the programmer to invoke routines that assume certain matrix shapes. This design yields potential performance benefits when the underlying BLAS implementation provides interfaces to low-level kernels [Goto and van de Geijn 2008; Marker et al. 2007]. Such an extended matrix multiplication interface can be seen in our use and implementation of FLASH Gebp nn in Figure 4, which assumes a matrix-matrix product where Ais a block and Bis a row-panel. It may seem that complexity is merely hidden in the routines FLASH Trsm, and FLASH Gemm. The abbreviated implementations of these operations shown in Figure 4 demonstrate how the FLASH API is used in the implementation of those routines as well. The reader can see here that many of the details of the FLASH implementation have been buried within the FLASH-aware FLAME object definition. The fact that these algorithms operate on hierarchical matrices (which use storage-by-blocks) manifests itself only through the unit block size, the use of alternative FLASH routines to further break subproblems into tasks with block operands, and an additional FLASH MATRIX AT macro to extract the appropriate submatrix when wrappers to external level-3 BLAS are invoked. As a result, transforming blocked algorithms into algorithms-by-blocks and/or developing algorithms-by-blocks from scratch using the FLASH API is straightforward. 3.4 Filling the matrix A nontrivial matter that has prevented acceptance of alternative data structures for storing matrices has been the interface to the application. Historically, the LIN(Sca)LAPACK approach has granted application direct access to the data. This requires the application programmer to understand how data is stored, which greatly increases the programming burden on the user [Edwards and van de Geijn 2006] particularly when matrices are distributed across processors, as is true for ScaLAPACK, or stored by blocks as discussed in the current paper. Our approach currently supports three alternative solutions. Referencing conventional arrays. Recall that the FLASH API allows matrix elements to contain submatrices. Leaf objects in this hierarchy encapsulate the actual numerical matrix data. Given a matrix stored in conventional column-major order, a FLASH matrix object can be constructed such that the leaf matrices simply refer to submatrices of the user-supplied matrix. Notice that this means the user can access the elements of the matrix as one would when interfacing with a conventional library like LAPACK. The main disadvantage is that the leaf matrices are not stored contiguously. Contributions to a matrix object. We will see that there is a distinct performance benefit to storing leaf matrices contiguously. Also, applications often naturally generate matrices by computing submatrices which are contributed to a larger overall matrix, possibly by adding to a partial result [Edwards and van de Geijn 2006]. For this scenario we provide routines for contribution to a FLASH matrix object. For example, FLASH provides a function whose signature is given by: ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 16 ·G. Quintana-Ort´ı et al. [B, p] := [{L\U}, p] = LUPP blk(B).D B E C-@@ @ D U L E C p Step 2: Update Cconsistent with the factorization of B(using forward substitution): ¯ C:= L−1P(p)C=Trsm llnu(L, P(p)C). @@ @ D U L E C p -@@ @ D U L E ¯ C p Step 3: Factor U D.Compute the LU factorization with partial pivoting: U D, r:= {¯ L\¯ U} ¯ D, r =LUPP SA blk U D. @@ @ D U L E ¯ C p -@@ @ ¯ D ¯ U ¯ L E ¯ C p r Here, ¯ Uoverwrites the upper triangular part of B(where Uwas stored before this operation). The lower triangular matrix ¯ Lthat results needs to be stored separately since both L, computed in Step 1 and used at Step 2, and ¯ Lare needed during the forward substitution stage when solving a linear system. Care must be taken in this step not to completely fill the zeroes below U, which would greatly increase the computational cost of the next step and the storage costs of both this and the next step. The procedure computes a “structure-aware” (SA) LU factorization with partial pivoting, employing a blocked algorithm that combines the LINPACK and LAPACK styles of pivoting. For details, see algorithm LUsa−lin blk in [Quintana-Ort´ı and van de Geijn 2009]. Step 4: Update ¯ C Econsistent with the factorization of U D: ¯ ¯ C ¯ E!:= ¯ L0 ˇ LI!−1 P(r) ¯ C E! =Trsm SA llnu ¯ L0 ˇ LI!, P(r) ¯ C E!!. @@ @ ¯ D ¯ U ¯ L E ¯ C p r -@@ @ ¯ D ¯ U ¯ L ¯ E ¯ ¯ C p r ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·17 for k= 0 : N−1 [Akk, pkk] := LUPP blk(Akk ) for j=k+ 1 : N−1 Akj := Trsm llnu(Akk , P (pkk)Akj ) endfor for i=k+ 1 : N−1 »„Akk Aik «, Lik, pik–:= LUPP SA blk „Akk Aik « for j=k+ 1 : N−1 »„Akj Aij «–:= Trsm SA llnu „tril „„Lik 0 Aik I««, P (pik)„Akj Aij «« endfor endfor endfor Fig. 8. Algorithm-by-blocks for the LU factorization with incremental pivoting. Here, tril(B) stands for the lower triangular part of B. The actual implementation is similar to those in Figures 2 (right) and 4, but for conciseness we present it as loops. Again, care must be taken in this step to exploit the zeroes below the diagonal of the upper triangular matrix produced in the previous step. This structureaware procedure, though not equivalent to a clean triangular system solve (plus the application of the corresponding permutations), can be performed in terms of level-3 BLAS and presents essentially the same computational cost, modulo a lower order term. For details, see algorithm FSsa−lin blk in [Quintana-Ort´ı and van de Geijn 2009]. Step 5: Factor E.Finally, compute the LU factorization with partial pivoting h¯ ¯ E, si:= h{˜ L\˜ U}, si=LUPP blk(¯ E). @@ @ ¯ D ¯ U ¯ L ¯ E ¯ ¯ C p r -@@ @@@ @ ¯ D ¯ U ¯ L˜ U ˜ L ¯ ¯ C p r s Overall, the five steps of the procedure apply Gauss transforms and permutations to reduce Ato the upper triangular matrix ¯ U¯ C 0˜ U!. 6.1.2 An Algorithm-By-Blocks. The insights from the previous section naturally extend to an algorithm-by-blocks for the LU factorization with incremental pivoting [Joffrain et al. 2004; Quintana-Ort´ı et al. 008a]. Consider the partitioning by blocks A=     A00 A01 . . . A0,N−1 A10 A11 . . . A1,N−1 . . .. . ..... . . AN−1,0AN−1,0. . . AN−1,N−1      (2) ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 18 ·G. Quintana-Ort´ı et al. where, for simplicity, Aij, 0 ≤i, j < N, are considered to be of size b×b. Then the algorithm in Figure 8 is a generalization of the algorithm described in Section 6.1.1. While there is some flexibility in the order in which the loops are arranged, the SuperMatrix runtime system, described in Section 4, rearranges the operations, and therefore the exact order of the loops is not important. 6.1.3 Stability. Strictly speaking, the LU factorization with partial pivoting is not numerically stable; theory predicts that so-called element growth proportional to 2nmay occur. It is practice that taught us to rely on this method. In [Quintana- Ort´ı and van de Geijn 2009] we discuss how the stability of incremental pivoting relates to that of partial pivoting and pairwise pivoting [Sorensen 1985]. In summary, incremental pivoting is a blocked variant of pairwise pivoting, being equivalent to partial pivoting when the block size equals the matrix dimension and to pairwise pivoting when the block size is 1. Element growth for partial pivoting is known to be bounded by 4n. Therefore, element growth for incremental pivoting can be expected to be bounded by a factor proportional to 2nand 4n, depending on the block size. The results in [Quintana-Ort´ı and van de Geijn 2009] provide evidence in support of this observation. However, as was the case for partial pivoting, further practical experience will be needed to establish incremental pivoting as being a numerically stable method. 6.2 An algorithm-by-blocks for the QR factorization The QR factorization of an m×nmatrix is given by A=QR where Qis an m×morthogonal matrix and Ris an m×nupper triangular matrix. Although there exist several approaches to compute this factorization, the algorithm based on Householder reflectors [Golub and Loan 1996] is usually chosen when seeking high performance. The QR factorization based on Householder reflectors and the LU factorization with partial pivoting share the property that an updated column is required for a critical computation; in the case of the QR factorization, the k-th column must have been updated with respect to all previous computation before the Householder reflectors that annihilate subdiagonal entries in this column can be computed. This greatly restricts the order in which the computations can be performed. An algorithm-by-blocks for the QR factorization can be obtained following the out-of-core algorithm in [Gunter and van de Geijn 2005]. The algorithm-by-blocks for the QR factorization incurs a certain extra cost when compared with the traditional implementation of the QR factorization via Householder reflectors. This overhead is negligible for matrices of medium and large size. The use of orthogonal transformations ensures that the algorithm-by- blocks and the traditional QR factorization are numerically stable. For details, see [Quintana-Ort´ı et al. 008b]. 6.3 An algorithm-by-blocks for the Cholesky factorization Given a symmetric positive-definite (SPD) matrix A, its Cholesky factorization is given by A=LLT(or A=UTU) where Lis lower triangular (or Uis upper triangular). The construction of an algorithm-by-blocks to obtain the Cholesky factorization is straightforward. The algorithm is illustrated in Figure 9 for an ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·19 for k= 0 : N−1 [Akk] := {Lkk\Akk}=Chol blk(Akk) for i=k+ 1 : N−1 Aik := Lik =AikL−T kk for j=k+ 1 : i Aij := Aij −AikAT jk endfor endfor endfor Fig. 9. Algorithm-by-blocks for the Cholesky factorization. Chol blk(B) refers to a blocked algorithm to compute the Cholesky factorization of B. On completion, this algorithm overwrites the lower triangular part of Bwith its Cholesky factor. The actual implementation is similar to those in Figures 2 (right) and 4, but for conciseness we present it as loops. SPD matrix partitioned as in (2). On completion, the lower triangular part of A is overwritten by the Cholesky factor Lwhile the strictly upper triangular part of the matrix is not modified. This algorithm incurs in the same flop count as the traditional implementation for the Cholesky factorization and the two exhibit the same numerical stability properties. For details, see [Chan et al. 007a]. 7. ADVANCED LAPACK-LEVEL OPERATIONS: BANDED FACTORIZATION AND INVERSION OF MATRICES In this section, we offer a few comments on the development of algorithms-by-blocks for slightly more complex operations: factorization of a banded matrix and matrix inversion. 7.1 Cholesky factorization of banded matrices Consider a banded SPD matrix with bandwidth kd, partitioned into b×bblocks as in (2) so that nonzero entries only appear in the diagonal blocks Akk, the subdiagonal blocks Ak+1,k,...,Amin(N−1,k+D),k and, given the symmetry of the matrix, Ak,k+1,...,Ak,min(N−1,k+D). (If we assume for simplicity that kd+ 1 is an exact multiple of bthen D= (kd+ 1)/b −1.) An algorithm-by-blocks for the Cholesky factorization of this matrix is easily obtained from the algorithm in Figure 9 by changing the upper limit of the second loop to min(N−1, k +D). The ideas extend to provide algorithm-by-blocks for the LU factorization with incremental pivoting and the QR factorization of a banded matrix. One of the advantages of using FLASH in the implementation of banded algorithmby-blocks is that storage of a band matrix does not differ from that of a dense matrix. We can still view the matrix as a matrix of matrices but store only those blocks that contain nonzero entries into the structure. Thus, FLASH easily provides compact storage schemes for banded matrices. For further details, see [Quintana-Ort´ı et al. 008c]. 7.2 Inversion of SPD matrices Traditionally, the inversion of an SPD matrix Ais performed as a sequence of three stages: compute the Cholesky factorization of the matrix A=LLT; invert the ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 20 ·G. Quintana-Ort´ı et al. Cholesky factor L→L−1; and form A−1:= L−TL−1. An algorithm-by-blocks has been given above for the first stage and two more algorithms-by-blocks can be easily formulated for the second and third stages. The result is an alternative algorithmby-blocks that yields much higher performance than one which synchronizes all computation after each stage. For further details, see [Chan et al. 2008]. The same approach provides an algorithm-by-blocks for the inversion of a general matrix via the LU factorization with incremental pivoting. The authors in [Bientinesi et al. 2008] show it is possible to compute these three stages concurrently, and that doing so enhances load-balance on distributedmemory architectures. Since the run-time system performs the operations on blocks out-of-order, no benefit results from a one-sweep algorithm. 8. EXPERIMENTAL RESULTS In this section, we examine various multithreaded codes in order to assess the potential performance benefits offered by algorithms-by-blocks. All experiments were performed using double-precision floating-point arithmetic on two architectures: —A ccNUMA SGI Altix 350 server consisting of eight nodes, each with two 1.5 GHz Intel Itanium2 processors, providing a total of 16 CPUs and a peak performance of 96 GFLOPs (96 ×109floating point operations per second). The nodes are connected via an SGI NUMAlink connection ring and collectively access 32 GBytes of general-purpose physical RAM, with 2 GBytes local to each node. Performance was measured by linking to the BLAS in Intel’s Math Kernel Library (MKL) version 8.1. —An SMP server with eight AMD Opteron processors, each one with two cores clocked at 2.2 GHz, providing a total of 16 cores and a peak performance of 70.4 GFLOPs. The cores in this platform share 64 GBytes of general-purpose physical RAM. Performance was measured by linking to the BLAS in Intel Math Kernel Library (MKL) version 9.1. We report the performance of the following three parallel implementations in Figure 10: —LAPACK: Routines dpotrf (Cholesky factorization), dgeqrf (QR factorization), dgetrf (LU factorization with partial pivoting), and dpbtrf (Cholesky factorization of band matrices) in LAPACK 3.0 linked to multithreaded BLAS in MKL. —MKL: Multithreaded implementation of routines dpotrf,dgeqrf, and dgetrf in MKL. —AB: Our implementation of algorithm-by-blocks, with matrices stored hierarchically using the FLASH API, scheduled with the SuperMatrix runtime system and linked to serial BLAS in MKL. The OpenMP implementation provided by the Intel C Compiler served as the underlying threading mechanism used by SuperMatrix on both platforms. We consider the usual flop counts for the factorizations: n3/3, 4n3/3 and 2n3/3, respectively, for the Cholesky, QR and LU factorizations of a square matrix of order n. The cost of the Cholesky factorization of a matrix with bandwidth kdis ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·21 0 10 20 30 40 50 60 70 80 90 0 2000 4000 6000 8000 10000 GFLOPS Matrix size Cholesky factorization on 16 Intel Itanium [email protected] AB MKL LAPACK 0 10 20 30 40 50 60 70 0 2000 4000 6000 8000 10000 GFLOPS Matrix size Cholesky factorization on 8 dual AMD [email protected] AB MKL LAPACK 0 10 20 30 40 50 60 70 80 90 0 2000 4000 6000 8000 10000 GFLOPS Matrix size QR factorization on 16 Intel Itanium [email protected] AB MKL LAPACK 0 10 20 30 40 50 60 70 0 2000 4000 6000 8000 10000 GFLOPS Matrix size QR factorization on 8 dual AMD [email protected] AB MKL LAPACK 0 10 20 30 40 50 60 70 80 90 0 2000 4000 6000 8000 10000 GFLOPS Matrix size LU factorization on 16 Intel Itanium [email protected] AB MKL LAPACK 0 10 20 30 40 50 60 70 0 2000 4000 6000 8000 10000 GFLOPS Matrix size LU factorization on 8 dual AMD [email protected] AB MKL LAPACK 0 5 10 15 20 25 30 35 40 45 200 400 600 800 1000 1200 GFLOPS Bandwidth Band Cholesky factorization on 16 Intel Itanium [email protected] AB (16 proc.) LAPACK (4 proc.) 0 5 10 15 20 25 30 35 200 400 600 800 1000 1200 GFLOPS Bandwidth Band Cholesky factorization on 8 dual AMD [email protected] AB (16 cores) LAPACK (16 cores) Fig. 10. Performance of the multithreaded factorization algorithms. ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 22 ·G. Quintana-Ort´ı et al. computed as n(k2 d+ 3kd) flops. Note that the algorithms-by-blocks for the QR and LU factorizations actually perform a slightly higher number of flops that represent a lower order term in the overall cost. When hand-tuning block sizes, an effort was made to determine the best values for all combinations of parallel implementations and BLAS. In the evaluation of the band factorization case, the dimension of the matrix was set to 5000. In this case, we report those results corresponding to the most favorable number of processors/cores for each implementation since using a lower number of resources in some cases resulted in a lower execution time. The results show that algorithms-by-blocks clearly outperform the codes in LAPACK and are competitive with highly tuned implementations provided by libraries such as MKL. An interesting question is whether on multithreaded architectures it would be appropriate to instead use libraries such as ScaLAPACK or PLAPACK, which were designed for distributed-memory parallel architectures. In [Bientinesi et al. 2008] we present evidence that, on multithreaded architectures, implementations that extract parallelism only within the BLAS outperform PLAPACK and ScaLAPACK, which use MPI [Gropp et al. 1994]. In this paper we show that extracting parallelism only within the BLAS is inferior to the proposed approach. Thus, by transitivity, the proposed approach can be expected to outperform MPI based libraries like PLAPACK and ScaLAPACK on multithreaded architectures. 9. CONCLUSION While architectural advances promise to deliver a high level of parallelism in the form of many-core platforms, we argue that it is programmability that will determine the success of these architectures. In this paper we have illustrated how the notation, APIs, and tools that are part of the FLAME project provide modern objectoriented abstractions to increase developer productivity and user-friendliness alike in the context of dense and banded linear algebra libraries. One of these abstractions targets multi-core architectures by borrowing dynamic out-of-order scheduling techniques from sequential superscalar architectures. Results for the most significative (dense) matrix factorizations on two shared-memory parallel platforms consisting of a relatively large number of processors/cores illustrate the benefits of our approach. The FLAME project strives to remain forward-looking. By maintaining a clean API design and clear separation of concerns, we streamline the process of taking a new algorithm from whiteboard concept to high-performance parallel implementation. The base FLAME/C API, the FLASH hierarchical matrix extension, and the SuperMatrix runtime scheduling and execution mechanism compliment each other through friendly abstractions that facilitate a striking increase in developer-level productivity as well as uncompromising end-user performance. From the beginning, we have separated the SuperMatrix heuristic used for scheduling tasks from the library that implements the linear algebra operations. In [Chan et al. 007a] we demonstrated the benefits of using different heuristics to schedule suboperations to threads. As part of ongoing efforts, we continue to investigate the effects of different scheduling strategies on overall performance. We do not ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·23 discuss this topic in the present paper because our desire to focus the present paper squarely on the issue of programmability. Another topic for future research is how to take advantage of the FLASH API’s ability to capture multiple levels of hierarchy. Additional information For additional information on FLAME visit http://www.cs.utexas.edu/users/flame/. Acknowledgements This research was partially sponsored by NSF grants CCF–0540926 and CCF– 0702714. Additional support came from the J. Tinsley Oden Faculty Fellowship Research Program of the Institute for Computational Engineering and Sciences (ICES) at UT-Austin. Gregorio Quintana-Ort´ı and Enrique S. Quintana-Ort´ı were supported by the CICYT project TIN2005-09037-C02-02 and FEDER, and projects P1B-2007-19 and P1B-2007-32 of the Fundaci´on Caixa-Castell´on/Bancaixa and UJI. We thank the other members of the FLAME team for their support. We thank John Gilbert and Vikram Aggarwal from the University of California at Santa Barbara for granting access to the neumann platform. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation (NSF). REFERENCES Addison, C.,Ren, Y.,and van Waveren, M. 2003. OpenMP issues arising in the development of parallel BLAS and LAPACK libraries. Scientific Programming 11, 2 (April), 95–104. Agarwal, R. C. and Gustavson, F. G. 1989. Vector and parallel algorithms for Cholesky factorization on IBM 3090. In SC ’89: Proceedings of the 1989 ACM/IEEE Conference on Supercomputing. New York, NY, USA, 225–233. Anderson, E.,Bai, Z.,Bischof, C.,Blackford, L. S.,Demmel, J.,Dongarra, J. J.,Croz, J. D.,Hammarling, S.,Greenbaum, A.,McKenney, A.,and Sorensen, D. 1999. LAPACK Users’ Guide, 3rd ed. Society for Industrial and Applied Mathematics, Philadelphia, PA, USA. Balay, S.,Buschelman, K.,Eijkhout, V.,Gropp, W. D.,Kaushik, D.,Knepley, M. G., McInnes, L. C.,Smith, B. F.,and Zhang, H. 2004. PETSc users manual. Tech. Rep. ANL- 95/11 - Revision 2.1.5, Argonne National Laboratory. Bientinesi, P.,Gunter, B.,and de Geijn, R. A. V. 2008. Families of algorithms related to the inversion of a symmetric positive definite matrix. ACM Transactions on Mathematical Software 35, 1 (July), 1–22. Bientinesi, P.,Quintana-Ort´ ı, E. S.,and van de Geijn, R. A. 2005. Representing linear algebra algorithms in code: The FLAME application programming interfaces. ACM Transactions on Mathematical Software 31, 1 (March), 27–59. Buttari, A.,Langou, J.,Kurzak, J., , and Dongarra, J. 2007. A class of parallel tiled linear algebra algorithms for multicore architectures. LAPACK Working Note 191 UT-CS-07-600, University of Tennessee. September. Buttari, A.,Langou, J.,Kurzak, J.,and Dongarra, J. 2008. Parallel tiled QR factorization for multicore architectures. Concurrency and Computation: Practice and Experience 20, 13 (September), 1573–1590. Chan, E.,Quintana-Ort´ ı, E. S.,Quintana-Ort´ ı, G.,and van de Geijn, R. 2007a. Super- Matrix out-of-order scheduling of matrix operations for SMP and multi-core architectures. In ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. 24 ·G. Quintana-Ort´ı et al. SPAA ’07: Proceedings of the Nineteenth ACM Symposium on Parallelism in Algorithms and Architectures. San Diego, CA, USA, 116–125. Chan, E.,Van Zee, F. G.,Bientinesi, P.,Quintana-Ort´ ı, E. S.,Quintana-Ort´ ı, G.,and van de Geijn, R. 2008. SuperMatrix: A multithreaded runtime scheduling system for algorithms-by-blocks. In PPoPP ’08: Proceedings of the Thirteenth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. Salt Lake City, UT, USA, 123–132. Chan, E.,Van Zee, F. G.,Quintana-Ort´ ı, E. S.,Quintana-Ort´ ı, G.,and van de Geijn, R. 2007b. Satisfying your dependencies with SuperMatrix. In Cluster ’07: Proceedings of the 2007 IEEE International Conference on Cluster Computing. Austin, TX, USA, 91–99. Choi, J.,Dongarra, J. J.,Pozo, R.,and Walker, D. W. 1992. ScaLAPACK: A scalable linear algebra library for distributed memory concurrent computers. In Proceedings of the Fourth Symposium on the Frontiers of Massively Parallel Computation. McLean, VA, USA, 120–127. Collins, T. and Browne, J. C. 1995. Matrix++: An object-oriented environment for parallel high-perfomance matrix computations. In HICSS ’95: Proceedings of the 28th Annual Hawaii International Conference on System Sciences. Maui, HI, USA, 202–211. Dongarra, J. J.,Bunch, J. R.,Moler, C. B.,and Stewart, G. W. 1979. LINPACK Users’ Guide. SIAM, Philadelphia, PA, USA. Dongarra, J. J.,Du Croz, J.,Hammarling, S.,and Duff, I. 1990. A set of level 3 basic linear algebra subprograms. ACM Transactions on Mathematical Software 16, 1 (March), 1–17. Dongarra, J. J.,Du Croz, J.,Hammarling, S.,and Hanson, R. J. 1988. An extended set of Fortran basic linear algebra subprograms. ACM Transactions on Mathematical Software 14, 1 (March), 1–17. Edwards, H. C. and van de Geijn, R. A. 2006. On application interfaces to parallel dense matrix libraries: Just let me solve my problem! FLAME Working Note #18 TR-2006-15, The University of Texas at Austin, Department of Computer Sciences. February. Elmroth, E.,Gustavson, F.,Jonsson, I.,and Kagstrom, B. 2004. Recursive blocked algorithms and hybrid data structures for dense matrix library software. SIAM Review 46, 1, 3–45. Golub, G. H. and Loan, C. F. V. 1996. Matrix Computations, 3rd ed. The Johns Hopkins University Press, Baltimore, MD, USA. Goto, K. and van de Geijn, R. A. 2008. Anatomy of a high-performance matrix multiplication. ACM Transactions on Mathematical Software 34, 3 (May), 1–25. Gropp, W.,Lusk, E.,and Skjellum, A. 1994. Using MPI. The MIT Press. Gunnels, J. A.,Gustavson, F. G.,Henry, G. M.,and van de Geijn, R. A. 2001. FLAME: Formal linear algebra methods environment. ACM Transactions on Mathematical Software 27, 4 (December), 422–455. Gunter, B. C. and van de Geijn, R. A. 2005. Parallel out-of-core computation and updating the QR factorization. ACM Transactions on Mathematical Software 31, 1 (March), 60–78. Guo, J.,Bikshandi, G.,Fraguela, B.,Garzaran, M.,and Padua, D. 2008. Programming with tiles. In PPoPP ’08: Proceedings of the Thirteenth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. Salt Lake City, UT, USA, 111–122. Gustavson, F. G.,Karlsson, L.,and Kagstrom, B. 2007. Three algorithms for Cholesky factorization on distributed memory using packed storage. In PARA ’07: Proceedings of the Workshop on State-of-the-Art in Scientific Computing. Volume 4699 in Lecture Notes in Computer Science. Springer Berlin / Heidelberg, 550–559. Herrero, J. R. 2006. A framework for efficient execution of matrix computations. Ph.D. thesis, Polytechnic University of Catalonia, Spain. Joffrain, T.,Quintana-Ort´ ı, E. S.,and van de Geijn, R. A. 2004. Rapid development of high-performance out-of-core solvers. In PARA ’04: Proceedings of the Workshop on State-of- the-Art in Scientific Computing. Volume 3732 in Lecture Notes in Computer Science. Springer Berlin / Heidelberg, 413–422. Kurzak, J. and Dongarra, J. 2006. Implementing linear algebra routines on multi-core processors with pipelining and a look ahead. LAPACK Working Note 178 UT-CS-06-581, University of Tennessee. September. ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY. Programming Matrix Algorithms-by-Blocks for Thread-Level Parallelism ·25 Lawson, C. L.,Hanson, R. J.,Kincaid, D. R.,and Krogh, F. T. 1979. Basic linear algebra subprograms for Fortran usage. ACM Transactions on Mathematical Software 5, 3 (September), 308–323. Low, T. M. and van de Geijn, R. 2004. An API for manipulating matrices stored by blocks. FLAME Working Note #12 TR-2004-15, The University of Texas at Austin, Department of Computer Sciences. May. Lu, H.,Cox, A. L.,Dwarkadas, S.,Rajamony, R.,and Zwaenepoel, W. 1997. Compiler and software distributed shared memory support for irregular applications. In PPOPP ’97: Proceedings of the Sixth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. Las Vegas, NV, USA, 48–56. Marker, B. A.,Van Zee, F. G.,Goto, K.,Quintana-Ort´ ı, G.,and van de Geijn, R. A. 2007. Toward scalable matrix multiply on multithreaded architectures. In Euro-Par ’07: Proceedings of the Thirteenth International European Conference on Parallel and Distributed Computing. Rennes, France, 748–757. Nieplocha, J.,Harrison, R.,and Littlefield, R. 1996. Global arrays: A nonuniform memory access programming model for high-performance computers. The Journal of Supercomputing 10, 2 (June), 197–220. Quintana-Ort´ ı, E. S. and van de Geijn, R. 2009. Updating an LU factorization with pivoting. ACM Transactions on Mathematical Software. To appear. Quintana-Ort´ ı, G.,Quintana-Ort´ ı, E. S.,Chan, E.,van de Geijn, R.,and Van Zee, F. G. 2008a. Design of scalable dense linear algebra libraries for multithreaded architectures: the LU factorization. In MTAAP ’08: Proceedings of the 2008 Workshop on Multithreaded Architectures and Applications. Miami, FL, USA, 1–8. Quintana-Ort´ ı, G.,Quintana-Ort´ ı, E. S.,Chan, E.,Van Zee, F. G.,and van de Geijn, R. A. 2008b. Scheduling of QR factorization algorithms on SMP and multi-core architectures. In PDP ’08: Proceedings of the Sixteenth Euromicro International Conference on Parallel, Distributed and network-based Processing. Toulouse, France, 301–307. Quintana-Ort´ ı, G.,Quintana-Ort´ ı, E. S.,Rem´ on, A.,and van de Geijn, R. 2008c. An algorithm-by-blocks for SuperMatrix band Cholesky factorization. In VECPAR ’08: Proceedings of the Eighth International Meeting on High Performance Computing for Computational Science. Toulouse, France, 1–13. Skagestein, G. 1972. Rekursiv unterteilte matrizen sowie methoden zur erstellung von rechnerprogrammen fur ihre verarbeitung. Ph.D. thesis, Universitat Stuttgart, Germany. Sorensen, D. C. 1985. Analysis of pairwise pivoting in Gaussian elimination. IEEE Transactions on Computers 34, 3 (March), 274–278. Strazdins, P. 2001. A comparison of lookahead and algorithmic blocking techniques for parallel matrix factorization. International Journal of Parallel and Distributed Systems and Networks 4, 1 (June), 26–35. Toledo, S. 1999. A survey of out-of-core algorithms in numerical linear algebra. In External Memory Algorithms, J. Abello and J. S. Vitter, Eds. American Mathematical Society, Boston, MA, USA, 161–179. Valsalam, V. and Skjellum, A. 2002. A framework for high-performance matrix multiplication based on hierarchical abstractions, algorithms and optimized low-level kernels. Concurrency and Computation: Practice and Experience 14, 10 (August), 805–840. van de Geijn, R. A. 1997. Using PLAPACK: Parallel Linear Algebra Package. The MIT Press. van de Geijn, R. A. and Quintana-Ort´ ı, E. S. 2008. The Science of Programming Matrix Computations.www.lulu.com. von Hanxleden, R.,Kennedy, K.,Koelbel, C. H.,Das, R.,and Saltz, J. H. 1992. Compiler analysis for irregular problems in Fortran D. In LCPC ’92: Proceedings of the Fifth Workshop on Languages and Compilers for Parallel Computing. Volume 757 in Lecture Notes in Computer Science. Springer Berlin / Heidelberg, 97–111. Wise, D. S.,Frens, J. D.,Gu, Y.,and Alexander, G. A. 2001. Language support for Mortonorder matrices. In PPoPP ’01: Proceedings of the Eighth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. Snowbird, UT, USA, 24–33. ACM Transactions on Mathematical Software, Vol. V, No. N, Month 20YY.