-
Notifications
You must be signed in to change notification settings - Fork 7
/
20140318-ENESLibraries.tex
386 lines (347 loc) · 12.7 KB
/
20140318-ENESLibraries.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
% \documentclass[handout]{beamer}
\documentclass{beamer}
\mode<presentation>
{
\usetheme{ANLBlue}
% \usefonttheme[onlymath]{serif}
% \usetheme{Singapore}
% \usetheme{Warsaw}
% \usetheme{Malmoe}
% \useinnertheme{circles}
% \useoutertheme{infolines}
% \useinnertheme{rounded}
\setbeamercovered{transparent=05}
}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{alltt,listings,multirow,ulem,siunitx}
\usepackage[absolute,overlay]{textpos}
\TPGrid{1}{1}
\usepackage{pdfpages}
\usepackage{ulem}
\usepackage{multimedia}
\usepackage{multicol}
\newcommand\hmmax{0}
\newcommand\bmmax{0}
\usepackage{bm}
\usepackage{comment}
\usepackage{subcaption}
% font definitions, try \usepackage{ae} instead of the following
% three lines if you don't like this look
\usepackage{mathptmx}
\usepackage[scaled=.90]{helvet}
% \usepackage{courier}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{shadows,arrows,shapes.misc,shapes.arrows,shapes.multipart,arrows,decorations.pathmorphing,backgrounds,positioning,fit,petri,calc,shadows,chains,matrix}
\newcommand\vvec{\bm v}
\newcommand\bvec{\bm b}
\newcommand\bxk{\bvec_0 \times \kappa_0 \cdot \nabla}
\newcommand\delp{\nabla_\perp}
% \usepackage{pgfpages}
% \pgfpagesuselayout{4 on 1}[a4paper,landscape,border shrink=5mm]
\usepackage{JedMacros}
\newcommand{\timeR}{t_{\mathrm{R}}}
\newcommand{\timeW}{t_{\mathrm{W}}}
\newcommand{\mglevel}{\ensuremath{\ell}}
\newcommand{\mglevelcp}{\ensuremath{\mglevel_{\mathrm{cp}}}}
\newcommand{\mglevelcoarse}{\ensuremath{\mglevel_{\mathrm{coarse}}}}
\newcommand{\mglevelfine}{\ensuremath{\mglevel_{\mathrm{fine}}}}
%solution and residual
\newcommand{\vx}{\ensuremath{x}}
\newcommand{\vc}{\ensuremath{\hat{x}}}
\newcommand{\vr}{\ensuremath{r}}
\newcommand{\vb}{\ensuremath{b}}
%operators
\newcommand{\vA}{\ensuremath{A}}
\newcommand{\vP}{\ensuremath{I_H^h}}
\newcommand{\vS}{\ensuremath{S}}
\newcommand{\vR}{\ensuremath{I_h^H}}
\newcommand{\vI}{\ensuremath{\hat I_h^H}}
\newcommand{\vV}{\ensuremath{\mathbf{V}}}
\newcommand{\vF}{\ensuremath{F}}
\newcommand{\vtau}{\ensuremath{\mathbf{\tau}}}
\title{Numerical Libraries and Frameworks (PETSc)}
\author{{\bf Jed Brown} \texttt{[email protected]} \\
Argonne National Lab and CU Boulder
}
% - Use the \inst command only if there are several affiliations.
% - Keep it simple, no one is interested in your street address.
% \institute
% {
% Mathematics and Computer Science Division \\ Argonne National Laboratory
% }
\date{ENES Workshop on Exascale Technologies, 2014-03-18}
% This is only inserted into the PDF information catalog. Can be left
% out.
\subject{Talks}
% If you have a file called "university-logo-filename.xxx", where xxx
% is a graphic format that can be processed by latex or pdflatex,
% resp., then you can add a logo as follows:
% \pgfdeclareimage[height=0.5cm]{university-logo}{university-logo-filename}
% \logo{\pgfuseimage{university-logo}}
% Delete this, if you do not want the table of contents to pop up at
% the beginning of each subsection:
% \AtBeginSubsection[]
% {
% \begin{frame}<beamer>
% \frametitle{Outline}
% \tableofcontents[currentsection,currentsubsection]
% \end{frame}
% }
\AtBeginSection[]
{
\begin{frame}<beamer>
\frametitle{Outline}
\tableofcontents[currentsection]
\end{frame}
}
% If you wish to uncover everything in a step-wise fashion, uncomment
% the following command:
% \beamerdefaultoverlayspecification{<+->}
\begin{document}
\lstset{language=C}
\normalem
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{What can libraries offer?}
\begin{itemize}
\item Code reuse
\begin{itemize}
\item Porting/optimization to new architectures
\item \ldots but only the part of the problem solved by the library
\end{itemize}
\item Easy experimentation with different methods
\begin{itemize}
\item via run-time options (PETSc)
\item ``black box'' solvers are not sustainable
\item preconditioners, linear and nonlinear accelerators, time integrators
\end{itemize}
\item Diagnostic and debugging support
\begin{itemize}
\item Convergence monitors, error estimators, adaptive controllers
\item Compatibility checks
\item Eigen-analysis
\end{itemize}
\item Communication with algorithm developers
\begin{itemize}
\item Precise language to describe methods
\item Performance diagnostics
\end{itemize}
\item Flexible coupling algorithms: beyond ``first-order'' splitting
\end{itemize}
\end{frame}
\begin{frame}{Library or Framework?}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{block}{Library}
\begin{itemize}
\item Libraries provide a toolbox
\item No assumptions about usage
\item Any selection of libraries should be usable in combination
\item \textit{Extensible} libraries enable user to implement/extend
\end{itemize}
\end{block}
\end{column}
\begin{column}{0.5\textwidth}
\begin{block}{Framework}
\begin{itemize}
\item Rapid development within a problem class
\item End-to-end solution provides guidance and auxiliary tools
\item Opinionated
\item Hard to use in combination with other Frameworks1
\end{itemize}
\end{block}
\end{column}
\end{columns}
\begin{center}
\uncover<2>{\alert{\Huge PETSc is a Library}}
\end{center}
\end{frame}
\begin{frame}{Portable {\bf Extensible} Toolkit for Scientific computing}
\begin{block}{Portable}
\begin{itemize}
\item Runs \emph{performantly} from laptop and iPhone to BG/Q and Titan
\item Any compiler, any OS
\item C, C++, Fortran 77 \& 90+, Python, MATLAB
\item Free to everyone: BSD-style license, open development
\end{itemize}
\end{block}
\begin{block}{Philosophy: Everything has a plugin architecture}
\begin{itemize}
\item Vectors, Matrices, Coloring/ordering/partitioning algorithms
\item Preconditioners, Krylov accelerators, Nonlinear solvers, Time integrators
\item Spatial discretizations/topology$^*$
\item Example: Third party supplies matrix format and associated preconditioner, distributes
compiled shared library. Application user loads plugin at runtime, no source
code in sight.
\end{itemize}
\end{block}
\end{frame}
\begin{frame}{Portable Extensible Toolkit for {\bf Scientific computing}}
\begin{itemize}
\item Computational Scientists and Engineers
\begin{itemize}
\item Structural mechanics, CFD, Geodynamics, Subsurface flow, Reactor engineering, Fusion
\item Research (many countries, many agencies) and industry (oil and gas, aerospace, ABAQUS)
\end{itemize}
\item Algorithm Developers (iterative methods and preconditioning)
\begin{itemize}
\item Example: Ghysels' pipelined Krylov methods
\end{itemize}
\item Package Developers
\begin{itemize}
\item SLEPc, TAO, Libmesh, MOOSE, FEniCS, Deal.II, etc
\end{itemize}
\item Funding
\begin{itemize}
\item Department of Energy (SciDAC, ASCR, collaborations)
\item National Science Foundation (CIG and others)
\end{itemize}
\item Active development team with long-term commitment
\item Hundreds of tutorial-style examples
\item Hyperlinked manual, examples, and manual pages for all routines
\item Lists: \url{[email protected]}, \url{[email protected]}
\item Support from \url{[email protected]}
\end{itemize}
\end{frame}
\begin{frame}{Solvers in climate}
\begin{itemize}
\item ``Pressure'' solves for semi-implicit methods
\begin{itemize}
\item Depends on separation between fastest wave and dynamics
\end{itemize}
\item Time integration for atmospheric column physics
\begin{itemize}
\item Currently swamped with splitting error
\item Stiff, positivity constraints, non-smoothness (freezing)
\end{itemize}
\item Sea ice
\begin{itemize}
\item Fast elastic wave speed ($v_p \approx \SI{3}{\kilo\metre\per\second}$)
\item Damped EVP model not converged at 120 subcycles, nor at 1200 (Lemieux at al 2012)
\end{itemize}
\item Land ice (Stokes and hydrostatic models with slippery bed)
\begin{itemize}
\item PETSc: PISM (UAF, PIK), BISICLES (LBL, Chombo), ISSM (NASA)
\end{itemize}
\item Improved stability for symplectic integration
\item Accelerated spin-up (e.g., deep ocean)
\begin{itemize}
\item Need to model unresolved-in-time processes
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\includegraphics[width=\textwidth]{figures/TS/CaldwellTimeStepConvergence.png} \\
%
c/o Peter Caldwell (LLNL)
\begin{itemize}
\item Models calibrated for ``efficient'' time step
\item No longer solving the PDEs we write down
\item Expensive to recalibrate when discretization changes
\item Calibration eats up a big chunk of the IPCC policy timeline
\end{itemize}
\end{frame}
\begin{frame}{Sea Ice}
\begin{columns}
\begin{column}{0.75\textwidth}
{\scriptsize
\begin{gather*}
(\rho h \bm u)_t + \underbrace{\rho h f \bm k \times \bm u}_{\text{Coriolis}} - \underbrace{\bm \tau}_{\text{water/air}} + \underbrace{\rho g h \nabla H_d}_{\text{surface gradient}} - \nabla\cdot(\underbrace{\rho h \bm u \otimes \bm u}_{\text{convection}} - \underbrace{\sigma}_{\text{viscoplastic}}) = 0 \\
\sigma = 2 \eta \dot\epsilon + \big[(\zeta - \eta) \trace\dot\epsilon - P/2 \big] \bm 1
\end{gather*}}
\end{column}
\begin{column}{0.25\textwidth}
\includegraphics[width=\textwidth]{figures/SeaIce/VorticesIceStrainRate}
\end{column}
\end{columns}
\begin{itemize}
\item mildly nonsymmetric due to Coriolis (quasi-diagonal) and convection (small compared to viscous stresses)
\item Nonlinear multigrid is less synchronous
{\small
\begin{tabular}{llll}
\toprule
Method & Nonlinear its/stage & Linear its/stage & V-cycles \\
\midrule
Newton-Krylov MG & 6 & 30.44 & 30.44 \\
FAS Newton/BJacobi/SOR & 18.33 & --- & 18.33 \\
\bottomrule
\end{tabular}}
\item Additive Runge-Kutta IMEX, error-based adaptivity, solver rtol $10^{-8}$
\item Preliminary tests to 4096 cores of BG/Q and 64 fine-grid elements/process, less than 0.1 seconds/time step.
\end{itemize}
\end{frame}
\input{slides/PETSc/TSARKIMEX.tex}
\input{slides/MonolithicOrSplit.tex}
\input{slides/PETSc/Coupling.tex}
\input{slides/FieldSplit.tex}
\input{slides/HydrostaticEigen.tex}
\begin{frame}{Implicit Runge-Kutta for advection}
\begin{table}
\centering
\caption{Total number of iterations (communications or accesses of $J$) to solve linear advection to $t=1$ on a $1024$-point grid using point-block Jacobi preconditioning of implicit Runge-Kutta matrix.
The relative algebraic solver tolerance is $10^{-8}$.}\label{tab:irk-advection}
\begin{tabular}{lrrr}
\toprule
Family & Stages & Order & Iterations \\
\midrule
Crank-Nicolson/Gauss & 1 & 2 & 3627 \\
Gauss & 2 & 4 & 2560 \\
Gauss & 4 & 8 & 1735 \\
Gauss & 8 & 16 & 1442 \\
\bottomrule
\end{tabular}
\end{table}
\begin{itemize}
\item Naive centered-difference discretization
\end{itemize}
\end{frame}
\begin{frame}{A case for run-time configuration}
\begin{itemize}
\item Simple build process
\item Complete test suite without recompilation
\item Cleaner provenance
\begin{itemize}
\item Only need run-time configuration
\item No recompiles, only one binary to keep track of
\item Consistency checks in one place
\end{itemize}
\item Simplified analysis/uncertainty quantification
\begin{itemize}
\item More algorithms accessible
\end{itemize}
\item More automated calibration
\item Interface granularity is key to performance
\end{itemize}
\end{frame}
\begin{frame}{Outlook}
\begin{itemize}
\item PETSc: flexible, extensible, unintrusive
\begin{itemize}
\item \url{http://mcs.anl.gov/petsc}
\end{itemize}
\item Verification (converging the equations) encourages mathematicians
\item Climate model components \emph{should} become more library-like
\begin{itemize}
\item Remove assumptions about environment
\item Improved modularity
\item Interfaces for configuration/calibration
\item Remove global variables (Fortran module variables)
\end{itemize}
\item Tools need to make hard problems possible
\begin{itemize}
\item Already many tools to make easy problems elegant
\item Ease of extending (versus DSLs/compilers)
\end{itemize}
\item Strong-scaling necessity: ruthlessly shorten critical path
\begin{itemize}
\item $2\times$ increase in resolution requires at least $2\times$ more steps
\item At fixed turn-around time, need twice as many steps/second
\item Algorithmic optimality is crucial
\end{itemize}
\end{itemize}
\end{frame}
\end{document}