arxiv: v1 [hep-lat] 8 Nov 2014

Similar documents
arxiv: v1 [cs.dc] 4 Sep 2014

Accelerating Quantum Chromodynamics Calculations with GPUs

Tuning And Understanding MILC Performance In Cray XK6 GPU Clusters. Mike Showerman, Guochun Shi Steven Gottlieb

Claude Tadonki. MINES ParisTech PSL Research University Centre de Recherche Informatique

Thomas Jefferson National Accelerator Facility

Lattice QCD with Domain Decomposition on Intel R Xeon Phi TM

arxiv: v1 [hep-lat] 31 Oct 2015

Efficient implementation of the overlap operator on multi-gpus

arxiv: v1 [hep-lat] 10 Jul 2012

arxiv: v1 [hep-lat] 7 Oct 2007

arxiv: v1 [hep-lat] 7 Oct 2010

Lattice QCD at non-zero temperature and density

Case Study: Quantum Chromodynamics

Unraveling the mysteries of quarks with hundreds of GPUs. Ron Babich NVIDIA

arxiv: v1 [hep-lat] 23 Dec 2010

Improving many flavor QCD simulations using multiple GPUs

Performance Analysis of Lattice QCD Application with APGAS Programming Model

Measuring freeze-out parameters on the Bielefeld GPU cluster

Lattice Quantum Chromodynamics on the MIC architectures

Practical Implementation of Lattice QCD Simulation on Intel Xeon Phi Knights Landing

arxiv: v1 [hep-lat] 1 Nov 2018

arxiv: v1 [hep-lat] 12 Nov 2014

arxiv: v1 [hep-lat] 28 Aug 2014 Karthee Sivalingam

Thermodynamics using p4-improved staggered fermion action on QCDOC

HYCOM and Navy ESPC Future High Performance Computing Needs. Alan J. Wallcraft. COAPS Short Seminar November 6, 2017

The Blue Gene/P at Jülich Case Study & Optimization. W.Frings, Forschungszentrum Jülich,

A Numerical QCD Hello World

PoS(LAT2005)104. Lattice QFT with FermiQCD

Computational Numerical Integration for Spherical Quadratures. Verified by the Boltzmann Equation

ERLANGEN REGIONAL COMPUTING CENTER

Algebraic Multi-Grid solver for lattice QCD on Exascale hardware: Intel Xeon Phi

On Portability, Performance and Scalability of a MPI OpenCL Lattice Boltzmann Code

Solving Lattice QCD systems of equations using mixed precision solvers on GPUs

Domain Wall Fermion Simulations with the Exact One-Flavor Algorithm

Welcome to MCS 572. content and organization expectations of the course. definition and classification

Julian Merten. GPU Computing and Alternative Architecture

Performance evaluation of scalable optoelectronics application on large-scale Knights Landing cluster

Large-scale Electronic Structure Simulations with MVAPICH2 on Intel Knights Landing Manycore Processors

arxiv: v1 [hep-lat] 19 Jul 2009

Weather and Climate Modeling on GPU and Xeon Phi Accelerated Systems

Exploiting In-Memory Processing Capabilities for Density Functional Theory Applications

arxiv: v1 [hep-lat] 2 May 2012

R. Glenn Brook, Bilel Hadri*, Vincent C. Betro, Ryan C. Hulguin, and Ryan Braby Cray Users Group 2012 Stuttgart, Germany April 29 May 3, 2012

A Massively Parallel Eigenvalue Solver for Small Matrices on Multicore and Manycore Architectures

Konrad-Zuse-Zentrum für Informationstechnik Berlin Takustrasse 7, Berlin, Germany

Lattice simulation of 2+1 flavors of overlap light quarks

The Equation of State for QCD with 2+1 Flavors of Quarks

Implementing NNLO into MCFM

Performance Analysis of Lattice QCD Application with APGAS Programming Model

Some thoughts about energy efficient application execution on NEC LX Series compute clusters

Parallel Transposition of Sparse Data Structures

Lattice Boltzmann simulations on heterogeneous CPU-GPU clusters

591 TFLOPS Multi-TRILLION Particles Simulation on SuperMUC

