43
Challenges in Programming Extreme Scale Systems William Gropp wgropp.cs.illinois.edu

Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Challenges in Programming Extreme Scale Systems

William Gropp wgropp.cs.illinois.edu

Page 2: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Some Likely Exascale Architectures

2

June 19, 2016 2

Figure 1: Core Group for Node

Figure 2: Basic Layout of a Node Sunway TaihuLight •  Heterogeneous

processors (MPE, CPE)

•  No data cache •  Tianhe2a has

some data cache

3D StackedMemory

(Low Capacity, High Bandwidth)

FatCore

FatCore

Thin Cores / Accelerators

DRAMNVRAM

(High Capacity, Low Bandwidth)

Coherence DomainCoreIntegrated NICfor Off-Chip

Communication

Figure 2.1: Abstract Machine Model of an exascale Node Architecture

2.1 Overarching Abstract Machine Model

We begin with a single model that highlights the anticipated key hardware architectural features that maysupport exascale computing. Figure 2.1 pictorially presents this as a single model, while the next subsectionsdescribe several emerging technology themes that characterize more specific hardware design choices by com-mercial vendors. In Section 2.2, we describe the most plausible set of realizations of the single model that areviable candidates for future supercomputing architectures.

2.1.1 Processor

It is likely that future exascale machines will feature heterogeneous nodes composed of a collection of morethan a single type of processing element. The so-called fat cores that are found in many contemporary desktopand server processors characterized by deep pipelines, multiple levels of the memory hierarchy, instruction-levelparallelism and other architectural features that prioritize serial performance and tolerate expensive memoryaccesses. This class of core is often optimized to run a small number of hardware threads with an emphasis one�cient execution of system services, system runtime, or an operating system.

The alternative type of core that we expect to see in future processors is a thin core that features a lesscomplex design in order to use less power and physical die space. By utilizing a much higher count of the thinnercores a processor will be able to provide high performance if a greater degree of parallelism is available in thealgorithm being executed.

Application programmers will therefore need to consider the uses of each class of core; a fat core willprovide the highest performance and energy e�ciency for algorithms where little parallelism is available orthe code features complex branching schemes leading to thread divergence, while a thin core will provide thehighest aggregate processor performance and energy e�ciency where parallelism can be exploited, branching isminimized and memory access patterns are coalesced.

2.1.2 On-Chip Memory

The need for more memory capacity and bandwidth is pushing node architectures to provide larger memorieson or integrated into CPU packages. This memory can be formulated as a cache if it is fast enough or,alternatively, can be a new level of the memory system architecture. Additionally, scratchpad memories (SPMs)are an alternate way for cache to ensure a low latency access to data. SPMs have been shown to be more energy-e�cient, have faster access time, and take up less area than traditional hardware cache [14]. Going forward,on-chip SPMs will be more prevalent and programmers will be able to configure the on-chip memory as cache

6

From “Abstract Machine Models and Proxy Architectures for Exascale Computing Rev 1.1,” J Ang et al

Adapteva Epiphany-V •  1024 RISC

processors •  32x32 mesh •  Very high power

efficiency (70GF/W)

Page 3: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

New Applications Will Be As Varied and Demanding • Wide range of applications today

•  More than CFD, Structural Mechanics, Molecular dynamics, QCD •  Include image processing, event-driven simulations, graph analytics

•  Rising importance of machine learning and Imitation Intelligence •  The appearance of intelligence without anything behind it •  Still incredibly powerful and useful, but … •  Not Artificial intelligence

•  Intelligence achieved through artificial means •  Training required for each “behavior” (one reason this is II, not AI) •  Current methods require large amounts of data and compute to train;

application of the trained system is not (relatively speaking) computationally intensive

• Workflows involving all of the above •  One example:

•  Use Einstein Toolkit to compute gravity waves from cataclysmic events •  This is classic time-dependent PDE solution

