Presentazione di PowerPoint - Dipartimento di Matematica

Download Report

Transcript Presentazione di PowerPoint - Dipartimento di Matematica

Corso di Laurea Magistrale e
Dottorati in Matematica Applicata
METODI NUMERICI PER EDP3
(CALCOLO PARALLELO)
Prof. Luca F. Pavarino
Dipartimento di Matematica
Universita` di Milano
a.a. 2013-2014
[email protected],
http://www.mat.unimi.it/~pavarino
1
Struttura del corso
• Orario
- Lunedi`
10.30 - 12.30
- Mercoledi` 13.30 - 16.30
- Giovedi`
10.30 - 12.30
Aula 3
Aula 2 (Lab)
Aula 9
• 12 - 13 settimane, 9 cfu (6 lezione, 3 laboratorio)
software
hardware
• Laboratorio in Aula 2 o LIR o LID: esercitazioni con
- Nostro Cluster Linux (ulisse.mat.unimi.it), 104 processori
- Nostro Cluster Linux Nemo
- nuovo IBM BG/Q del Cineca (fermi.cineca.it), ~160K processori)
- Uso della libreria standard per “message passing” MPI
- Uso della libreria parallela di calcolo scientifico PETSc
dell’Argonne National Lab., basata su MPI
2
Materiale e Testi
•
Slides in inglese basate su corsi di calcolo parallelo tenuti a
Univ. Illinois da Michael Heath, UC Berkeley da Jim Demmel,
(+ MIT da Alan Edelmann)
•
Possibili testi:
- A. Grama, A. Gupta, G. Karipys, V. Kumar, Introduction to parallel
computing, 2nd ed., Addison Wesley, 2003
- L. R. Scott, T. Clark, B. Bagheri, Scientific Parallel Computing,
Princeton University Press, 2005
•
Molto materiale on-line, e.g.:
-
www-unix.mcs.anl.gov/dbpp/ (Ian Foster’s book)
www.cs.berkeley.edu/~demmel/ (Demmel’s course)
www-math.mit.edu/~edelman/ (Edelman’s course)
www.cse.uiuc.edu/~heath/ (Heath’s course)
www.cs.rit.edu/~ncs/parallel.html (Nan’s ref page)
3
Schedule of Topics
1. Introduction
2. Parallel architectures
3. Networks
4. Interprocessor communications: point-to-point, collective
5. Parallel algorithm design
6. Parallel programming, MPI: message passing interface
7. Parallel performance
8. Vector and matrix products
9. LU factorization
10. Cholesky factorization
11. PETSc parallel library
12. Iterative methods for linear systems
13. Nonlinear equations and ODEs
14. Partial Differential Equations
15. Domain Decomposition Methods
16. QR factorization
17. Eigenvalues
4
1) Introduction
• What is parallel computing
• Large important problems require powerful computers
• Why powerful computers must be parallel processors
• Why writing (fast) parallel programs is hard
• Principles of parallel computing performance
5
What is parallel computing
• It is an example of parallel processing:
- division of task (process) into smaller tasks (processes)
- assign smaller tasks to multiple processing units that work
simultaneously
- coordinate, control and monitor the units
• Many examples from nature:
- human brain consists of ~10^11 neurons
- complex living organisms consist of many cells (although monocellular
organism are estimated to be ½ of the earth biomass)
- leafs of trees ...
• Many examples from daily life:
-
highways tollbooths, supermarket cashiers, bank tellers, …
elections, races, competitions, …
building construction
written exams ...
6
• Parallel computing is the use of multiple processors to
execute different parts of the same program (task)
simultaneously
• Main goals of parallel computing are:
- Increase the size of problems that can be solved
- bigger problem would not be solvable on a serial computer in a
reasonable amount of time  decompose it into smaller problems
- bigger problem might not fit in the memory of a serial computer 
distribute it over the memory of many computer nodes
- Reduce the “wall-clock” time to solve a problem
 Solve (much) bigger problems (much) faster