Towards a highly-parallel PDE-Solver using Adaptive Sparse Grids on Compute Clusters

Performance of the fusion code GYRO on three four generations of Crays. Mark Fahey University of Tennessee, Knoxville

Lattice QCD on Blue Waters

SPECIAL PROJECT PROGRESS REPORT

Performance Evaluation of Scientific Applications on POWER8

Direct Self-Consistent Field Computations on GPU Clusters

arxiv: v1 [hep-lat] 15 Nov 2013

Block AIR Methods. For Multicore and GPU. Per Christian Hansen Hans Henrik B. Sørensen. Technical University of Denmark

arxiv: v1 [hep-lat] 19 Dec 2012

Massively parallel semi-lagrangian solution of the 6d Vlasov-Poisson problem

GPU Acceleration of Cutoff Pair Potentials for Molecular Modeling Applications

Scalable Hybrid Programming and Performance for SuperLU Sparse Direct Solver

SP-CNN: A Scalable and Programmable CNN-based Accelerator. Dilan Manatunga Dr. Hyesoon Kim Dr. Saibal Mukhopadhyay

Piz Daint & Piz Kesch : from general purpose supercomputing to an appliance for weather forecasting. Thomas C. Schulthess

GPU Computing Activities in KISTI

TR A Comparison of the Performance of SaP::GPU and Intel s Math Kernel Library (MKL) for Solving Dense Banded Linear Systems

PoS(LAT2006)208. Diseases with rooted staggered quarks. Michael Creutz Brookhaven National Laboratory, Upton, NY 11973, USA

Accelerating linear algebra computations with hybrid GPU-multicore systems.

PoS(EPS-HEP2011)179. Lattice Flavour Physics

Parallelization of Molecular Dynamics (with focus on Gromacs) SeSE 2014 p.1/29

Massively scalable computing method to tackle large eigenvalue problems for nanoelectronics modeling

arxiv: v2 [hep-lat] 23 Dec 2008

Baryon spectroscopy with spatially improved quark sources

arxiv: v1 [hep-lat] 24 Dec 2008

Performance and Energy Analysis of the Iterative Solution of Sparse Linear Systems on Multicore and Manycore Architectures

arxiv:hep-lat/ v1 5 Oct 2006

Critical end point of Nf=3 QCD at finite temperature and density

A Quantum Chemistry Domain-Specific Language for Heterogeneous Clusters

arxiv: v1 [hep-lat] 30 Oct 2014

A Simple Architectural Enhancement for Fast and Flexible Elliptic Curve Cryptography over Binary Finite Fields GF(2 m )

Static-scheduling and hybrid-programming in SuperLU DIST on multicore cluster systems

Localization properties of the topological charge density and the low lying eigenmodes of overlap fermions

Copyright 2012 The Authors.

arxiv: v1 [hep-lat] 3 Nov 2009

SUPA, School of Physics and Astronomy, University of Glasgow, Glasgow, G12 8QQ, UK

Isospin and Electromagnetism

lattice QCD and the hadron spectrum Jozef Dudek ODU/JLab

Performance of machines for lattice QCD simulations

arxiv: v1 [hep-lat] 18 Aug 2017

The BlueGene/L Supercomputer and Quantum ChromoDynamics

arxiv: v1 [hep-lat] 25 Sep 2014

An Overview of HPC at the Met Office

Solving PDEs with CUDA Jonathan Cohen

Performance Evaluation of MPI on Weather and Hydrological Models

arxiv: v2 [hep-lat] 20 Nov 2014

Weather Research and Forecasting (WRF) Performance Benchmark and Profiling. July 2012

A construction of the Schrödinger Functional for Möbius Domain Wall Fermions

Transcription:

Staggered Dslash Performance on Intel Xeon Phi Architecture arxiv:1411.2087v1 [hep-lat] 8 Nov 2014 Department of Physics, Indiana University, Bloomington IN 47405, USA E-mail: ruizli AT umail.iu.edu Steven Gottlieb Department of Physics, Indiana University, Bloomington IN 47405, USA E-mail: sg AT iub.edu The conjugate gradient (CG) algorithm is among the most essential and time consuming parts of lattice calculations with staggered quarks. We test the performance of CG and dslash, the key step in the CG algorithm, on the Intel Xeon Phi, also known as the Many Integrated Core (MIC) architecture. We try different parallelization strategies using MPI, OpenMP, and the vector processing units (VPUs). The 32nd International Symposium on Lattice Field Theory, 23-28 June, 2014 Columbia University New York, NY Speaker. Current address: Department of Physics, University of Wuppertal, D-42119 Wuppertal, Germany. c Copyright owned by the author(s) under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike Licence. http://pos.sissa.it/

1. Introduction As we aspire to compute at the exascale level, it is clear that power consumption is going to be an essential issue [1]. For the past several years, GPU computing has been explored and exploited to achieve high levels of performance and energy efficiency [2, 3, 4, 5, 6, 7, 8]. Intel has been developing and selling many-core chips that have recently been appearing in computers in the Top 500 list [9]. The Many Integrated Core (MIC) architecture uses simple, energy efficient cores. Intel Xeon Phi processors, based on this architecture, started shipping in late 2012. We have been part of the Beacon Project at the National Institute of Computational Sciences at The University of Tennessee. Beacon, which contains both Intel Xeon and Xeon Phi processors [10], achieved the top spot on the November, 2012 Green500 [11]. In the next section, we provide some background on the Xeon Phi architecture and the options for using it. In Sec. 3, we describe our experience using MPI and a combination of MPI and OpenMP with the MILC code. Section 4 describes our experience using vectorization. We have done that both with the normal MILC layout and with a data layout devised originally for Wilson fermions [12]. Finally, we offer some conclusions. 2. Xeon Phi Background The nodes of Beacon [10] contain two 8-core Intel Xeon E5-2570 and four Xeon Phi 5110P coprocessors. Each coprocessor contains 8 GB of high bandwidth GDDR5 memory. The host node also contains 256 GB of DDR3 memory. The current generation of Xeon Phi coprocessors are named Knights Corner. The 5110P coprocessor has 60 cores and runs at a speed of 1.053 GHz. There are other Xeon Phi coprocessors with 61 cores running at 1.238 GHz and containing 16 GB of memory, as well as coprocessors with only 57 cores and 6 GB of memory. Each Xeon Phi core has a 512 KB L2 cache and separate 32 KB data and instruction L1 caches. Each core is capable of supporting four hardware threads and cannot reach maximum performance without at least two threads assigned to each core. The bulk of the floating point power of the Xeon Phi processor comes from the 512 bit wide SIMD floating point unit that is capable of performing 8 double precision or 16 single precision SIMD operations simultaneously. The Xeon Phi cores and memory controllers are connected in a ring. The guaranteed not to exceed memory bandwidth of the coprocessor GDDR5 memory is 353 GB/s. Achieving something close to half that rate may be possible for well written code. Access to host memory goes through the PCI bus and is much slower. In double precision, the SIMD vector unit which can do a fused multiply-add (FMA) has a peak speed of about 1 TF/s. Using half the peak bandwidth, we expect about 0.174 bytes/flop are available for double precision operations. If one does not try to use the vector unit, the ratio would be 1.4 bytes/flop. Since ordinary arithmetic operations such as add and multiply require 16 bytes of input and 8 bytes of output per flop, it is clear that one needs to reuse data that can remain in cache. Current computers with Xeon Phi coprocessors allow a number of different styles of programming. In offload mode, the code begins running on the Xeon processors and parallel sections of code are directed to the coprocessors using compiler directives (e.g., pragma statements). Data may need to be explicitly copied to the Xeon Phi memory. In native mode, the code is cross com- 2