•  Use waveforms to train a machine learning system •  Use that system to provide (near) real time detection of gravity waves from aLIGO

•  Many workflow-related events at SC

Page 4: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

The Easy Part – Internode communication

• Often focus on the “scale” in Exascale as the hard part

• How to deal with a million or a billion processes? • But really not too hard

•  Many applications have large regions of regular parallelism • Or nearly impossible

•  If there isn’t enough independent parallelism • Challenge is in handling definition and operation on distributed data structures

• Many solutions for the internode programming piece

Page 5: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Modern MPI

• MPI is much more than message passing •  I prefer to call MPI a programming system

•  Because it implements several programming models

• Major features of MPI include •  Rich message passing, with nonblocking, thread safe, and persistent

versions •  Rich collective communication methods •  Full-featured one-sided operations

•  Many new capabilities over MPI-2 •  Include remote atomic update

•  Portable access to shared memory on nodes •  Process-based alternative to sharing via threads •  (Relatively) precise semantics

•  Effective parallel I/O that is not restricted by POSIX semantics •  But see implementation issues …

•  Perhaps most important •  Designed to support “programming in the large” – creation of libraries and tools

Page 6: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

There are challenges

• Implementations not always as efficient as they could / should be

• One sided notification still limited (and under discussion) • A standard moves slowly (and it should)

• But a drawback when architectural innovation is fast • We need examples that go past MPI

•  But they don’t need to replace MPI

Page 7: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

MPI (The Standard) Can Scale Beyond Exascale

• MPI implementations already supporting more than 1M processes

•  Several systems (including Blue Waters) with over 0.5M independent cores • Many Exascale designs have a similar number of nodes as today’s systems

• MPI as the internode programming system seems likely • There are challenges

• Connection management • Buffer management • Memory footprint •  Fast collective operations • … • And no implementation is as good as it needs to be, but •  There are no intractable problems here – MPI implementations can

be engineered to support Exascale systems, even in the MPI-everywhere approach

Page 8: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Applications Still Mostly MPI-Everywhere

• “the larger jobs (> 4096 nodes) mostly use message passing with no threading.” – Blue Waters Workload study, https://arxiv.org/ftp/arxiv/papers/1703/1703.00924.pdf

• Benefit of programmer-managed locality • Memory performance nearly stagnant (will HBM save us?) • Parallelism for performance implies locality must be managed

effectively • Benefit of a single programming system

• Often stated as desirable but with little evidence • Common to mix Fortran, C, Python, etc. • But…Interface between systems must work well, and often don’t

•  E.g., for MPI+OpenMP, who manages the cores and how is that negotiated?

Page 9: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

MPI is not a BSP system

• BSP = Bulk Synchronous Programming • Programmers like the BSP model, adopting it even when not

necessary (see “A Formal Approach to Detect Functionally Irrelevant Barriers in MPI Programs”)

• Unlike most programming models, designed with a performance model to encourage quantitative design in programs

• MPI makes it easy to emulate a BSP system • Rich set of collectives, barriers, blocking operations

• MPI (even MPI-1) sufficient for dynamic adaptive programming

•  The main issues are performance and “progress” •  Improving implementations and better HW support for integrated

CPU/NIC coordination the answer

Page 10: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

MPI On Multicore Nodes

• MPI Everywhere (single core/single thread MPI processes) still common

•  Easy to think about •  We have good performance models (or do we?)

•  In reality, there are issues •  Memory per core declining

•  Need to avoid large regions for data copies, e.g., halo cells •  MPI implementations could share internal table, data structures

•  May only be important for extreme scale systems •  MPI Everywhere implicitly assume uniform communication cost model

•  Limits algorithms explored, communication optimizations used

• Even here, there is much to do for •  Algorithm designers •  Application implementers •  MPI implementation developers

• One example: Can we use the single core performance model for MPI?

Page 11: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Rates Per MPI Process

• Ping-pong between 2 nodes using 1-16 cores on each node