Subgoal: save money using cheapest available
resources (clusters, beowulf, grid computing,...)
7
Not at all trivial that more processors help to achieve these
goals:
• “If a man can dig a hole of 1 m3 in 1 hour, can 60 men dig
the same hole in 1 minute (!) ? Can 3600 men do it in 1
second (!!) ?”
• “I know how to make 4 horses pull a cart, but I do not
know how to make 1024 chickens do it” (Enrico Clementi)
• “ What happens if the mean-time to failure for nodes on
the Tflops machine is shorter than the boot time ?
(Courtenay Vaughan)
8
Units of Measure in HPC
• High Performance Computing (HPC) units are:
- Flops: floating point operations
- Flops/s: floating point operations per second
- Bytes: size of data (a double precision floating point number is 8)
• Typical sizes are millions, billions, trillions…
Mega
bytes
Giga
Tera
Peta
Exa
Zetta
Yotta
Mflop/s = 106 flop/sec
Mbyte = 220 = 1048576 ~ 106
Gflop/s = 109 flop/sec
Tflop/s = 1012 flop/sec
Pflop/s = 1015 flop/sec
Eflop/s = 1018 flop/sec
Zflop/s = 1021 flop/sec
Yflop/s = 1024 flop/sec
Gbyte = 230 ~ 109 bytes
Tbyte = 240 ~ 1012 bytes
Pbyte = 250 ~ 1015 bytes
Ebyte = 260 ~ 1018 bytes
Zbyte = 270 ~ 1021 bytes
Ybyte = 280 ~ 1024 bytes
Current fastest (public) machine ~ 1.5 Pflop/s
Up-to-date lisy at www.top500.org
9
Why we need
powerful computers
10
Simulation: The Third Pillar of Science
• Traditional scientific and engineering method:
(1) Do theory or paper design
(2) Perform experiments or build system
Theory
• Limitations:
–Too difficult—build large wind tunnels
–Too expensive—build a throw-away passenger jet
–Too slow—wait for climate or galactic evolution
–Too dangerous—weapons, drug design, climate
experimentation
Experiment
Simulation
• Computational science and engineering paradigm:
(3) Use high performance computer systems
to simulate and analyze the phenomenon
- Based on known physical laws and efficient numerical methods
- Analyze simulation results with computational tools and
methods beyond what is used traditionally for experimental
data analysis
11
Data Driven Science
• Scientific data sets are growing exponentially
- Ability to generate data is exceeding our ability to
store and analyze
- Simulation systems and some observational
devices grow in capability with Moore’s Law
• Petabyte (PB) data sets will soon be common:
- Climate modeling: estimates of the next IPCC data
is in 10s of petabytes
- Genome: JGI alone will have .5 petabyte of data
this year and double each year
- Particle physics: LHC is projected to produce 16
petabytes of data per year
- Astrophysics: LSST and others will produce 5
petabytes/year (via 3.2 Gigapixel camera)
• Create scientific communities with “Science
Gateways” to data
12
Some Particularly Challenging Computations
• Science
- Global climate modeling, weather forecasts
- Astrophysical modeling
- Biology: Genome analysis; protein folding (drug design)
- Medicine: cardiac modeling, physiology, neurosciences
• Engineering
-
Airplane design
Crash simulation
Semiconductor design
Earthquake and structural modeling
• Business
- Financial and economic modeling
- Transaction processing, web services and search engines
• Defense
- Nuclear weapons (ASCI), cryptography, …
13
Economic Impact of HPC
• Airlines:
- System-wide logistics optimization systems on parallel systems.
- Savings: approx. $100 million per airline per year.
• Automotive design:
- Major automotive companies use large systems (500+ CPUs) for:
- CAD-CAM, crash testing, structural integrity and
aerodynamics.
- One company has 500+ CPU parallel system.
- Savings: approx. $1 billion per company per year.
• Semiconductor industry:
- Semiconductor firms use large systems (500+ CPUs) for
- device electronics simulation and logic validation
- Savings: approx. $1 billion per company per year.
• Energy
14
- Computational modeling improved performance of current
nuclear power plants, equivalent to building two new power
plants.
$5B World Market in Technical Computing
1998 1999 2000 2001 2002 2003
100%
90%
80%
70%
Other
Technical Management and
Support
Simulation
Scientific Research and R&D
Mechanical
Design/Engineering Analysis
Mechanical Design and
Drafting
60%
Imaging
50%
Geoscience and Geoengineering
40%
Electrical Design/Engineering
Analysis
Economics/Financial
30%
Digital Content Creation and
Distribution
20%
Classified Defense
10%
Chemical Engineering
0%
Biosciences
Source: IDC 2004, from NRC Future of Supercomputer Report
15
1
2
3
4
5
6
7
8
9
10
11
12
13
Finite State Mach.
Combinational
Graph Traversal
Structured Grid
Dense Matrix
Sparse Matrix
Spectral (FFT)
Dynamic Prog
N-Body
MapReduce
Backtrack/ B&B
Graphical Models
Unstructured Grid
HPC
ML
Games
DB
SPEC
Analyzed in detail in
“Berkeley View” report
Embed
Which commercial applications require parallelism?
Health
Image Speech Musi
Analyzed in detail in
“Berkeley View” report
www.eecs.berkeley.edu/Pubs/
TechRpts/2006/EECS-2006183.html
What do commercial and CSE applications have in common?
Motif/Dwarf: Common Computational Methods
1
2
3
4
5
6
7
8
9
10
11
12
13
Finite State Mach.
Combinational
Graph Traversal
Structured Grid
Dense Matrix
Sparse Matrix
Spectral (FFT)
Dynamic Prog
N-Body
MapReduce
Backtrack/ B&B
Graphical Models
Unstructured Grid
HPC
ML
Games
DB
SPEC
Embed
(Red Hot  Blue Cool)
Health Image Speech Music Browser
Ex. 1: Global Climate Modeling Problem
•
Problem is to compute:
f(latitude, longitude, elevation, time) 
temperature, pressure, humidity, wind velocity
•
Atmospheric model: equation of fluid dynamics