piled for the MIC architecture, and is launched to run directly on the coprocessors. This is the only mode we have explored. It is also possible to try to use both Xeon and Xeon Phi cores by appropriately breaking up the calculation, or by running two separate jobs. The nodes of the Beacon computer are connected with FDR Infiniband capable of a peak of 56 Gb/s bi-directional bandwidth on each link. 3. MILC with MPI and OpenMP One aspect of Xeon Phi programming is that it should be very easy to recompile code that runs on Xeon processors to run on the Xeon Phi. However, as we shall see, the performance may not be that impressive. The MILC code was originally written to run with a variety of message passing APIs, but for many years MPI [13] and QMP [14] have been the most important options. In 2000, we experimented with a hybrid combination of OpenMP and MPI [15]. However, at that time we did not notice a significant improvement from the combination and dropped the OpenMP pragmas. Motivated by the Xeon Phi, we have again added OpenMP pragmas to the code. Starting from MILC version 7.7.8, we have benchmarked the CG solver for HISQ configuration generation in native mode on Beacon. We considered a multishift solver, as it is an important part of the gauge generation code using the Rational Hybrid Molecular Dynamics or Rational Hybrid Monte Carlo algorithms. We used either 9 or 11 shifts, but only about 50 iterations were required for convergence in our benchmark runs. Using a pure MPI code the performance was between 12 and 16 GF/s on a single coprocessor. Using a combination of OpenMP and MPI, performance increases to 15 to 20 double precision GF/s. The multishift solver uses a large number of SU(3) vectors, both for the solutions and temporaries. Each double precision complex 3-vector takes up 3 2 8 = 48 bytes. Each 3 3 matrix takes up three times that amount. Letting N m be the number of masses, and V be the number of grid points, the memory usage is (36 + 2N m )48V bytes, which includes the 1-link and 3-link matrices and all the SU(3) vectors used in the computation, but ignores the index vectors used for gathers. In our benchmarks N m = 9 or 11. This amounts to 2592 or 2784 bytes per grid point. The number of operations per CG iteration is (1205 + 15N m )V. The bulk of the floating point operations are in dslash, for which we will calculate the arithmetic intensity. For each grid point, the improved staggered dslash must access 16 3 3 complex matrices. For each of the 8 (positive and negative) directions both 1-link and 3-link matrices are needed. We also need 16 3-component complex vectors. The output is a single 3-component complex vector. The operations are 16 matrix-vector multiplies and 15 vector adds. Each matrix-vector multiply requires 36 real multiplies and 30 real adds. Each vector add requires 6 real adds. Thus, at each grid point, there are 576 real multiplies and 576 real adds or 1146 flops. There are 384 operands of input data. This amounts to 2.98 flops per operand. That is 0.75 flops/byte in single precision or 0.37 flops per byte in double precision. The MILC code makes use of a number of temporary vectors not counted above, which would reduce the arithmetic intensity. The ratio peak flops to bandwidth of the Xeon Phi chip is close to three, so it is clear that efficient use of bandwidth and cache reusage will be important for code optimization. Carleton DeTar prepared a test code for benchmarking the single mass CG inverter with OpenMP. With 600 iterations to convergence, he was getting about 42 GF/s on a Xeon Phi co- 3

processor of Stampede at the Texas Advanced Computing Center. Performance slightly increased to about 45 GF/s when running over 1000 iterations. Stampede contains (pre-production) Xeon Phi SE10P coprocessors that have a peak speed of 1.07 TF/s. It is clear that without an effort to vectorize the code, the MILC performance is only 2 4.5 % of the peak speed of the Xeon Phi. 4. Vectorization Our vectorization efforts for staggered quarks are based on the pioneering work with Wilson quarks [12]. The longest vector length in QCD codes is obviously the number of grid points. However, as we are dealing with a SIMD vector unit, not the type of vector unit on early Cray computers that could do gather/scatter at full speed, we need to be very careful about the data layout. In single precision, the SIMD vector length V ECLEN is 16. Because of the even-odd preconditioning in the solver, one possibility is to have the lattice dimension (at least in one direction) be a multiple of 32. However, this is rather restrictive. Thus, it was decided to write a code in which variables from multiple sites in the x-direction are stored contiguously. This strategy is often called structure of arrays. The code supports SOALEN = 4, 8, and 16. However, since SOALEN can be < 16, we need to aggregate values with different y coordinates to fill the vector registers. Thus acceptable grid sizes must be a multiple of SOALEN in the x direction and a multiple of V ECLEN/SOALEN in the y-direction. Further details may be found in Ref. [12]. y VPU: SOALEN x VECLEN Figure 1: With SOALEN = 4 data from four consecutive sites in the x-direction are combined another three groups of four sites with the same parity and larger y coordinates to fill a vector register in the vector processing unit (VPU). 4

