# exposing fine-grained parallelism in algebraic multigrid ... exposing fine-grained parallelism in

Post on 30-Jul-2018

216 views

Embed Size (px)

TRANSCRIPT

EXPOSING FINE-GRAINED PARALLELISM IN ALGEBRAICMULTIGRID METHODS

NATHAN BELL , STEVEN DALTON , AND LUKE N. OLSON

Abstract. Algebraic multigrid methods for large, sparse linear systems are a necessity in manycomputational simulations, yet parallel algorithms for such solvers are generally decomposed intocoarse-grained tasks suitable for distributed computers with traditional processing cores. However,accelerating multigrid on massively parallel throughput-oriented processors, such as the GPU, de-mands algorithms with abundant fine-grained parallelism. In this paper, we develop a parallelalgebraic multigrid method which exposes substantial fine-grained parallelism in both the construc-tion of the multigrid hierarchy as well as the cycling or solve stage. Our algorithms are expressedin terms of scalable parallel primitives that are efficiently implemented on the GPU. The resultingsolver achieves an average speedup of over 2 in the setup phase and around 6 in the cycling phasewhen compared to a representative CPU implementation.

Key words. algebraic multigrid, parallel, sparse, gpu, iterative

AMS subject classifications. 65-04, 68-04, 65F08, 65F50, 68W10

1. Introduction. Throughput-oriented processors, such as graphics processingunits (GPUs), are becoming an integral part of many high-performance computingsystems. In contrast to traditional CPU architectures, which are optimized for com-pleting scalar tasks with minimal latency, modern GPUs are tailored for parallel work-loads that emphasize total task throughput [17]. Therefore, harnessing the computa-tional resources of the such processors requires programmers to decompose algorithmsinto thousands or tens of thousands of separate, fine-grained threads of execution. Un-fortunately, the parallelism exposed by previous approaches to algebraic multigrid istoo coarse-grained for direct implementation on GPUs.

Algebraic multigrid methods solve large, sparse linear systems Ax = b by con-structing a hierarchy of grid levels directly from the matrix A. In this paper, weconsider effective implementations of algebraic multigrid methods for GPUs. Westudy the components that comprise the two distinct phases in AMG (i.e., the setupand solve phases) and demonstrate how they can be decomposed into scalable parallelprimitives.

Parallel approaches to multigrid are plentiful. Algebraic multigrid methods havebeen successfully parallelized on distributed-memory CPU clusters using MPI [12, 10]and more recently with a combination of MPI and OpenMP [2], to better utilizemulti-core CPU nodes. While such techniques have demonstrated scalability to largenumbers of processors, they are not immediately applicable to the GPU. In partic-ular, effective use of GPUs requires substantial fine-grained parallelism at all stagesof the computation. In contrast, the parallelism exposed by existing methods fordistributed-memory clusters of traditional cores is comparably coarse-grained andcannot be scaled down to arbitrarily small subdomains. Indeed, coarse-grained par-allelization strategies are qualitatively different than fine-grained strategies.

For example, it is possible to construct a successful parallel coarse-grid selectionalgorithm by partitioning a large problem into sub-domains and applying an effective,

NVIDIA Research, nbell@nvidia.com, http://www.wnbell.comDepartment of Computer Science, University of Illinois at Urbana-Champaign, Urbana, IL

61801, dalton6@illinois.eduDepartment of Computer Science, University of Illinois at Urbana-Champaign, Urbana, IL

61801, lukeo@illinois.edu, http://www.cs.illinois.edu/homes/lukeo

1

2 Bell, Dalton, Olson

serial heuristic to select coarse-grid nodes on the the interior of each sub-domain, fol-lowed by a less-effective but parallel heuristic to the interfaces between sub-domains[23]. An implicit assumption in this strategy is that the interiors of the partitions(collectively) contain the vast majority of the entire domain, otherwise the serialheuristic has little impact on the output. Although this method can be scaled downto arbitrarily fine-grained parallelism in principle, the result is qualitatively different.In contrast, the methods we develop do not rely on partitioning and expose paral-lelism to the finest granularity i.e., one thread per matrix row or one thread pernonzero entry.