Navier-Stokes system of nonlinear partial differential equations
•
Approach:
-
Discretize the domain, e.g., a measurement point every 1km
Devise an algorithm to predict weather at time t+1 given t
• Uses:
- Predict major events,
e.g., El Nino
- Use in setting air
emissions standards
18
Source: http://www.epm.ornl.gov/chammp/chammp.html
Global Climate Modeling Computation
• One piece is modeling the fluid flow in the atmosphere
- Solve Navier-Stokes equations
- Roughly 100 Flops per grid point with 1 minute timestep
• Computational requirements:
- To match real-time, need 5 x 1011 flops in 60 seconds = 8 Gflop/s
- Weather prediction (7 days in 24 hours)  56 Gflop/s
- Climate prediction (50 years in 30 days)  4.8 Tflop/s
- To use in policy negotiations (50 years in 12 hours)  288 Tflop/s
• To double the grid resolution, computation is 8x to 16x
• State of the art models require integration of
atmosphere, clouds, ocean, sea-ice, land models, plus
possibly carbon cycle, geochemistry and more
• Current models are coarser than this
19
Climate Modeling on the Earth Simulator System
 Development of ES started in 1997 in order to make a
comprehensive understanding of global environmental
changes such as global warming.
 Its construction was completed at the end of February,
2002 and the practical operation started from March 1,
2002
 35.86Tflops (87.5% of the peak performance) is achieved in the
Linpack benchmark.
 26.58Tflops was obtained by a global atmospheric circulation