Figure 1 shows an x-y plane of the lattice and how points from the grid are aggregated into vector registers. In this case, SOALEN = 4. The MILC data layout for an SU(3) vector is complex KS[3]. In the current code, the data is stored in memory as float KS[3][2][SOALEN], where 3 is for color and 2 is for real and imaginary parts. In registers, the data from different y values is aggregated into the form float KS[3][2][V ECLEN]. This layout is very similar to that used for Wilson quarks where there is an additional spinor index appearing before the color index. The gauge fields in the MILC code are arrays of the form complex Gauge[4][3][3]. In the Xeon Phi code, we allow for compression of the gauge field and we pack sites together in groups of SOALEN or V ECLEN. Thus the array definitions are Gauge[8][GROW S][3][2][SOALEN] or Gauge[8][GROW S][3][2][V ECLEN] where GROW S is 3 for uncompressed storage and 2 if one wants to reconstruct the third row from the first two. In this code, both forward and backward links are stored at each site to increase locality in memory. This avoids referencing backward links from four neighboring sites. The performance study is based on a micro benchmark test code that is not part of a full evolution code. Starting from the Wilson code, it was modified to do naive staggered quarks (ignoring the Kogut-Susskind phase factors that are normally absorbed into the gauge fields). Later, the phase factors were added and finally, the three-link term was added. The code generator for Wilson quarks was modified to generate appropriate intrinsics for staggered operations and for gathering third-nearest neighbors needed for the Naik term. We investigated gauge compression, although with smearing reconstructing the third row from the first two will not suffice for the one-link term. Two lattice grids were used in these tests: 32 3 128 and 32 40 24 96. A technique to improve speed of storing the result of dslash in memory, called streaming stores, was investigated. It avoids a read, modify, write cycle for storing data. We used this technique with SOALEN = 8 and 16. (With SOALEN = 4, stores are not always aligned on cache line boundaries, precluding the use of streaming stores. This would not be so in double precision.) In addition to measuring the rate of floating point operations, we estimate the sustained bandwidth to coprocessor memory. Without gauge field compression, our staggered dslash performance is 138 141 GF/s, and estimated bandwidth is 152 159 GB/s. With gauge compression, the performance increases to 184 193 GF/s, and the bandwidth is reduced to 142 153 GB/s. (The numbers we quote here cover a narrower range than those in Table 1 as more variation was seen with the other grid size.) Including the staggered phases in the reconstruction of the compressed gauge fields did not effect performance very much. It ranged from 179 196 GF/s and the bandwidth estimate was virtually unchanged. We generally found small increases in performance for larger values of SOALEN. Adding the Naik term to the quark action does not result in a large change in performance. Without gauge compression, we see 136 140 GF/s and an estimated bandwidth of 144 149 GB/s. Compressing both the one-link and three-link terms, we see 178-193 GF/s and bandwidth of 130-141 GB/s. (See Table 2.) A real calculation would either use compression only on the three-link term or implement 9-element compression for the smeared links as they are no longer elements of SU(3). Code was required to calculate the three-link products. Since this involves SU(3) matrixmatrix, rather than SU(3) matrix-vector operations, the arithmetic intensity is higher and so is the performance. Without gauge compression, performance is about 184 GF/s, requiring a bandwidth 5