• Top is BG/Q, bottom Cray XE6

• “Classic” model predicts a single curve – rates independent of the number of communicating processes

Ban

dwid

th

Ban

dwid

th

Page 12: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Why this Behavior?

• The T = s + r n model predicts the same performance independent of the number of communicating processes

• What is going on? • How should we model the time for communication?

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

NIC

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

MPI Process

NIC

Page 13: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

A Slightly Better Model

• For k processes sending messages, the sustained rate is

• min(RNIC-NIC, k RCORE-NIC) • Thus

• T = s + k n/min(RNIC-NIC, k RCORE-NIC) • Note if RNIC-NIC is very large (very fast network), this reduces to

• T = s + k n/(k RCORE-NIC) = s + n/RCORE-NIC

• KNL may need a similar term for s: s+max(0,(k-k0)si) , representing an incremental additional cost once more than k0 concurrently communicating processes

Page 14: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Comparison on Cray XE6

Measured Data Max-Rate Model Modeling MPI Communication Performance on SMP Nodes: Is it Time to Retire the Ping Pong Test, W Gropp, L Olson, P Samfass, Proceedings of EuroMPI 16,

https://doi.org/10.1145/2966884.2966919

Page 15: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

More Challenges For Extreme Scale Systems

• Simple MPI everywhere models hide important performance issues •  Impacts algorithms – ex SpMV

• MPI implementations don’t take nodes into account •  Impacts memory overhead, data sharing •  Process topology – Dims_create (for Cart_create) wrong API – ex nodecart

• File I/O bottlenecks •  Metadata operations impact scaling, even for file/process (or should it be

file per node?) •  Need to monitor performance; avoid imposing too much order on

operations – ex MeshIO • Communication synchronization

•  Common “bogeyman” for extreme scale •  But some of the best algorithms use, e.g., Allreduce •  Reorder operations to reduce communication cost; permit overlap •  Ex scalable CG algorithms and implementations

Page 16: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Node-Aware Sparse Matrix-Vector Product

• Sparse matrix-vector products the core to many algorithms

• E.g., in Krylov methods and in stencil application

• “Good” mappings of processes to nodes for locality also mean that the same data may be needed for different processes on the same node

• Can significantly improve performance by trading intra-node for internode communication…

• Work of Amand Bienz and Luke Olson

Reducing Communication Costs in Parallel Algebraic Multigrid (AMG)Amanda Bienz, Luke Olson (advisor), William D. Gropp (mentor)

University of Illinois at Urbana-Champaign

This research is part of the Blue Waters sustained-petascale computing project, which is supported by the National Science Foundation (awards OCI-0725070 and ACI-1238993) and the state of Illinois. Blue Waters is a joint effort of the University of Illinois at Urbana-Champaign and its National Center for Supercomputing Applications.

This material is based upon work supported by the National Science Foundation Graduate Research Fellowship Program under Grant Number DGE-1144245.

• Hypre:Highperformancepreconditioners.http://www.llnl.gov/CASC/hypre/• MFEM:Finiteelementdiscretizationlibrary.http://mfem.org• FloridaSparseMatrixCollection.http://www.cise.ufl.edu/research/sparse/matrices/

Contact [email protected]

http://web.engr.illinois.edu/~bienz2/

• Performance model: find source of large communication costs • All communication is not equal

• Additional penalty per link traversed beyond initial• Additional penalty for limiting bandwidth to injection limits• Additional penalty for maximum possible bytes to traverse any

link (upper bound) and average number of bytes (lower bound)

• In progress: incorporating max-rate model parameters, improving network contention measure, and modeling queue search time

Performance Models

Altering Parallel Implementation with Topology-Aware Methods

Altering Algorithm through Sparsification

Current & Future Work

• Algebraic multigrid (AMG): sparse linear solver used to solve systems resulting from PDEs, lacks parallel scalability

Introduction & Background

Topology-Aware Communication

