Report

Scalable Distributed Fast Multipole Methods Qi Hu, Nail A. Gumerov, Ramani Duraiswami Institute for Advanced Computer Studies Department of Computer Science University of Maryland, College Park, MD 1 Previous work • • FMM algorithm for GPUs - Gumerov and Duraiswami (2008) explored the FMM algorithm for GPU - Yokota, et al. (2009) presented FMM on the GPU cluster FMM algorithm for distributed systems - Greengard and Gropp (1990) discussed parallelzing FMM - Ying, et al. (2003): the parallel version of kernel independent FMM - Lashuk, et al. (2009) presented kernel independent adaptive FMM on heterogeneous architectures - Cruz, et al. (2010): the PetFMM library - Hu, et al. (2011): the heterogeneous FMM algorithm - Yokota, et al. (2011): using FMM to simulate turbulence on 4096 GPUs 2 Issues with previous results • Communication data structures: local essential tree - Bottleneck - No details of implementation • Especially, our previous work Hu, et al. (2011): - The L|L translations are not fully distributed - Very large data transfer overheads 3 Contributions • Efficient salable communication management data structures - Classify the spatial boxes - Determine boxes for internode exchange on GPU - Only communicate necessary data - Small amount of communication data • Fully distribute the all parts of FMM among all the nodes • Extremely fast parallel algorithms for FMM data structures - Complexity O(N) and much faster than evaluation steps - Suitable for dynamics problems 4 Motivation: Brownout • Complicated phenomena involving interaction between rotorcraft wake, ground, and dust particles • Causes accidents due to poor visibility and damage to helicopters • Understanding can lead to mitigation strategies • Lagrangian (vortex element) methods to compute the flow • Fast evaluation of the fields at particle locations • Need for fast evaluation of all pairwise 3D interactions 5 Motivation Many other applications require fast evaluation of pairwise interactions with 3D Laplacian kernel and its derivatives Astrophysics (gravity potential and forces) Molecular Dynamics (Coulomb potential and forces) wissrech.ins.uni-bonn.de Micro and Nanofluidics (complex channel Stokes flows) Imaging and Graphics (high quality RBF interpolation) Much More! 6 Introduction to fast multipole methods • Problem: compute matrix-vector product of some kernels • Linear computation and memory cost O(N+M) with any accuracy • Divide the sum to the far field and near field terms • Direct kernel evaluations for the near field • Approximations of the far field sum via the multipole expansions of the kernel function and spatial data structures (octree for 3D) 7 Introduction to the fast multipole method • The local and multipole expansions of the Laplace kernel at the center with the truncation number p rnYnm local spherical basis functions r −(n+1)Ynm multipole spherical basis functions • Expansions regions are validated by well separated pairs realized using spatial boxes of octree (hierarchical data structures) • Translations of expansion coefficients - Multipole to multipole translations (M|M) - Multipole to local translations (M|L) - Local to local translations (L|L) 8 FMM flow chart 1. Build data structures 2. Initial M-expansions 3. Upward M|M translations 4. Downward M|L, L|L translations 5. L-expansions 6. Local direct sum (P2P) and final summation From Java animation of FMM by Y. Wang M.S. Thesis, UMD 2005 9 Issues with distributed algorithms • Halo regions • Incomplete translations 10 Solutions • Distribute the entire computing domain based on the global workload balance • Classify the spatial boxes into 5 categories - Need to calculate box types efficiently - No interruptions on kernel evaluations • A single communication to exchange data of halo regions - Master-slave model - Small overheads • All other computations are performed independently - Fully distributed 11 Heterogeneous architecture 12 Mapping the FMM on CPU/GPU architecture • GPU is a highly parallel, multithreaded, Hundreds of cores many-core processor - Good for repetitive operations on multiple data (SIMD) • CPUs are good for complex tasks with DRAM GPU - Complicated data structures, such as FMM A few cores M|L translation stencils, with complicated patterns of memory access Control ALU ALU ALU ALU • CPU-GPU communications expensive Cache • Profile FMM and determine which parts of FMM go where DRAM CPU 13 FMM on the GPU • Look at implementation of Gumerov & Duraiswami (2008) - M2L translation cost: 29%; GPU speedup 1.6x - Local direct sum: 66.1%; GPU speedup 90.1x • Profiling data suggests - Perform translations on the CPU: multicore parallelization and large cache provides comparable or better performance - GPU computes local direct sum (P2P) and particle related work: SIMD cost 100 80 speedup 60 40 20 0 M-expansion M2M M2L L2L L-expansion Local direct sum 14 Workload distribution • A forest of trees • Workload balance 15 The distributed FMM algorithm on a single node 16 The distributed algorithm on multiple nodes 17 A 2D example 18 Box types • Five types: root, import, export, domestic, other • Each node computes its box types on GPUs with other FMM data structures • Very small overhead • A 2D example 19 Communication overhead • Depend on the input data distribution • It is proportional to - the number of computing node P - the number of boxes in the boundary (halo) regions - Assume the uniform distribution - Cost: 20 Comments on implementations • Other FMM data structures (interaction lists) and heterogeneous implementations - Using the heterogeneous algorithms in Hu, et al. (2011) • All data structures passed to the kernel evaluation engine are compact, i.e. no empty box related structures • The data manager is on the master node and implemented on CPU - Its workload is small - No noticeable gain of its GPU implementation 21 Weak scalability • Compare with Hu et al. (2011) • Reduce both the overheads and kernel evaluations • Fix 8M per node and run tests on 1 ~ 16 nodes • The depth of the octree determines the overhead • The particle density determines the parallel region timing 22 Weak scalability 23 Weak scalability 24 Strong scalability • Fix the problem size to be 8M particles • Run tests on 1 ~ 16 nodes • Direct sum dominates the computation cost - Unless GPU is fully occupied algorithm does not achieve strong scalability - Can choose number of GPUs on a node according to size • Compare with Hu et al. (2011) 25 Strong scalability 26 Strong scalability 27 The billion size test case • Using all 32 Chimera nodes and 64 GPUs • 230 ~1.07 billion particles potential computation in 12.2 s vs 21.6 s in Hu et al. (2011) - 32 M per node Each node: Dual quad-core Intel Nehalem 5560 2.8 GHz processors 24 GB of RAM Two Tesla C1060 GPU 28 Performance count HPCC 2012 SC’11 SC’10 Paper Hu et al. 2012 Hu et al. 2011 Hamada and Nitadori, 2010 Algorithm FMM FMM Tree code Problem size 1,073,741,824 1,073,741,824 3,278,982,596 Flops count 39.7 TFlops on 64 GPUs, 32 nodes 38 TFlops on 64 GPUs, 32 nodes 190 TFlops on 576 GPUs, 144 nodes GPU Tesla C1060: 1.296 GHz 240 cores Tesla C1060: 1.296 GHz 240 cores GTX 295 1.242 GHz 2 x 240 cores 620 GFlops/GPU 593 GFlops/GPU 329 GFlops/GPU 29 Conclusion • Fast communication management data structures - Handle non-uniform distribution - Parallel granularity: spatial boxes - Small overheads • Much improved scalability and performance • The capability of computing million or billion size problems on a single workstation or a middle size cluster • Developed code will be used in solvers for many large scale problems in aeromechanics, astrophysics, molecular dynamics, etc. 30 Questions? Acknowledgments 31