of 134 GB/s. Turning on compression, the performance is about 304 GF/s and bandwidth estimate is 147 GB/s. It might be possible to tune prefetching for the uncompressed case to improve bandwidth and, hence, performance. We also tried to vectorize the naive dslash code with the MILC data layout. Performance was about 50 GF/s. 5. Conclusions We have been developing code for staggered quarks on the Xeon Phi coprocessor and find that with a well designed data layout we can achieve about 185 GF/s in single precision with compression of gauge matrices and about 140 GF/s without compression. Having an appropriate data layout is critical to performance because it is needed to exploit the SIMD vector unit. Memory bandwidth is a critical limitation on code performance. For staggered quarks, we did not find much dependence on SOALEN or whether or not we use streaming stores. We have also attempted to use MPI across multiple coprocessors, but that has not met with much success. The standard implementation of MPI currently has limited performance. There are other implementations of MPI that we would like to try. Although substantial progress has been made, much work remains to produce a production-ready staggered code capable of generating configurations. Streaming store SOALEN Uncompressed Uncompressed Compressed Compressed (GF/s) (GB/s) (GF/s) (GB/s) No 4 139 158 184 147 No 8 140 159 188 150 No 16 139 158 189 152 Yes 8 139 153 187 142 Yes 16 140 154 190 144 Table 1: Performance of naive staggered dslash code for a 32 3 128 grid on a single Xeon Phi coprocessor. Streaming store SOALEN Uncompressed Uncompressed Compressed Compressed (GF/s) (GB/s) (GF/s) (GB/s) No 4 136 145 179 131 No 8 139 149 192 141 No 16 135 144 193 142 Yes 8 140 146 193 137 Yes 16 140 147 193 137 Table 2: Performance of dslash code including Naik term for a 32 3 128 grid on a single Xeon Phi coprocessor. 6

Acknowledgments: This material is based on work supported by the National Science Foundation under Grant Number 1137097 and by the University of Tennessee through the Beacon Project. Any opinions, findings, conclusions, or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation or the University of Tennessee. We are grateful to Glenn Brook, the National Institute of Computational Sciences, and The University of Tennessee for including us in the Beacon Project. We are also very grateful for the extremely helpful engagement of Bálint Joó, and his Intel collaborators Dhiraj D. Kalamkar, Mikhail Smelyanskiy, Karthikeyan Vaidyanathan, and others, upon whose work all the vectorization work was based. We appreciate many useful suggestions on the manuscript from Bálint Joó. This work was supported by DOE grants FG02-91ER 40661 and DE-SC0010120, and by the NSF/University of Tennessee Award A12-0848-S004. References [1] ExaScale Computing Study: Technology Challenges in Achieving Exascale Systems, P. Kogge et al., http://www.cse.nd.edu/reports/2008/tr-2008-13.pdf [2] K. Barros, R. Babich, R. Brower, M. A. Clark and C. Rebbi, PoS LATTICE2008, 045 (2008) [arxiv:0810.5365 [hep-lat]]. [3] R. Babich, M. A. Clark and B. Joo, Proc. Intl. Conf. for High Performance Computing, Networking, Storage and Analysis (Supercomputing 2010), New Orleans, LA, Nov. 2010. [4] M. A. Clark, R. Babich, K. Barros, R. C. Brower and C. Rebbi, Comput. Phys. Commun. 181, 1517 (2010) [arxiv:0911.3191 [hep-lat]]. [5] G. Shi, S. Gottlieb, A. Torok, V. Kindratenko, Proc. Symposium on Application Accelerators in HPC (SAAHPC 10), Knoxville, TN, July 2010. [6] S. Gottlieb, G. Shi, A. Torok and V. Kindratenko, PoS LATTICE 2010, 026 (2010). [7] R. Babich, R. Brower, M. Clark, S. Gottlieb, B. Joo and G. Shi, PoS LATTICE 2011, 033 (2011). [8] R. Babich, M. A. Clark, B. Joo, G. Shi, R. C. Brower and S. Gottlieb, arxiv:1109.2935 [hep-lat]. [9] http://www.top500.org/ [10] https://www.nics.tennessee.edu/computing-resources/beacon/configuration [11] http://www.green500.org/lists/green201211 [12] B. Joó et al., ISC 2013, Lecture Notes in Computer Science, Vol. 7905, 40 (2013), J.M Kunkel, T. Ludwid, and WH.W. Meuer (Eds.). [13] http://www.mpi-forum.org [14] http://usqcd-software.github.io/qmp/ [15] S. A. Gottlieb and S. Tamhankar, Nucl. Phys. Proc. Suppl. 94, 841 (2001) [hep-lat/0011037]. 7