• Apply topology-aware parallel communication to the sparse matrix-vector multiply (SpMV) and sparse matrix-sparse matrix multiply (SpGEMM) at each level of multigrid hierarchy for MFEM linear elasticity

• Blue Waters partition of 8192 processes• Reduces number and size of inter-node messages, at cost of

extra intra-node communication, reducing total cost

TAPSpMV and TAPSpGEMM Results

R0r0

R1r1 P1e2

P0e1

e2 = A�12 r2

Two Phases:1. Setup phase: hierarchy of

coarse levels is created2. Iterative solve phase: initial

guess is iteratively improved until convergence

• Main Idea: Remove small values from coarse levels• Based on method of non-Galerkin coarse grids• Form full hierarchy before removing values from coarse level

A0 P0

A1 P1

A2

A0 P0

A1 P1

A2

A1

A2

A0 P0

A1 A1 P1

A2 A2

A0 P0

A1 P1

A2

A1

A2

Galerkin

Dependencies:

Non-Galerkin Sparse Galerkin

HybridGalerkin

• Form sparsity pattern:

where is injection• Remove value if not in

and magnitude less than times

• Add value to diagonal

PM = PTAP + PTAP

M� magnitude of max off-diagonal in row

Sparsification Process:

n m

q

n m

p

q

n

p

Standard

Topology-Aware

Inter-nodeIntra-node

• Modern parallel computers have:

• All processes holding data needed by process q, send directly to q

• Large number of nodes• Many processes per node

• Want to limit inter-node communication

• Intra-node messages still sent directly

• All messages to be sent from node n to node m are first sent to process p

• Sent as single message to process q• Process q redistributes to processes on node m• Note: assumes many nodes in partition, so all local processes are sending and

receiving, but only a single message between any two nodes

TAPSpMV Communication

0 5 10 15 20 25AMG Level

100

101

102

103

104

Max

Num

ber

ofM

essa

ges

ref. SpMV TAPSpMV

0 5 10 15 20 25AMG Level

100

101

102

103

104

Max

Num

ber

ofM

essa

ges

ref. SpMV TAPSpMV

0 5 10 15 20 25AMG Level

10�1

100

101

102

103

104

Max

Mes

sage

sSi

ze(b

ytes

)

ref. SpMV TAPSpMV

0 5 10 15 20 25AMG Level

10�1

100

101

102

103

104

Max

Mes

sage

sSi

ze(b

ytes

)

ref. SpMV TAPSpMV

0 5 10 15 20 25AMG Level

10�5

10�4

10�3

10�2

10�1

Tim

e(s

econ

ds)

ref. SpMV TAPSpMV

Number intra-node Size intra-node

Size inter-nodeNumber inter-node

0 2 4 6 8 10 12 14 16 18AMG Level

101

Max

imum

Num

ber

ofM

essa

ges

ref. Matmult TAPMatmult

0 2 4 6 8 10 12 14 16 18AMG Level

101

102

103

Max

imum

Num

ber

ofM

essa

ges

ref. Matmult TAPMatmult

0 2 4 6 8 10 12 14 16 18AMG Level

104

105

106

107

Max

imum

Size

ofM

essa

ges

ref. Matmult TAPMatmult

0 2 4 6 8 10 12 14 16 18AMG Level

105

106

107

108

Max

imum

Size

ofM

essa

ges

ref. Matmult TAPMatmult

0 2 4 6 8 10 12 14 16 18AMG Level

10�3

10�2

10�1

Tim

e(s

econ

ds)

ref. Matmult TAPMatmult

TAPSpGEMM Communication

Number intra-node Size intra-node

Size inter-nodeNumber inter-node

TAPSpMV Times TAPSpGEMM Times

101 102 103 104 105

Number of Bytes in Message

10�7

10�6

10�5

10�4

10�3

10�2

Com

mun

icat

ion

Tim

e(S

econ

ds)

O↵-Node O↵-Socket On-Socket