Geometric multigrid methods were the first to be parallelized on GPUs [20, 9, 34].These GPGPU approaches, which preceded the introduction of the CUDA andOpenCL programming interfaces, programmed the GPU through existing graphicsapplication programming interfaces (APIs) such as OpenGL and Direct3d. Subse-quent works demonstrated GPU-accelerated geometric multigrid for image manipula-tion [26] and CFD [13] problems. Previous works have implemented the cycling stageof algebraic multigrid on GPUs [19, 22], however hierarchy construction remained onthe CPU. A parallel aggregation scheme is described in [35] that is similar to oursbased on maximal independent sets, while in [1] the effectiveness of parallel smoothersbased on sparse matrix-vector products is demonstrated. Although these works wereimplemented for distributed CPU clusters, they are amenable to fine-grained paral-lelism as well.

In Section 1.2, we review the components of the setup and solve phases of AMG,noting the principal challenge in targeting GPU acceleration. Our approach to theGPU is to describe the components of multigrid in terms of parallel primitives, whichwe define in Section 2. In Section 3 we detail our specific approach to exposingfine-grained parallelism in the components of the setup phase, and in Section 4, wehighlight the value of the sparse matrix-vector product in the computation. In Section5 we discuss several performance results of our method on the GPU in comparisonto the efficiency we observe on a standard CPU. Finally, in the Appendix we provideadditional details of a parallel aggregation method.

1.1. Background. Multigrid methods precondition large, sparse linear systemsof equations and in recent years have become a robust approach for a wide range ofproblems. One reason for this increase in utility is the trend toward more algebraic ap-proaches. In the classical, geometric form of multigrid, the performance relies largelyon specialized smoothers, and a hierarchy of grids and interpolation operators that arepredefined through the geometry and physics of the problem. In contrast, algebraic-based multigrid methods (AMG) attempt to automatically construct a hierarchy ofgrids and intergrid transfer operators without explicit knowledge of the underlyingproblem i.e., directly from the linear system of equations [32, 37]. Removing therequirement of geometric information increases the applicability of AMG to problemswith complicated domains and unstructured grids, but also places increased demandson the sparse matrix algorithms.

In the remainder of this section, we outline the basic components of AMG inan aggregation context [37] and highlight the necessary sparse matrix computationsused in the process. We restrict our attention to aggregation methods because ofthe flexibility in the construction, however our development also extends to classicalAMG methods based on coarse-fine splittings [32].

1.2. Components of Algebraic Multigrid. Central to algebraic-based multi-grid methods is the concept of algebraically smooth error. That is, error modes not

Fine-Grained Parallelism in AMG 3

sufficiently reduced by a relaxation method such as weighted Jacobi, Gauss-Seidel,Chebyshev, or Kaczmarz, are considered algebraically smooth and must be handledby coarse-grid correction. Aggregation-based methods are designed to accurately rep-resent such low-energy modes by construction. Specifically, the interpolation opera-tors, which transfer solutions between the coarse and find grid, are defined by insistingthat a given set of low-energy modes on the fine grid, referred to as near-nullspacecandidates, are represented exactly on the coarse grid. The performance of AMGrelies on a compatible collection of relaxation operators, coarse grid operators, andinterpolation operators as well as the efficient construction of these operations. Inthis section we outline the components of aggregation-based AMG that we considerfor construction on the GPU.

Aggregation-based AMG requires a a priori knowledge or prediction of the near-nullspace that represent the low-energy error. For an nn symmetric, positive-definite matrix problem Ax = b, these m modes are denoted by the nm columnmatrix B. Generally, the number of near-nullspace modes (m) is a small, problem-dependent constant. For example, the scalar Poisson problem requires only a singlenear-nullspace mode while 6 rigid body modes are needed to solve three-dimensionalelasticity problems. We also denote the nn problem as the fine level and labelthe indices 0 = {0, . . . , n} as the fine grid. From A, b, and B, the componentsof the solver are defined through a setup phase, and include grids k, interpolationoperators Pk, restriction operators Rk, relaxation error propagation operators, andcoarse representations of the matrix operator Ak, all for each level k. We denote indexM as the maximum level e.g., M = 1 is a two-grid method.

1.2.1. Setup Phase. We follow a setup phase that is outlined in Algorithm 1.The following sections detail each of the successive routines in the setup phase:strength, aggregate, tentative, prolongator, and the triple matrix Galerkin prod-uct. One of the goals of this paper is to systematically consider the sparse matrixoperations in Lines 1-6.

Algorithm 1: AMG Setup: setup

parameters: A, sparse problem matrixB, m low-energy vectors

return: A0, . . . , AM , hierarchy of matrix operatorsP0, . . . , PM1, hierarchy of interpolation matrices

A0 A, B0 Bfor k = 0