code.
20
Ex. 2: Cardiac simulation
• Very difficult problem spanning many disciplines:
- Electrophysiology (spreading of electrical excitation front)
- Structural Mechanics (large deformation of incompressible
biomaterial)
- Fluid Dynamics (flow of blood inside the heart)
• Large-scale simulations in computational
electrophysiology (joint work with P. Colli-Franzone and S. Scacchi)
- Bidomain model (system of 2 reaction-diffusion equations) coupled
with Luo-Rudy 1 gating (system of 7 ODEs) in 3D
- Q1 finite elements in space + adaptive semi-implicit method in time
- Parallel solver based on PETSc library
- Linear systems up to 36 M unknowns each time-step (128 procs of
Cineca SP4) solved in seconds or minutes
- Simulation of full heartbeat (4 M unknowns in space, thousands of
time-steps) took more than 6 days on 25 procs of Cilea HP
Superdome, then about 50 hours on 36 procs of our cluster, now 6.5
hours using multilevel preconditioner
21
3D simulations: isochrones of acti, repo, APD
22
• Hemodynamics in circulatory system (work in Quarteroni’s
group at MOX, Polimi)
• Blood flow in the heart (Peskin’s group, CIMS, NYU)
- Modeled as an elastic structure in an incompressible fluid.
- The “immersed boundary method” due to Peskin and McQueen.
- 20 years of development in model
- Many applications other than the heart: blood clotting, inner ear,
paper making, embryo growth, and others
- Use a regularly spaced mesh (set of points) for evaluating the fluid
- Uses
-
Current model can be used to design artificial heart valves
Can help in understand effects of disease (leaky valves)
Related projects look at the behavior of the heart during a heart attack
Ultimately: real-time clinical work
23
Ex. 3: latest breakthrough
24
25
26
27
28
29
30
31
32
33
34
Ex. 4: Parallel Computing in Data Analysis
• Web search:
-
Functional parallelism: crawling, indexing, sorting
Parallelism between queries: multiple users
Finding information amidst junk
Preprocessing of the web data set to help find information
• Google physical structure (2004 estimate, check
current status on e.g. wikipedia):
- about 63.272 nodes (126,544 cpus)
- 126.544 GB RAM
- 5,062 TB hard drive space
(This would make Google server farm one of the most powerful
supercomputer in the world)
• Google index size (June 2005 estimate):
- about 8 billion web pages, 1 billion images
35
- Note that the total Surface Web ( = publically indexable, i.e.
reachable by web crawlers) has been estimated (Jan. 2005) at
over 11.5 billion web pages.
- Invisible (or Deep) Web ( = not indexed by search engines; it
consists of dynamic web pages, subscription sites, searchable
databases) has been estimated (2001) at over 550 billion
documents.
- Invisible Web not to be confused with Dark Web consisting of
machines or network segments not connected to the Internet
• Data collected and stored at enormous speeds
(Gbyte/hour)
- remote sensor on a satellite
- telescope scanning the skies
- microarrays generating gene expression data
- scientific simulations generating terabytes of data
- NSA analysis of telecommunications
36
Why powerful
computers are
parallel
37
Tunnel Vision by Experts
• “I think there is a world market for maybe five
computers.”
- Thomas Watson, chairman of IBM, 1943.
• “There is no reason for any individual to have
a computer in their home”
- Ken Olson, president and founder of Digital Equipment
Corporation, 1977.
• “640K [of memory] ought to be enough for
anybody.”
- Bill Gates, chairman of Microsoft,1981.
Slide source: Warfield et al.
38
Technology Trends: Microprocessor Capacity
Moore’s Law
2X transistors/Chip Every 1.5 - 2 years
Called “Moore’s Law”
Microprocessors have
become smaller, denser, and
more powerful.
Gordon Moore (co-founder of
Intel) predicted in 1965 that the
transistor density of semiconductor
chips would double roughly every
18 months.
Slide source: Jack Dongarra
39
Microprocessor Transistors / Clock (1970-2000)
10000000
1000000
Transistors (Thousands)
100000
Frequency (MHz)
10000
1000
100
10
1
0
1970
40
1975
1980
1985
1990
1995
2000
Impact of Device Shrinkage
• What happens when the feature size (transistor size) shrinks
by a factor of x ?
• Clock rate goes up by x because wires are shorter
- actually less than x, because of power consumption
• Transistors per unit area goes up by x2
• Die size also tends to increase
- typically another factor of ~x
• Raw computing power of the chip goes up by ~ x4 !
- typically x3 is devoted to either on-chip
- parallelism: hidden parallelism such as ILP
- locality: caches
• So most programs x3 times faster, without changing them
41
But there are limiting forces
Manufacturing costs and yield problems limit use of density
•
Moore’s 2nd law
(Rock’s law): costs go
up
Demo of
0.06
micron
CMOS
Source: Forbes Magazine
•
Yield
-What percentage of the chips
are usable?
-E.g., Cell processor (PS3) is
sold with 7 out of 8 “on” to
improve yield
42
42
Physical limits: how fast can a serial computer be?
1 Tflop/s, 1 Tbyte
sequential
machine
r = 0.3 mm
• Consider the 1 Tflop/s sequential machine:
- Data must travel some distance, r, to get from memory to CPU.
- Go get 1 data element per cycle, this means 1012 times per second
at the speed of light, c = 3x108 m/s. Thus r < c/1012 = 0.3 mm.
• Now put 1 Tbyte of storage in a 0.3 mm 0.3 mm area:
(in fact 0.3^2 mm^2/10^12 = 9 10^(-2) 10^(-6) m^2/10^12 =
9 10^(-20) m^2 = (3 10^(-10))^2 m^2 = 3^2 A^2 
- Each byte occupies less than 3 square Angstroms, or the size of a
small atom! (1 Angstrom = 10^(-10) m = 0.1 nanometer)
• No choice but parallelism
43
Power Density Limits Serial Performance
– Dynamic power is
proportional to V2fC
– Increasing frequency (f)
also increases supply
voltage (V)  cubic
effect
– Increasing cores
increases capacitance
(C) but only linearly
– Save power by lowering
clock speed
Scaling clock speed (business as usual) will not work
10000
Sun’s
Surface
Source: Patrick Gelsinger,
Shenkar Bokar, Intel
Rocket
1000
Nozzle
Power Density (W/cm2)
• Concurrent systems are
more power efficient
Nuclear
100
Reactor
Hot Plate
8086
10
4004
8008
8080
P6
8085
286
Pentium®
386
486
1
1970
1980
1990
2000
Year
• High performance serial processors waste power
- Speculation, dynamic dependence checking, etc. burn power
- Implicit parallelism discovery
• More transistors, but not faster serial processors
2010
Revolution in Processors
10000000
1000000
1000000
100000
100000
10000
10000
Transistors
Transistors (Thousands)
(Thousands)
Transistors(MHz)
(Thousands)
Frequency
Frequency (MHz)
Power
Cores (W)
Cores
1000
1000
100
100
10
10
1
1
0
1970
•
•
•
•
1975
1980
1985
1990
1995
2000
2005
2010
Chip density is continuing increase ~2x every 2 years
Clock speed is not
Number of processor cores may double instead
Power is under control, no longer growing
45
Parallelism in 2013?
• These arguments are no longer theoretical
• All major processor vendors are producing multicore chips
- Every machine will soon be a parallel machine
- To keep doubling performance, parallelism must double
• Which (commercial) applications can use this parallelism?
- Do they have to be rewritten from scratch?
• Will all programmers have to be parallel programmers?
- New software model needed
- Try to hide complexity from most programmers – eventually
- In the meantime, need to understand it
• Computer industry betting on this big change, but does not
have all the answers
- Berkeley ParLab established to work on this
46
Memory is Not Keeping Pace
Technology trends against a constant or increasing memory per core
• Memory density is doubling every three years; processor logic is every two
• Storage costs (dollars/Mbyte) are dropping gradually compared to logic costs
Cost of Computation vs. Memory
Source: David Turek, IBM
Source: IBM
Question: Can you double concurrency without doubling memory?
• Strong scaling: fixed problem size, increase number of processors
• Weak scaling: grow problem size proportionally to number of
processors
The TOP500 Project
• Listing the 500 most powerful computers
in the world
• Yardstick: Rmax of Linpack
- Solve Ax=b, dense problem, matrix is random
- Dominated by dense matrix-matrix multiply
• Update twice a year:
- ISC’xy in June in Germany
- SCxy in November in the U.S.
• All information available from the TOP500
web site at: www.top500.org
The TOP10 in November 2012
Ran
k
Site
Manufacture
r
1
Oak Ridge National Laboratory
Cray
2
Lawrence Livermore National
Laboratory
IBM
3
RIKEN Advanced Institute for
Computational Science
Fujitsu
4
Argonne National Laboratory
IBM
Computer
Country
Cores
Rmax Power
[Pflops] [MW]
Titan
Cray XK7, Opteron 16C 2.2GHz, Gemini,
NVIDIA K20x
Sequoia
BlueGene/Q,
USA
560,640
17.59
8.21
USA
1,572,864
16.32
7.89
Japan
705,024
10.51
12.66
USA
786,432
8.16
3.95
Germany
393,216
4.14
1.97
Germany
147,456
2.90
3.42
USA
204,900
2.66
China
186,368
2.57
4.04
Italy
163,840
1.73
.82
USA
63,360
1.52
3.58
Power BQC 16C 1.6GHz, Custom
K computer
SPARC64 VIIIfx 2.0GHz,
Tofu Interconnect
Mira
BlueGene/Q,
Power BQC 16C 1.6GHz, Custom
5
Forschungszentrum Juelich (FZJ)
IBM
JUQUEEN
BlueGene/Q,
Power BQC 16C 1.6GHz, Custom
6
Leibniz Rechenzentrum
IBM
SuperMUC
iDataPlex DX360M4,
Xeon E5 8C 2.7GHz, Infiniband FDR
7
8
9
Texas Advanced Computing
Center/UT
National SuperComputer Center
in Tianjin
CINECA
Dell
Stampede
PowerEdge C8220,
Xeon E5 8C 2.7GHz, Intel Xeon Phi
NUDT
Tianhe-1A
NUDT TH MPP,
Xeon 6C, NVidia, FT-1000 8C
IBM
Fermi
BlueGene/Q,
Power BQC 16C 1.6GHz, Custom
10
IBM
IBM
DARPA Trial Subset
Power 775,
Power7 8C 3.84GHz, Custom
Performance Development (Nov 2012)
1 Eflop/s
162 PFlop/s
100 Pflop/s
17.6 PFlop/s
10 Pflop/s
1 Pflop/s
SUM
100 Tflop/s
10 Tflop/s
1 Tflop/s 1.17 TFlop/s
N=1
100 Gflop/s
10 Gflop/s
59.7 GFlop/s
1
Gflop/s
100 Mflop/s 400 MFlop/s
N=500
76.5 TFlop/s
Projected Performance Development (Nov 2012)
1 Eflop/s
100 Pflop/s
10 Pflop/s
SUM
1 Pflop/s
100 Tflop/s
10 Tflop/s
N=1
1 Tflop/s
100 Gflop/s
10 Gflop/s
1 Gflop/s
100 Mflop/s
N=500
Core Count
Moore’s Law reinterpreted
• Number of cores per chip can double
every two years
• Clock speed will not increase (possibly
decrease)
• Need to deal with systems with millions of
concurrent threads
• Need to deal with inter-chip parallelism as
well as intra-chip parallelism
Principles of Parallel Computing
• Finding enough parallelism (Amdahl’s Law)
• Granularity – how big should each parallel task be
• Locality – moving data costs more than arithmetic
• Load balance – don’t want 1K processors to wait for one
slow one
• Coordination and synchronization – sharing data safely
• Performance modeling/debugging/tuning
All of these things makes parallel programming
even harder than sequential programming.
55
“Automatic” Parallelism in Modern Machines
• Bit level parallelism
- within floating point operations, etc.
• Instruction level parallelism (ILP)
- multiple instructions execute per clock cycle
• Memory system parallelism
- overlap of memory operations with computation
• OS parallelism
- multiple jobs run in parallel on commodity SMPs
Limits to all of these -- for very high performance, need
user to identify, schedule and coordinate parallel tasks
56
Amdahl’s law: Finding Enough Parallelism
• Suppose only part of an application seems parallel
• Amdahl’s law
- Let s be the fraction of work done sequentially, so
(1-s) is fraction parallelizable.
- P = number of processors.
Speedup(P) = Time(1)/Time(P)
<= 1/(s + (1-s)/P)
<= 1/s
Even if the parallel part speeds up perfectly, we may be
limited by the sequential portion of code.
Ex: if only s = 1%, then speedup <= 100
 not worth it using more than p = 100 processors
57
Overhead of Parallelism
• Given enough parallel work, this is the most significant
barrier to getting desired speedup.
• Parallelism overheads include:
-
cost of starting a thread or process
cost of communicating shared data
cost of synchronizing
extra (redundant) computation
• Each of these can be in the range of milliseconds
(= millions of flops) on some systems
• Tradeoff: Algorithm needs sufficiently large units of work
to run fast in parallel (i.e. large granularity), but not so
large that there is not enough parallel work.
58
Locality and Parallelism
Conventional
Storage
Proc
Hierarchy
Cache
L2 Cache
Proc
Cache
L2 Cache
Proc
Cache
L2 Cache
L3 Cache
L3 Cache
Memory
Memory
Memory
potential
interconnects
L3 Cache
• Large memories are slow, fast memories are small.
• Storage hierarchies are large and fast on average.
• Parallel processors, collectively, have large, fast memories -- the slow accesses to
“remote” data we call “communication”.
• Algorithm should do most work on local data.
59
Load Imbalance
• Load imbalance is the time that some processors in the
system are idle due to
- insufficient parallelism (during that phase).
- unequal size tasks.
• Examples of the latter
- adapting to “interesting parts of a domain”.
- tree-structured computations.
- fundamentally unstructured problems
- Adaptive numerical methods in PDE (adaptivity and parallelism seem
to conflict).
• Algorithm needs to balance load
- but techniques to balance load often reduce locality
- Sometimes can determine work load, divide up evenly, before starting
- “Static Load Balancing”
- Sometimes work load changes dynamically, need to rebalance
dynamically
- “Dynamic Load Balancing”
60
Measuring Performance: Real Performance?
Peak Performance grows exponentially,
a la Moore’s Law

In 1990’s, peak performance increased 100x; in
2000’s, it will increase 1000x
1,000
But efficiency (the performance relative to
the hardware peak) has declined

was 40-50% on the vector supercomputers of
1990s
now as little as 5-10% on parallel
supercomputers of today
Close the gap through ...


Mathematical methods and algorithms that
achieve high performance on a single
processor and scale to thousands of
processors
More efficient programming models and tools
for massively parallel supercomputers
100
Teraflops

Peak Performance
Performance
Gap
10
1
Real Performance
0.1
1996
2000
2004
61
Performance Levels
• Peak advertised performance (PAP)
- You can’t possibly compute faster than this speed
• LINPACK
- The “hello world” program for parallel computing
- Solve Ax=b using Gaussian Elimination, highly tuned
• Gordon Bell Prize winning applications performance
- The right application/algorithm/platform combination plus years of work
• Average sustained applications performance
- What one reasonable can expect for standard applications
When reporting performance results, these levels are
often confused, even in reviewed publications
62
Performance Levels (for example on NERSC-5)
• Peak advertised performance (PAP): 100 Tflop/s
• LINPACK (TPP): 84 Tflop/s
• Best climate application: 14 Tflop/s
- WRF code benchmarked in December 2007
• Average sustained applications performance: ? Tflop/s
- Probably less than 10% peak!
• We will study performance
- Hardware and software tools to measure it
- Identifying bottlenecks
- Practical performance tuning (Matlab demo)
63
64
65
66
67
68
69
70
Simple example 1: sum of N numbers, P procs
N
A   ai
i 1
Also known as reduction
(of the vector [a1,…,aN] to the scalar A)
- Assume N is an integer multiple of P: N = kP
- Divide the sum into P partial sums:
Aj 
jk
a
i
i ( j 1) k 1
P
Then
P parallel tasks, each with
k -1 additions of k = N/P data
A   Aj
j 1
Global sum (not parallel,
communication needed)
71
Simple example 2: pi
1
2
1
4
/(
1

x
)
dx

4
arctg
(
x
)
|
0 

0
N
- Use composite midpoints quadrature rule:
where h = 1/N and xi  (i  1 / 2)h
2
4
h
/(
1

x

i ),
i 1
-Decompose sum into P parallel partial
sums + 1 global sum, (as before or with
stride P)
On processor myid = 0,…,P-1, (P = numprocs) compute:
sum = 0;
for I = myid + 1:numprocs:N,
x = h*(I – 0.5);
sum = sum + 4/(1+x*x);
end;
mypi = h*sum;
global sum the local mypi into glob_pi (reduction)
72
Simple example 3: prime number sieve
See exercise in class
Simple example 4: Jacobi method for BVP
See exercise in class
73