• Message cost varies with size as well as locations of send and recv procs

• Can use topology-aware methods to improve alpha-beta models for AMG

• Separate alphas and betas for intra-and inter-node messages

Thick lines: Alpha-Beta modelThin lines: timings

Alpha-Beta model (HPCC) vs. measured

Models with additional penalties vs measured

Models with additional penalties vs measured when

sending 1/20th at once

• Improving performance models• Creating parallel AMG solver, RAPtor, to be released on Github• Analyzing topology-aware

communication in AMG

TAPSpMV Strong Scalability

0 2000 4000 6000 8000 10000 12000 14000 16000 18000Number of Processes

10�1

Tim

e(s

econ

ds)

ref. SpMV TAPSpMV • Greatly reduces cost of communication on coarse levels of hierarchy

• Extends scalability (performing a SpMV on every level of hierarchy)

0 1 2 3 4 5 6 7 8 9 10Level in AMG Hierarchy

0.0

0.5

1.0

1.5

2.0

2.5

3.0

Tim

e(S

econ

ds)

Setup

Communication

0 1 2 3 4 5 6 7 8 9 10Level in AMG Hierarchy

0

1

2

3

4

5

6

Tim

e(S

econ

ds)

Solve

Communication

Cost of setting and solving each level in a 2D rotated anisotropic diffusion hierarchy with Hypre on 8192 cores,

and 10,000 degrees of freedom per core

• More cost in setting up and iterating over coarse levels

• Significant increase in communication requirements on coarse levels

128 1024 4096 8192 16384 32768 100000Number of Processes

0.4

0.5

0.6

0.7

0.8

0.9

1.0

1.1

1.2

1.3

Tim

e,R

elat

ive

toG

aler

kin

(Sec

onds

)

Galerkin

Non-Galerkin

Sparse Galerkin

Hybrid Galerkin

128 1024 4096 8192 16384 32768 100000Number of Processes

0.4

0.5

0.6

0.7

0.8

0.9

1.0

Tim

e,R

elat

ive

toG

aler

kin

(Sec

onds

)

Galerkin

Non-Galerkin

Sparse Galerkin

Hybrid Galerkin

Time, relative to Galerkin AMG, to solve weakly (left) and strongly (right) scaled 2D rotated anisotropic diffusion

Adaptively solving the hierarchy, adding back

entries to improve convergence as necessary

• Reduces cost over standard Galerkin AMG for both weak and strong scale studies

• If incorrect drop tolerance is chosen, entries can be removed or reintroduced during solve, allowing for adaptive solve phase

Page 17: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

MPI Process Topology: The Reality

• MPI provides a rich set of routines to allow the MPI implementation to map processes to physical hardware

• But in practice, behaves poorly or ignored (allowed by the standard)

• Halo exchange illustrates •  Cart uses MPI_Cart_create •  Nc is a user-implemented version

that taeks noes into account •  Nc is about 2x as fast •  Note both have scaling problems

(the network topology)

0.00E+00

1.00E+08

2.00E+08

3.00E+08

4.00E+08

5.00E+08

6.00E+08

7.00E+08

8.00E+08

1024 4096 16384 65536 262144

Band

width/process

NumberofProcesses

ComparisonofProcessMappingscart-1k

cart-4k

cart-16k

cart-64k

nc-1k

nc-4k

nc-16k

nc-64k

Page 18: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

IO Performance Often Terrible

• Applications just assume I/O is awful and can’t be fixed

• Even simple patterns not handled well

• Example: read or write a submesh of an N-dim mesh at an arbitrary offset in file

• Needed to read input mesh in PlasComCM. Total I/O time less than 10% for long science runs (that is < 15 hours)

• But long init phase makes debugging, development hard

•  Meshio library built to match application needs

•  Replaces many lines in app with a single collective I/O call

•  Meshio https://github.com/oshkosher/meshio

•  Work of Ed Karrels

Original Meshio Speedup

PlasComCM 4500 1 4500

MILC 750 15.6 48

Page 19: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Scalable Preconditioned Conjugate Gradient Methods

• Reformulations of CG trade computation for the ability to overlap communication

• Hide communication costs and absorb noise to produce more consistent runtimes

• Must overlap allreduce with more matrix kernels as work per core decreases and communication costs increase

• Faster, more consistent runtimes in noisy environments

• Effective for simpler preconditioners and shows some speedups for more complex preconditioners without modifications

• Work of Paul Eller, “Scalable Non-blocking Preconditioned Conjugate Gradient Methods”, SC16 http://ieeexplore.ieee.org/document/7877096/

Scalable Preconditioned Conjugate Gradient Methods

Hide communication costs andabsorb noise to produce moreconsistent runtimes

Must overlap allreduce withmore matrix kernels as work percore decreases andcommunication costs increase

Faster, more consistentruntimes in noisy environments

E↵ective for simplerpreconditioners and shows somespeedups for more complexpreconditioners withoutmodifications

Figure: 27-point Poisson matrices with

4k rows per core (top) and 512

3

rows

(bottom)

Page 20: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

The hard part – Intranode perfomrnace

• This has always been the hard part •  In 1999, we achieved a 7x (!) improvement in performance for a scalable

CFD code •  This was all in the intranode performance •  “Achieving high sustained performance in an unstructured mesh CFD application”

https://dl.acm.org/citation.cfm?id=331600 , 1999; early analysis of memory limit to performance, key to GB award

•  It is harder now •  Good performance requires effective use of

•  Vector and other instructions •  Cache and TLB

• Upcoming systems have •  More complex memory systems •  More and wider vector •  Inter-thread synchronization

• And the community has mostly been in denial about this •  Emphasis on fantasy solutions that provide magic performance

• For example…

Page 21: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Let The Compiler Do It

• This is the right answer … • If only the compiler could do it

• Lets look at one of the simplest operations for a single core, dense matrix transpose

• Transpose involves only data motion; no floating point order to respect

• Only a double loop (fewer options to consider)

Page 22: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

A Simple Example: Dense Matrix Transpose

• do j=1,n do i=1,n b(i,j) = a(j,i) enddo enddo

• No temporal locality (data used once)

• Spatial locality only if (words/cacheline) * n fits in cache •  Performance plummets

when matrices no longer fit in cache

Perf limit based on STREAM

Page 23: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Blocking for cache helps

• do jj=1,n,stridej do ii=1,n,stridei do j=jj,min(n,jj+stridej-1) do i=ii,min(n,ii+stridei-1) b(i,j) = a(j,i)

• Good choices of stridei and stridej can improve performance by a factor of 5 or more

• But what are the choices of stridei and stridej?

Page 24: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Results: Blue Waters O1

1 2 3 4 5 6 7 8 9

0

200

400

600

800

1000

1200

1400

1600

1800

1 2 3 4 5 6 7 8 9

1600-1800

1400-1600

1200-1400

1000-1200

800-1000

600-800

400-600

200-400

0-200 1

2

3

4

5

6

7

8

9

1 2 3 4 5 6 7 8 9

1500-2000

1000-1500

500-1000

0-500

Page 25: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Results: Blue Waters O3

1 2 3 4 5 6 7 8 9

0

200

400

600

800

1000

1200

1400

1600

1800

2000

1 2 3 4 5 6 7 8 9

1800-2000

1600-1800

1400-1600

1200-1400

1000-1200

800-1000

600-800

400-600

200-400

0-200 1

2

3

4

5

6

7

8

9

1 2 3 4 5 6 7 8 9

1500-2000

1000-1500

500-1000

0-500

Simple, unblocked code compiled with O3 – 709MB/s

Page 26: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Some Different Approaches to Performance Portability • Language based

• Existing languages, possibly with additional information •  Info from pragmas (e.g., align) or compile flags (assume associative)

• Extensions, especially for parallelism •  Directives + runtimes, e.g., OpenMP/OpenCL/OpenACC •  May also relax constraints, e.g., for operation order, bitwise reproducibility

• New languages, especially targeted at •  Specific data structures and operations •  Specific problem domains

• Library based (define mathematical operators and implement those efficiently)

• Specific data structure/operations (e.g., DGEMM) • Specific operations with families of data structures (e.g., PETSc)

•  This is likely the most practical way to include data-structure and even algorithm choice

•  At the cost of pushing the performance portability problem onto the library developers

Page 27: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Some Different Approaches to Performance Portability •  Tools based

•  Recognize that the user can always write poorly-performing code •  Support programming in finding and fixing performance problems •  Example: Early vectorizing compilers gave feedback about missed vectorization

opportunities; trained programmer to write “better” code • Programmer support and solution components

•  Work with programmer to develop code •  Source-to-source tools to transform and to generate code under programmer

guidance •  Autotuning to select from families of code •  Database systems to manage architecture and/or system-specific derivatives

• Magic •  Any sufficiently advanced technology is indistinguishable from magic. (Clarke’s 3rd

law) •  Any sufficiently advanced technology is indistinguishable from a rigged demo.

• Note these approaches are not orthogonal •  Successful performance portability requires many approaches, working together

•  For example…

Page 28: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

An Example: Stencil Code from a Real Application

• Stencil for CFD code • Supports 2D and 3D • Supports different stencil widths

• Matches computational scientists’ view of the mathematics

Page 29: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Another Version of the Same Code

•  This version is 4X as fast as the simpler, easier to read code

•  Less general code (subset to stencil, problem dimension)

• Same algorithm, data structure, and operations, but transformed to aid compiler in generating fast (and vectorized) code

Page 30: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Illinois Coding Environment (ICE)

•  One pragmatic approach •  Assumptions

•  Fast code requires some expert intervention

•  Can’t all be done at compile time •  Original code (in standard language)

is maintained as reference •  Can add information about

computation to code

•  Center for Exascale Simulation of Plasma-Coupled Combustion

•  http://xpacc.illinois.edu

• Approach •  Annotations provide additional

descriptive information •  Block name, expected loop sizes, etc.

•  Source-to-source transformations used to create code for compiler

•  Exploit tool ecosystem – interface to existing tools

•  Original “Golden Copy” used for development, correctness checks

•  Database used to manage platform-specific versions; detect changes that invalidate transformed versions

Page 31: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Example: Dense Matrix Multiply

Page 32: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Performance Results

• Dense matrix-matrix multiply

• 302,680 total variants • Subset evaluated (based

on results-so-far) • 8.2x speedup over gcc

compiler with optimization • Small but consistent

speedup over icc –O3 • Different parameters can be selected/remembered for each platform

• Within the constraints of the performance parameters considered

Page 33: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip
Page 34: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Performance Results

• 3-D Stencil • 11,664 variants • Max 12.6 sec • Min 3.68 sec • Speedup over simple code

•  icc: 1.12x •  gcc: 1.21x

Page 35: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

The really hard part – Combining internode and Intranode programming systems

• Most common approach likely to be MPI + X • What To Use as X in MPI + X?

• Threads and Tasks • OpenMP, pthreads, TBB, OmpSs, StarPU, …

• Streams (esp for accelerators) • OpenCL, OpenACC, CUDA, …

• Alternative distributed memory system • UPC, CAF, Global Arrays, GASPI/GPI

• MPI shared memory

Page 36: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

X = MPI (or X = ϕ)

• MPI 3.1 features esp. important for Exascale • Generalize collectives to encourage post BSP (Bulk Synchronous Programming) approach:

• Nonblocking collectives • Neighbor – including nonblocking – collectives

• Enhanced one-sided • Precisely specified (see “Remote Memory Access Programming

in MPI-3,” Hoefler et at, in ACM TOPC) •  http://dl.acm.org/citation.cfm?doid=2780584 • Many more operations including RMW

• Enhanced thread safety

Page 37: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

X = Programming with Threads

• Many choices, different user targets and performance goals

• Libraries: Pthreads, TBB • Languages: OpenMP 4, C11/C++11

• C11 provides an adequate (and thus complex) memory model to write portable thread code

• Also needed for MPI-3 shared memory; see “Threads cannot be implemented as a library”, http://www.hpl.hp.com/techreports/2004/HPL-2004-209.html

• Also see “You don’t know Jack about Shared Variables or Memory Models”, CACM Vol 55#2, Feb 2012

Page 38: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

What are the Issues?

• Isn’t the beauty of MPI + X that MPI and X can be learned (by users) and implemented (by developers) independently?

• Yes (sort of) for users • No for developers

• MPI and X must either partition or share resources • User must not blindly oversubscribe • Developers must negotiate

Page 39: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

More Effort needed on the “+”

• MPI+X won’t be enough for Exascale if the work for “+” is not done very well • Some of this may be language specification:

• User-provided guidance on resource allocation, e.g., MPI_Info hints; thread-based endpoints, new APIs

• Some is developer-level standardization • A simple example is the MPI ABI specification – users should

ignore but benefit from developers supporting

Page 40: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Some Resources to Negotiate

• CPU resources •  Threads and contexts • Cores (incl placement) • Cache

• Memory resources • HBM, NVRAM • Prefetch, outstanding load/

stores • Pinned pages or equivalent

NIC needs •  Transactional memory

regions • Memory use (buffers)

• NIC resources • Collective groups • Routes • Power

• OS resources • Synchronization hardware • Scheduling • Virtual memory • Cores (dark silicon)

Page 41: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Two Viewpoints on Programming Systems

•  Single Unified System •  Examples

•  UPC, Python, Fortran (with CoArrays), Chapel •  Pro

•  Can be simpler for user •  Single set of concepts applies to everything

•  System has complete control – all productivity and performance optimizations enabled •  Con

•  May be limited to problem types (e.g., structured grids) •  Gap between promise and delivery in performance due to complexity

•  Composed system •  Examples

•  MPI+OpenMP, Python+C, PETSc + C •  Pro

•  Can be simpler for user •  Concepts match each component’s domain

•  Implementation simplicity – each piece smaller, more limited domain •  Con

•  Hard to impossible to integrate across components •  Limits optimization opportunities

Page 42: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Summary

• Challenges for Exascale programming are not just in scale •  Need to achieve extreme power and cost efficiencies puts large demands

on the effectiveness of single core (whatever that means) and single node performance

• MPI remains the most viable internode programming system •  Supports a multiple parallel programming models, including one-sided and

shared memory •  Contains features for “programming in the large” (tools, libraries,

frameworks) that make it particularly appropriate for the internode system •  But some useful features still missing, especially WRT notification, and

implementations don’t realize available performance •  Intranode programming for performance still an unsolved problem

•  Lots of possibilities, but adoption remains a problem •  That points to unsolved problems, particularly in integration with large, multilingual

codes

• Composition (e.g., MPI+X) is a practical approach •  But requires close attention to “+”

Page 43: Challenges in Programming Extreme Scale Systemswgropp.cs.illinois.edu/bib/talks/tdata/2017/espm2-keynote-final.pdf · minimized and memory access patterns are coalesced. 2.1.2 On-Chip

Thanks!

• Philipp Samfass, Ed Karrels, Amanda Bienz, Paul Eller, Thiago Teixeira

• Luke Olson, David Padua • Department of Energy, National Nuclear Security Administration, under Award Number DE-NA0002374

• ExxonMobile Upstream Research • Blue Waters Sustained Petascale Project, supported by the National Science Foundation (award number OCI 07–25070) and the state of Illinois.

• Argonne Leadership Computing Facility