The Art of Differentiating Computer Programs

Size: px
Start display at page:

Download "The Art of Differentiating Computer Programs"

Transcription

1 The Art of Differentiating Computer Programs Uwe Naumann LuFG Informatik 12 Software and Tools for Computational Engineering RWTH Aachen University, Germany 1 / 69

2 Contents AD Informally AD Formally AD by Overloading Second-(Higher-)Order AD Formally Advanced AD (with dco/c++) External Function Interface Adjoint Ensembles User-Defined Adjoints AD Projects 2 / 69

3 Who knows how to differentiate... y=x x; v o i d f ( c o n s t double x, double& y ) { y=x x ; } v o i d f ( i n t n, double c o n s t x, double& y ) { f o r ( i n t i =0; i <n;++ i ) x [ i ] = x [ i ] ; y =0; f o r ( i n t i =0; i <n;++ i ) y+=x [ i ] ; y =y ; } 3 / 69

4 Algorithmic Differentiation Basics AD assumes differentiability of a given implementation of a multivariate vector function y = f (x) : IR n IR m (e.g., existence of Jacobian f (x) IR m n and Hessian 2 f (x) IR m n n ).... transforms the given program into programs for computing arbitrary projections of first- and higher-order derivative tensors (e.g., f (x) ẋ and f (x) T ȳ).... can be implemented by source-to-source transformation and/or operator overloading combined with generic (meta-)programming techniques.... can be supported by corresponding software tools in order to (partially) automate its application.... has been applied successfully to a large number of real-world codes from Computational Science, Engineering, and Finance; see, for example, proceedings of the six AD conferences. While the basic idea is reasonably straight forward, the actual implementation (both user and developer perspective) yields several challenges. 4 / 69

5 Foundations of what is coming next... U. Naumann: The Art of Differentiating Computer Programs. An Introduction to Algorithmic Differentiation. Number 24 in Software, Environments, and Tools, SIAM, / 69

6 Algorithmic Differentiation Idea by Example w.l.o.g. m = 1 y where y = f (x) = f 3(f 2(f 1(x))) = IR n x = f 1(x) : x i = xi 2 IR 1 y = f 2(x) = n 1 i=0 x i IR 1 y = f 3(y) = y 2 ( n 1 i=0 x 2 i ) 2 [2 y] y [1] [1] [1] x0 x1 x2 [2 x0] [2 x1] [2 x2] x0 x1 x2 f i are continuously differentiable wrt. their arguments. Hence, by the chain rule f (x) IR n y x = f3(y) IR f 2(x) f 1(x) IR 1 n x 0. = (2 y) (1... 1) 2. IR n n 2 x n 1 6 / 69

7 Algorithmic Differentiation Idea by Example finite differences A (first-order forward) finite difference quotient f (x + h ẋ) f (x) h approximates the (first) directional (total) derivative ẏ = f (x) ẋ = f 3(y) f 2(x) f 1(x) ẋ = (2 y) ( ) x x n 1 ẋ 0. ẋ n 1. The whole gradient f (x) can be approximated by letting ẋ range over the Cartesian basis vectors in IR n at a computational cost of O(n) Cost(f ). 7 / 69

8 Can we avoid truncation? YES, WE CAN! 8 / 69

9 Algorithmic Differentiation Idea by Example tangent code A (first-order) tangent code computes the same directional derivative with machine accuracy. ẏ = (2 y [= n 1 i=0 x2 i ] ) ( ) x x n 1 ẋ 0. ẋ n 1 ẏ [2 y] ẏ [1] [1] [1] ẋ0 ẋ1 ẋ2 [2 x0] [2 x1] [2 x2] ẋ0 ẋ1 ẋ2 The whole gradient f (x) can be approximated by letting ẋ range over the Cartesian basis vectors in IR n at a computational cost of O(n) Cost(f ). 9 / 69

10 Writing Tangent Code by Hand Basic Tangent Code (Rules) 1. duplicate active data segment double v, t 1 v ; 2. augment with assignment-level tangent code t 1 z=c o s ( x z ) ( x t 1 z+t 1 x z ) ; z=s i n ( x z ) ; 3. leave intraprocedural flow of control unchanged f o r ( i n t i =0; i <n;++ i ) { t 1 y [ i ] = s i n ( x [ i ] ) t 1 x [ i ] ; y [ i ]+=cos ( x [ i ] ) ; } 4. replace subprogram calls with tangent versions f ( n, x,m, y, t 1 x, t 1 y ) ; 10 / 69

11 Can we reduce the computational cost? YES, WE CAN! 11 / 69

12 Algorithmic Differentiation Idea by Example adjoint code y = x 0 x 1 12 / 69

13 Algorithmic Differentiation Idea by Example adjoint code Alternatively, the transposed Jacobian can be computed as ȳ [2 v] x = f (x) T ȳ = f 1(x) T f 2(x) T f 3(y) T ȳ x 0 1. = 2.. (2 y ) ȳ [= n 1 2 x n 1 1 i=0 x2 i ] ȳ [1] [1] [1] x0 x1 x2 [2 x0] [2 x1] [2 x2] x0 x1 x2 The whole gradient f (x) can be approximated by setting ȳ = 1 at the computational cost of O(1) Cost(f ). 13 / 69

14 Writing Adjoint Code by Hand Basic Adjoint Code (Rules) 1. duplicate active data segment 2. store lost (due to overwriting or leaving scope) required values in forward section d o u b l e s. push ( z ) ; z=s i n ( x z ) ; 3. assignment-level adjoint code in reverse section... z=d o u b l e s. top ( ) ; d o u b l e s. pop ( ) ; a 1 x+=x c o s ( x z ) a 1 z a 1 z=z c o s ( x z ) a 1 z 4. reverse intraprocedural flow of control by (combinations of) 4.1 enumeration of basic blocks 4.2 counting loop iterations and enumeration of branches 4.3 explicit reversal of for-loops 14 / 69

15 Summary: Tangents and Adjoints by AD y = f (x) : IRn IR (w.l.o.g. m = 1) STCE I Tangent(-Linear) Code f (1) (forward mode) y (1) = f (x) x(1)n IRn IR f at O(n) Cost(f ) Note: Approximation by finite differences. I Adjoint Code f(1) (reverse mode) x(1) = y(1) f (x) IR f at O(1) Cost(f ) c ( J.Lotz) 15 / 69

16 Nice to have? MITgcm, (EAPS, MIT) in collaboration with ANL, MIT, Rice, UColorado J. Utke, U.N. et al: OpenAD/F: A modular, open-source tool for automatic differentiation of Fortran codes. ACM TOMS 34(4), Plot: A tangent computation / finite difference approximation for 64,800 grid points at 1 min each would keep us waiting for a month and a half... :-((( We did it in less than 10 minutes thanks to discrete adjoints computed by a differentiated version of the MITgcm :-) 16 / 69

17 Can we do it again (and again, and...)? YES WE CAN! 17 / 69

18 Tangent Model Graphically y[f ] F (x) y[f ] x F (x) x (1) x s x (1) x s y (1) y s = y x x = F (x) x(1) s 18 / 69

19 Adjoint Model Graphically t y (1) y[f ] F (x) x y (1) t y x (1) t x = t y y x = y (1) F (x) 19 / 69

20 Second-Order Tangent Model Graphically (w.l.o.g. m = 1) y (1) [ ] x (1)T F F (x) 2 F (x) x x (1) x (2) x (1,2) s Tangent Extension of the Linearized DAG of the Tangent Model y (1) = F (x) x (1) of y = F (x) 20 / 69

21 Second-Order Adjoint Model Graphically (w.l.o.g. m = 1) x(1)[ ] y(1) F (x) F 2 F (x) y(1) x y(2) (1) x (2) s Tangent Extension of the Linearized DAG of the Adjoint Model x (1) = F (x) T y (1) of y = F (x) 21 / 69

22 Summary: Second-(and Higher-)Order AD y = f (x) : IR n IR Second-Order Tangent Code (forward-over-forward AD) y (1,2) = x (1) T 2 f (x) x (2) IR n IR n n IR n 2 f at O(n 2 ) Cost(f ) Second-Order Adjoint Code (forward-over-reverse AD) x (2) (1) = y (1) 2 f (x) x (2) 2 f x (2) at O(1) Cost(f ) resp. 2 f at O(n) Cost(f ) Higher-order tangent (ToTo...ToT) and adjoint (ToTo...ToA) models are derived recursively 22 / 69

23 Algorithmic Differentiation Formalism 1. given implementation of F : IR n IR m : y = F (x), can be decomposed into a single assignment code (SAC) for i = 0,..., n 1 : v i = x i for j = n,..., n + q 1 : v j = ϕ j ( (vk ) k j ) for k = 0,..., m 1 : y k = v n+p+k where q = p + m 2. elemental functions ϕ j posess jointly continuous partial derivatives with respect to their arguments (v k ) k j at alle points of interest 23 / 69

24 Algorithmic Differentiation Tangent (Forward) Mode Let v j ϕ j s ((v k) k j ) for some s IR and j = 0,..., n + p + m 1. For given ẋ i, i = 0,..., n 1, tangent mode AD computes directional derivatives as follows: for i = 0,..., n 1 : v i = ẋ i ; v i = x i for j = n,..., n + q 1 : v j = i j ϕ j v i (v k ) k j v i v j = ϕ j ((v k ) k j ) for k = 0,..., m 1 : ẏ k = v n+p+k ; y k = v n+p+k 24 / 69

25 Algorithmic Differentiation Tangent Mode (Example) Let F : IR 2 IR 2, y = F (x) be implemented as x 0 = x 0 x 1 y 0 = sin(x 0) y 1 = x 0 x 1 yielding the SAC v 0 = x 0; v 1 = x 1 v 2 = v 0 v 1 y 0 = v 3 = sin(v 2) y 1 = v 4 = v 2 v / 69

26 Algorithmic Differentiation Tangent Mode (Proof Idea) Consider the extended function F : IR 5 IR 5 defined as where r i, i = 2, 3, 4 are random and x 0 x 0 x 0 x 1 v 2 y 0 = F x 1 r 2 r 3 = Φ3(Φ2(Φ1( x 1 r 2 r 3 ) y 1 r 4 r 4 x 0 x 0 x 1 Φ 1( r 2 r 3 ) = ( x 1 x 1 v 2 ); Φ2( v 2 r 3 r 3 ) = ( x 1 x 1 v 2 ); Φ3( v 2 v 3 v 3 ) = ( x 1 v 2 v 3 ) r 4 r 4 r 4 r 4 r 4 v 4 x 0 x 0 x 0 x 0 for v 2 = v 0 v 1; v 3 = sin(v 2); v 4 = v 2 v / 69

27 Algorithmic Differentiation Tangent Mode (Proof Idea) If F is continuously differentiable at x, then so is F and, hence, x 0 x 0 x 1 F = F( r 2 r 3 ) = Φ3( x 1 v 2 v 3 ) Φ2( x 1 v 2 r 3 ) Φ1( x 1 r 2 r 3 ) r 4 r 4 r 4 r 4 since = cos(v 2) x 1 x Moreover,... v 4 = v 2 v 1; v 3 = sin(v 2); v 2 = x 0 x 1. x 0 x 0 27 / 69

28 Algorithmic Differentiation Tangent Mode (Proof Idea) ẋ 0 ẋ 0 ẋ1 ẋ1 v2 ẏ = F ṙ2 0 ṙ3 ẏ1 ṙ ẋ ẋ1 = cos(v 2 ) 0 0 x 1 x ṙ2 ṙ ṙ ẋ ẋ1 = cos(v 2 ) 0 0 x 1 ẋ 0 + x 0 ẋ 1 ṙ ṙ ẋ 0 ẋ 0 ẋ ẋ1 ẋ1 ẋ1 = v2 cos v 2 v = v2 2 v = v2 3 v ṙ 4 v 2 ẋ 1 v 4 Q.E.D 28 / 69

29 Algorithmic Differentiation Adjoint (Reverse) Mode Let v j t ϕ j ((v k ) k j ) for some t IR and j = 0,..., n + p + m 1. For given ẏ i, i = 0,..., m 1, adjoint mode AD computes adjoint derivatives as follows: for i = 0,..., n 1 : v i = x i for j = n,..., n + q 1 : v j = ϕ j ((v k ) k j ) for k = 0,..., m 1 : y k = v n+p+k for k = 0,..., m 1 : v n+p+k = ȳ k for i = 0,..., n 1 : v i = x i for j = n + q 1,..., n : i j : v i = v i + ϕ j v i (v k ) k j v j v j = 0 for i = 0,..., n 1 : x i = v i 29 / 69

30 Algorithmic Differentiation Adjoint Mode (Proof Idea) Standard matrix arithmetic arithmetic yields x 0 x 0 x 1 x 1 x 1 x 1 F T = F( r 2 r 3 )T = Φ 1( r 2 r 3 )T Φ 2( v 2 r 3 )T Φ 3( v 2 v 3 r 4 r 4 r 4 r 4 x 0 x 0 )T 1 0 x x = cos(v 2) Moreover, / 69

31 Algorithmic Differentiation Adjoint Mode (Proof Idea) x 0 x 0 x 1 x v 2 ȳ = F T 1 v 2 0 ȳ 3 ȳ 1 ȳ x x x x = cos(v 2 ) v 2 ȳ ȳ x x x x = cos(v 2 ) ȳ 1 v 2 + ȳ 1 ȳ x x x x = ȳ 1 v 2 + ȳ 1 + cos(v 2 ) ȳ 0 0 = / 69

32 Algorithmic Differentiation Adjoint Mode (Proof Idea) corresponding to x 0 + x 1 ( v 2 + ȳ 1 + cos(v 2 ) ȳ 0 ) x 1 ȳ 1 + x 0 ( v 2 + ȳ 1 + cos(v 2 ) ȳ 0 )... = v 2 = v ȳ 1 x 1 = x 1 1 ȳ 1 ȳ 1 = 0 v 2 = v 2 + cos(v 2 ) ȳ 0 ȳ 0 = 0 x 1 = x 1 + x 0 v 2 x 0 = x 0 + x 1 v 2 v 2 = 0 Note the use of v 2 (stored in x 0) prior to input value of x 0. Q.E.D 32 / 69

33 AD by Overloading Example: y = f (x) = sin(e x ) v o i d f ( double &z ) { z=exp ( z ) ; z=s i n ( z ) ; } 1 sin(exp(x)) (generated with Gnuplot) 33 / 69

34 Tangents by Overloading... the dco approach (conceptually)... v 1(exp) v o i d t 1 f ( t 1 s : : t y p e &[z, t 1 z ] ) {... [ exp ( z ), exp ( z ) t 1 z ] ; } z 1 v (1) (1) 1 =e z1 z 1 z (1) 1 34 / 69

35 Tangents by Overloading z 2(=) z (1) 2 = 1 v (1) 1 v o i d t 1 f ( t 1 s : : t y p e &[z, t 1 z ] ) { [ z, t 1 z ]=[ exp ( z ), exp ( z ) t 1 z ] ; } v 1(exp) z 1 v (1) (1) 1 =e z1 z 1 z (1) 1 35 / 69

36 Tangents by Overloading v 2(sin) z 2(=) v (1) 2 = cos(z 2) z (1) 2 v o i d t 1 f ( t 1 s : : t y p e &[z, t 1 z ] ) { [ z, t 1 z ]=[ exp ( z ), exp ( z ) t 1 z ] ;... [ s i n ( z ), c o s ( z ) t 1 z ] ; } v 1(exp) z (1) 2 = 1 v (1) 1 v (1) (1) 1 =e z1 z 1 z 1 z (1) 1 36 / 69

37 Tangents by Overloading v o i d t 1 f ( t 1 s : : t y p e &[z, t 1 z ] ) { [ z, t 1 z ]=[ exp ( z ), exp ( z ) t 1 z ] ; [ z, t 1 z ]=[ s i n ( z ), c o s ( z ) t 1 z ] ; } Driver: z 3(=) v 2(sin) z 2(=)... t 1 s : : t y p e [ z, t 1 z ] = [..., 1 ] ; t 1 f ( [ z, t 1 z ] ) ; cout << t 1 z << e n d l ;... z 1 v 1(exp) z (1) 3 = 1 v (1) 2 v (1) 2 = cos(z 2) z (1) 2 z (1) 2 = 1 v (1) 1 v (1) (1) 1 =e z1 z 1 z (1) 1 37 / 69

38 dco/c++ Preprocessing The given implementation v o i d f ( i n t n, c o n s t double x, i n t n p, c o n s t double x p i n t m, double y, i n t m p, double y p ) ; of f : IR n IR np IR m IR mp : ( ) y = f (x, x p) needs to be preprocessed (manually and/or automatically) yielding a new implementation f. y p The scope of this preprocessing depends on the AD context. In the simplest case a mere change of the types of all active program variables to the desired dco/c++ type is sufficient. More substantial modifications may be required, e.g., in the context of checkpointing or when defining user-defined intrinsics. 38 / 69

39 dco/c++ Generic First-Order Tangent Mode To compute y (1) = F (x) x (1) activate #include dco.hpp redeclare floating-point variables in F as of type dco:: tt1s<double>::type seed set directional derivatives of active inputs run call active F harvest get directional derivatives of active outputs Live: Example 39 / 69

40 Adjoints by Overloading... the dco approach (conceptually)... v o i d a 1 f ( a1s : : t y p e &[z, a 1 z ] ) { [ z, TAPE]= exp ( z ) ;... }... z 2(=) [1] v 1(exp) [e z1 ] z 1 40 / 69

41 Adjoints by Overloading z 3(=) [1] v o i d a 1 f ( a1s : : t y p e &[z, a 1 z ] ) { [ z, TAPE]= exp ( z ) ; [ z, TAPE]= s i n ( z ) ; }... v 2(sin) [cos(z 2)] z 2(=) [1] v 1(exp) [e z1 ] z 1 41 / 69

42 Adjoints by Overloading z 3(1) z 3(=) v o i d a 1 f ( a1s : : t y p e &[z, a 1 z ] ) { [ z, TAPE]= exp ( z ) ; [ z, TAPE]= s i n ( z ) ; }... a 1 z =1; TAPE. i n t e r p r e t ( ) ;... [1] v 2(sin) [cos(z 2)] z 2(=) [1] v 1(exp) [e z1 ] z 1 42 / 69

43 Adjoints by Overloading z 3(1) z 3(=) v o i d a 1 f ( a1s : : t y p e &[z, a 1 z ] ) { [ z, TAPE]= exp ( z ) ; [ z, TAPE]= s i n ( z ) ; }... a 1 z =1; TAPE. i n t e r p r e t ( ) ;... v 2(1) = 1 z 3(1) v 2(sin) [cos(z 2)] z 2(=) [1] v 1(exp) [e z1 ] z 1 43 / 69

44 Adjoints by Overloading z 3(1) z 3(=) v o i d a 1 f ( a1s : : t y p e &[z, a 1 z ] ) { [ z, TAPE]= exp ( z ) ; [ z, TAPE]= s i n ( z ) ; }... a 1 z =1; TAPE. i n t e r p r e t ( ) ;... v 2(1) = 1 z 3(1) v 2(sin) z 2(1) = cos(z 2) v 2(1) z 2(=) [1] v 1(exp) [e z1 ] z 1 44 / 69

45 Adjoints by Overloading z 3(1) z 3(=) v o i d a 1 f ( a1s : : t y p e &[z, a 1 z ] ) { [ z, TAPE]= exp ( z ) ; [ z, TAPE]= s i n ( z ) ; }... a 1 z =1; TAPE. i n t e r p r e t ( ) ;... v 2(1) = 1 z 3(1) v 2(sin) z 2(1) = cos(z 2) v 2(1) z 2(=) v 1(1) = 1 z 2(1) v 1(exp) [e z1 ] z 1 45 / 69

46 Adjoints by Overloading z 3(1) v o i d a 1 f ( a1s : : t y p e &[z, a 1 z ] ) { [ z, TAPE]= exp ( z ) ; [ z, TAPE]= s i n ( z ) ; }... a 1 z =1; TAPE. i n t e r p r e t ( ) ; cout << a 1 z << e n d l ;... z 3(=) v 2(1) = 1 z 3(1) v 2(sin) z 2(1) = cos(z 2) v 2(1) z 2(=) v 1(1) = 1 z 2(1) v 1(exp) z 1(1) = e z1 v 1(1) z 1 46 / 69

47 dco/c++ Generic First-Order Adjoint Mode To compute x (1) = x (1) + F (x) T y (1) activate #include dco.hpp instantiate tape for base type double redeclare floating-point variables in F as of type dco:: ta1s<double>::type tape register active inputs x call active F mark active outputs y seed set adjoints x (1) and y (1) of active inputs and outputs, respectively interpret run tape interpreter harvest get adjoints x (1) of active inputs Live: Example 47 / 69

48 Second (and Higher) Derivatives Tangent Projection (A 2 F, F : IR 6 IR 4 ) A v <A,v> 48 / 69

49 Second (and Higher) Derivatives Adjoint Projection (A 2 F, F : IR 6 IR 4 ) w A <w,a> 49 / 69

50 Second (and Higher) Derivatives Second-Order Tangent Projection (A 2 F, F : IR 6 IR 4 ) Note: due to symmetry. A v u <A,v,u> < A, v, u >=<< A, v >, u >=<< A, u >, v >=< A, u, v > 50 / 69

51 Second (and Higher) Derivatives Second-Order Adjoint Projection (A 2 F, F : IR 6 IR 4 ) v w A <w,a,v> Note: < w, A, v >=< w <, A, v >>=<< w, A >, v >=< v, < w, A >>=< v, w, A > due to symmetry. 51 / 69

52 dco/c++ Generic Second-Order Tangent Mode To compute y (1,2) =< F (x), x (1,2) > + < 2 F (x), x (1), x (2) > activate #include dco.hpp redeclare floating-point variables in F as of type dco:: tt1s<dco::tt1s<double>::type>::type seed set tangents x (1) and x (2) of active input set second-order tangent x (1,2) of active input run call active F harvest get second-order tangent y (1,2) of active output Live: Example 52 / 69

53 dco/c++ Generic Second-Order Adjoint Mode To compute x (2) (1) = x(2) (1) + < y(2) (1), F (x) > + < y (1), 2 F (x), x (2) > activate #include dco.hpp instantiate tape for base type dco:: tt1s<double>::type redeclare floating-point variables in F as of type dco:: ta1s<tt1s<double>::type>::type seed tangent set tangent x (2) for active input tape register active input x call active F mark active output y seed adjoints set adjoint y (1) of active output set second-order adjoints x (2) and y(2) of active input and output, respectively (1) (1) interpret run tape interpreter harvest get second-order adjoint x (2) (1) of active input Live: Example 53 / 69

54 Is it really that easy? WELL, / 69

55 External Function General Case (y, y p) = f (x, x p) x p ū p v p y p x [ ] ū x ū u p v p v [ ] y v y [1] [1] u [ ] v u v x (1) ū (1) [ ] ū x v (1) y (1) [ ] y v [1] [1] u (1) v (1) [ ] v u 55 / 69

56 External Function General Case xp ūp vp yp up vp x [ ū ] ū v [ y ] y x(1) [ ū ] ū(1) v(1) [ y ] y(1) x v x v [1] [1] u [ v u ] v [1] [1] u(1) [ v u ] v(1) A gap in the tape is introduced by calling a user-defined function make gap to record the following gap data: Tape location of active gap inputs ū in order to write ū (1) := u (1) correctly; adjoint gap input checkpoint (u, u p, v, v p) in order to initialize interpretation of the gap correctly; tape location of active gap outputs v in order to initialize v (1) := v (1) and, hence, interpretation of gap correctly; requires execution of g(u, u p, v, v p). This data is stored in the tape together with a reference to a user-defined function interpret gap to increment ū (1) with ( v u ) T v(1). 56 / 69

57 External Function Support by dco/c++ while taping f User function make gap: u := gap data >register input(ū); u p := ū p gap data >write to checkpoint(z ), where z (ū, ū p, ) g(u, u p, v, v p) v := gap data >register output(v) gap data >write to checkpoint(z + ), where z + (v, v p, ) register external function(&interpret gap,gap data) xp ūp vp yp up vp x [ ū x ] ū v [ y v ] y [1] [1] u [ v u ] v 57 / 69

58 External Function Support by dco/c++ while interpreting tape for f User function interpret gap : gap data >read from checkpoint(z), where z (z, z + ) v (1) := gap data >get output adjoint() g (1) (z, v (1), v p, u (1) ) gap data >increment input adjoint(u (1) ) x(1) [ ū x ] ū(1) v(1) [ y v ] y(1) [1] [1] u(1) [ v u ] v(1) 58 / 69

59 Checkpointing Formalism: Call Tree v o i d g ( i n t l, i n t k, c o n s t double u, double v ) {... } v o i d f ( i n t n, i n t m, c o n s t double x, double y ) {... g ( l, k, u, v ) ;... } yields f g 59 / 69

60 Checkpointing Adjoint Call Tree f (MAKE TAPE) g (STORE INPUTS) g f (INTERPRET TAPE) g (RESTORE INPUTS) g (MAKE TAPE) g (INTERPRET TAPE) Assumption: f and g are transformed into f and g, respectively. The new routines implement the four modes (MAKE TAPE, INTERPRET TAPE, STORE INPUTS, RESTORE INPUTS) that are required by the checkpointed adjoint code. 60 / 69

61 External Function Checkpointing (make gap) u ū (g (INTERPRET TAPE,...) increments ū (1) ); u p := ū p g(u, u p, v, v p) v := gap data >register output(v) gap data >write to checkpoint(ū, ū p) register external function(&interpret gap,gap data) xp ūp vp yp up vp x [ ū x ] ū v [ y v ] y [1] [1] u [ v u ] v 61 / 69

62 External Function Checkpointing (interpret gap) gap data >read from checkpoint(u, u p) g (MAKE TAPE,u, u p) v (1) := gap data >get output adjoint() g (INTERPRET TAPE,v (1) ) (interpretation increments ū (1) ) x(1) [ ū x ] ū(1) v(1) [ y v ] y(1) [1] [1] u(1) [ v u ] v(1) 62 / 69

63 External Function Checkpointing (Implementation) template<typename ATYPE> v o i d f ( i n t n, ATYPE& x ) { f o r ( i n t i =0; i <n ; i ++) x=s i n ( x ) ; }... i n t main ( ) {... f ( n /3, x ) ; f make gap ( n /3, x ) ; f ( n n /3 2, x ) ;... } n iterations of x = sin(x) split into thirds checkpointed adjoint: a1s_joint_reversal naive adjoint: single call of f(n,x) instead 63 / 69

64 External Function Adjoint Ensemble (Concurrent Local Taping) v o i d f (... ) {... vb =0; f o r ( i n t i =0; i <N; i ++) { g ( u, u p [ i ], v [ i ], v p [ i ] ) ; vb+=v [ i ] ;... }... } u 1 p u 1 [ ] v 1 u 1 v 1 p v 1 xp ūp vp yp [1] [1]. x [ ū x ] ū u N p v N p v [ y v ] y [1] [1] u N [ ] v N u N v N 64 / 69

65 External Function Adjoint Ensemble (Concurrent Local Interpretation) u 1 (1) [ ] v 1 (1) v 1 u 1 [1] [1] x(1) [ ū x ] ū(1) v(1) [ y v ] y(1) [1] [1] u N (1) [ ] v N (1) v N u N plain adjoint AD likely to run out of memory for large N path-wise adjoints reduce memory requirement siginifcantly multiple tapes enable thread-parallelism optionally: individual paths and their adjoints on accelerators 65 / 69

66 External Function Adjoint Ensemble (Implementation) template<typename ATYPE> v o i d f ( i n t m, c o n s t ATYPE& x, c o n s t double& r, ATYPE& y ) { y =0; f o r ( i n t i =0; i <m; i ++) y+=s i n ( x+r ) ; } ensemble over x in (random) r naive adjoint a1s_adjoint_ensemble/plain adjoint ensemble a1s_adjoint_ensemble 66 / 69

67 External Function User-Defined Adjoints (Motivating Example) r(x, p) x 2 p = 0 x (1) x p ( x (1) 2 x x ) p 1 = 2 x x (1) x p x (1) = 0 x = SOLVE(x 0, p) p (1) = SOLVE (1) (x 0, x (1), p) p (1) = SOLVE(x, x (1) ) x p x (1) x p = x (1) 2 p = x (1) 2 x p (1) p (1) exact inexact continuous adjoint discrete adjoint 67 / 69

68 External Function User-Defined Adjoints (Implementation) solving x 2 p = 0 by Newton s method template<typename ATYPE> v o i d m y s q r t (ATYPE p, ATYPE& x ) { c o n s t double eps=1e 15; ATYPE x o l d=x +1; w h i l e ( abs ( x x o l d )> eps ) { x o l d=x ; x=x o l d ( x o l d x o l d p ) / ( 2 x o l d ) ; } } solving (linear) adjoint equation explicitely v o i d m y a d j o i n t s q r t ( double& a1s p, double x, double a 1 s x ) { a 1 s p=a 1 s x /(2 x ) ; } discrete adjoint a1s_user_defined_intrinsic/discrete continuous adjoint a1s_user_defined_intrinsic 68 / 69

69 AD STCE Ongoing EU: AboutFlow, Scorpio, Fortissimo (OpenFOAM, ACE+) Tier-1 Investment Banks: Risk management NAG, DFG: Adjoint numerical methods (NAG Library) DFG: Hybrid discrete adjoints BAW, EDF: Waterways engineering (Telemac/Sisyphe) MPI-M: Oceanography (ICON GCM) JADE: DAEs with optimality conditions GRS: Toward robust global (deterministic) optimization FNR, Base: Adjoint MPI / OpenMP 69 / 69

STCE. Adjoint Code Design Patterns. Uwe Naumann. RWTH Aachen University, Germany. QuanTech Conference, London, April 2016

STCE. Adjoint Code Design Patterns. Uwe Naumann. RWTH Aachen University, Germany. QuanTech Conference, London, April 2016 Adjoint Code Design Patterns Uwe Naumann RWTH Aachen University, Germany QuanTech Conference, London, April 2016 Outline Why Adjoints? What Are Adjoints? Software Tool Support: dco/c++ Adjoint Code Design

More information

Nested Differentiation and Symmetric Hessian Graphs with ADTAGEO

Nested Differentiation and Symmetric Hessian Graphs with ADTAGEO Nested Differentiation and Symmetric Hessian Graphs with ADTAGEO ADjoints and TAngents by Graph Elimination Ordering Jan Riehme Andreas Griewank Institute for Applied Mathematics Humboldt Universität zu

More information

Algorithmic Differentiation of Numerical Methods: Tangent and Adjoint Solvers for Parameterized Systems of Nonlinear Equations

Algorithmic Differentiation of Numerical Methods: Tangent and Adjoint Solvers for Parameterized Systems of Nonlinear Equations Algorithmic Differentiation of Numerical Methods: Tangent and Adjoint Solvers for Parameterized Systems of Nonlinear Equations UWE NAUMANN, JOHANNES LOTZ, KLAUS LEPPKES, and MARKUS TOWARA, RWTH Aachen

More information

STCE. Mind the Gap in the Chain Rule. Uwe Naumann. Software Tool Support for Advanced Algorithmic Differentiation of Numerical Simulation Code

STCE. Mind the Gap in the Chain Rule. Uwe Naumann. Software Tool Support for Advanced Algorithmic Differentiation of Numerical Simulation Code Mind the Gap in the Chain Rule Software Tool Support for Advanced Algorithmic Differentiation of Numerical Simulation Code Uwe Naumann Software and Tools for Computational Engineering, RWTH Aachen University

More information

STCE. Mixed Integer Programming for Call Tree Reversal. J. Lotz, U. Naumann, S. Mitra

STCE. Mixed Integer Programming for Call Tree Reversal. J. Lotz, U. Naumann, S. Mitra Mixed Integer Programming or J. Lotz, U. Naumann, S. Mitra LuFG Inormatik 12: Sotware and Tools or Computational Engineering () RWTH Aacen University and Cemical Engineering, Carnegie Mellon University

More information

Low-Memory Tour Reversal in Directed Graphs 1. Uwe Naumann, Viktor Mosenkis, Elmar Peise LuFG Informatik 12, RWTH Aachen University, Germany

Low-Memory Tour Reversal in Directed Graphs 1. Uwe Naumann, Viktor Mosenkis, Elmar Peise LuFG Informatik 12, RWTH Aachen University, Germany Low-Memory Tour Reversal in Directed Graphs 1 Uwe Naumann, Viktor Mosenkis, Elmar Peise LuFG Informatik 12, RWTH Aachen University, Germany 1 EuroAD 9, INRIA, Nov. 2009 Contents Motivation: Derivative

More information

Dense Arithmetic over Finite Fields with CUMODP

Dense Arithmetic over Finite Fields with CUMODP Dense Arithmetic over Finite Fields with CUMODP Sardar Anisul Haque 1 Xin Li 2 Farnam Mansouri 1 Marc Moreno Maza 1 Wei Pan 3 Ning Xie 1 1 University of Western Ontario, Canada 2 Universidad Carlos III,

More information

Automatic Differentiation for Optimum Design, Applied to Sonic Boom Reduction

Automatic Differentiation for Optimum Design, Applied to Sonic Boom Reduction Automatic Differentiation for Optimum Design, Applied to Sonic Boom Reduction Laurent Hascoët, Mariano Vázquez, Alain Dervieux Laurent.Hascoet@sophia.inria.fr Tropics Project, INRIA Sophia-Antipolis AD

More information

Math and Numerical Methods Review

Math and Numerical Methods Review Math and Numerical Methods Review Michael Caracotsios, Ph.D. Clinical Associate Professor Chemical Engineering Department University of Illinois at Chicago Introduction In the study of chemical engineering

More information

Intro to Automatic Differentiation

Intro to Automatic Differentiation Intro to Automatic Differentiation Thomas Kaminski (http://fastopt.com) Thanks to: Simon Blessing (FastOpt), Ralf Giering (FastOpt), Nadine Gobron (JRC), Wolfgang Knorr (QUEST), Thomas Lavergne (Met.No),

More information

Tracking Atmospheric Plumes Using Stand-off Sensor Data

Tracking Atmospheric Plumes Using Stand-off Sensor Data DTRA CBIS2005.ppt Sensor Data Fusion Working Group 28 October 2005 Albuquerque, NM Tracking Atmospheric Plumes Using Stand-off Sensor Data Prepared by: Robert C. Brown, David Dussault, and Richard C. Miake-Lye

More information

Department of Computer Science. Syntax-Directed Derivative Code (Part II: Intraprocedural Adjoint Code)

Department of Computer Science. Syntax-Directed Derivative Code (Part II: Intraprocedural Adjoint Code) Aachen Department of Computer Science Technical Report Syntax-Directed Derivative Code (Part II: Intraprocedural Adjoint Code) Uwe Naumann ISSN 0935 3232 Aachener Informatik Berichte AIB-2005-17 RWTH Aachen

More information

Current Developments and Applications related to the Discrete Adjoint Solver in SU2

Current Developments and Applications related to the Discrete Adjoint Solver in SU2 Current Developments and Applications related to the Discrete Adjoint Solver in SU2 Tim Albring, Max Sagebaum, Ole Burghardt, Lisa Kusch, Nicolas R. Gauger Chair for Scientific Computing TU Kaiserslautern

More information

Model Order Reduction via Matlab Parallel Computing Toolbox. Istanbul Technical University

Model Order Reduction via Matlab Parallel Computing Toolbox. Istanbul Technical University Model Order Reduction via Matlab Parallel Computing Toolbox E. Fatih Yetkin & Hasan Dağ Istanbul Technical University Computational Science & Engineering Department September 21, 2009 E. Fatih Yetkin (Istanbul

More information

Neural Networks in Structured Prediction. November 17, 2015

Neural Networks in Structured Prediction. November 17, 2015 Neural Networks in Structured Prediction November 17, 2015 HWs and Paper Last homework is going to be posted soon Neural net NER tagging model This is a new structured model Paper - Thursday after Thanksgiving

More information

Nearest Correlation Matrix

Nearest Correlation Matrix Nearest Correlation Matrix The NAG Library has a range of functionality in the area of computing the nearest correlation matrix. In this article we take a look at nearest correlation matrix problems, giving

More information

Random Number Generation. Stephen Booth David Henty

Random Number Generation. Stephen Booth David Henty Random Number Generation Stephen Booth David Henty Introduction Random numbers are frequently used in many types of computer simulation Frequently as part of a sampling process: Generate a representative

More information

An Introduction to Differential Algebra

An Introduction to Differential Algebra An Introduction to Differential Algebra Alexander Wittig1, P. Di Lizia, R. Armellin, et al. 1 ESA Advanced Concepts Team (TEC-SF) SRL, Milan Dinamica Outline 1 Overview Five Views of Differential Algebra

More information

Interval Arithmetic An Elementary Introduction and Successful Applications

Interval Arithmetic An Elementary Introduction and Successful Applications Interval Arithmetic An Elementary Introduction and Successful Applications by R. Baker Kearfott Department of Mathematics University of Southwestern Louisiana U.S.L. Box 4-1010 Lafayette, LA 70504-1010

More information

Variational assimilation Practical considerations. Amos S. Lawless

Variational assimilation Practical considerations. Amos S. Lawless Variational assimilation Practical considerations Amos S. Lawless a.s.lawless@reading.ac.uk 4D-Var problem ] [ ] [ 2 2 min i i i n i i T i i i b T b h h J y R y B,,, n i i i i f subject to Minimization

More information

Sensitivity analysis by adjoint Automatic Differentiation and Application

Sensitivity analysis by adjoint Automatic Differentiation and Application Sensitivity analysis by adjoint Automatic Differentiation and Application Anca Belme Massimiliano Martinelli Laurent Hascoët Valérie Pascual Alain Dervieux INRIA Sophia-Antipolis Project TROPICS Alain.Dervieux@inria.fr

More information

22 : Hilbert Space Embeddings of Distributions

22 : Hilbert Space Embeddings of Distributions 10-708: Probabilistic Graphical Models 10-708, Spring 2014 22 : Hilbert Space Embeddings of Distributions Lecturer: Eric P. Xing Scribes: Sujay Kumar Jauhar and Zhiguang Huo 1 Introduction and Motivation

More information

Computation of the error functions erf and erfc in arbitrary precision with correct rounding

Computation of the error functions erf and erfc in arbitrary precision with correct rounding Computation of the error functions erf and erfc in arbitrary precision with correct rounding Sylvain Chevillard Arenaire, LIP, ENS-Lyon, France Sylvain.Chevillard@ens-lyon.fr Nathalie Revol INRIA, Arenaire,

More information

Compatible Discretization Schemes

Compatible Discretization Schemes Compatible Discretization Schemes Marc Gerritsma 1 1 Collaborators Artur Palha, Guido Oud, Jasper Kreeft & Mick Bouman Marc Gerritsma Burgers Course CFD I, 25-29 January 2010 1 / 81 What if... Why mimetic

More information

Review and Unification of Methods for Computing Derivatives of Multidisciplinary Computational Models

Review and Unification of Methods for Computing Derivatives of Multidisciplinary Computational Models his is a preprint of the following article, which is available from http://mdolabenginumichedu J R R A Martins and J Hwang Review and unification of methods for computing derivatives of multidisciplinary

More information

Cyclops Tensor Framework

Cyclops Tensor Framework Cyclops Tensor Framework Edgar Solomonik Department of EECS, Computer Science Division, UC Berkeley March 17, 2014 1 / 29 Edgar Solomonik Cyclops Tensor Framework 1/ 29 Definition of a tensor A rank r

More information

Physics 202 Laboratory 3. Root-Finding 1. Laboratory 3. Physics 202 Laboratory

Physics 202 Laboratory 3. Root-Finding 1. Laboratory 3. Physics 202 Laboratory Physics 202 Laboratory 3 Root-Finding 1 Laboratory 3 Physics 202 Laboratory The fundamental question answered by this week s lab work will be: Given a function F (x), find some/all of the values {x i }

More information

Quantitative Techniques (Finance) 203. Polynomial Functions

Quantitative Techniques (Finance) 203. Polynomial Functions Quantitative Techniques (Finance) 03 Polynomial Functions Felix Chan October 006 Introduction This topic discusses the properties and the applications of polynomial functions, specifically, linear and

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

Work in Progress: Reachability Analysis for Time-triggered Hybrid Systems, The Platoon Benchmark

Work in Progress: Reachability Analysis for Time-triggered Hybrid Systems, The Platoon Benchmark Work in Progress: Reachability Analysis for Time-triggered Hybrid Systems, The Platoon Benchmark François Bidet LIX, École polytechnique, CNRS Université Paris-Saclay 91128 Palaiseau, France francois.bidet@polytechnique.edu

More information

Numerical Derivatives in Scilab

Numerical Derivatives in Scilab Numerical Derivatives in Scilab Michaël Baudin February 2017 Abstract This document present the use of numerical derivatives in Scilab. In the first part, we present a result which is surprising when we

More information

Algorithm 853: an Efficient Algorithm for Solving Rank-Deficient Least Squares Problems

Algorithm 853: an Efficient Algorithm for Solving Rank-Deficient Least Squares Problems Algorithm 853: an Efficient Algorithm for Solving Rank-Deficient Least Squares Problems LESLIE FOSTER and RAJESH KOMMU San Jose State University Existing routines, such as xgelsy or xgelsd in LAPACK, for

More information

Lecture 25: November 27

Lecture 25: November 27 10-725: Optimization Fall 2012 Lecture 25: November 27 Lecturer: Ryan Tibshirani Scribes: Matt Wytock, Supreeth Achar Note: LaTeX template courtesy of UC Berkeley EECS dept. Disclaimer: These notes have

More information

Neural Networks Learning the network: Backprop , Fall 2018 Lecture 4

Neural Networks Learning the network: Backprop , Fall 2018 Lecture 4 Neural Networks Learning the network: Backprop 11-785, Fall 2018 Lecture 4 1 Recap: The MLP can represent any function The MLP can be constructed to represent anything But how do we construct it? 2 Recap:

More information

DiffSharp An AD Library for.net Languages

DiffSharp An AD Library for.net Languages DiffSharp An AD Library for.net Languages Atılım Güneş Baydin 1 Barak A. Pearlmutter 2 Jeffrey Mark Siskind 3 1 University of Oxford gunes@robots.ox.ac.uk 2 Maynooth University barak@pearlmutter.net 3

More information

MATHEMATICAL OBJECTS in

MATHEMATICAL OBJECTS in MATHEMATICAL OBJECTS in Computational Tools in a Unified Object-Oriented Approach Yair Shapira @ CRC Press Taylor & Francis Group Boca Raton London New York CRC Press is an imprint of the Taylor & Francis

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering)

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering) THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: One A4

More information

Perhaps the simplest way of modeling two (discrete) random variables is by means of a joint PMF, defined as follows.

Perhaps the simplest way of modeling two (discrete) random variables is by means of a joint PMF, defined as follows. Chapter 5 Two Random Variables In a practical engineering problem, there is almost always causal relationship between different events. Some relationships are determined by physical laws, e.g., voltage

More information

Errors. Intensive Computation. Annalisa Massini 2017/2018

Errors. Intensive Computation. Annalisa Massini 2017/2018 Errors Intensive Computation Annalisa Massini 2017/2018 Intensive Computation - 2017/2018 2 References Scientific Computing: An Introductory Survey - Chapter 1 M.T. Heath http://heath.cs.illinois.edu/scicomp/notes/index.html

More information

Automatic Differentiation Lecture No 1

Automatic Differentiation Lecture No 1 Automatic Differentiation Lecture No 1 Warwick Tucker The CAPA group Department of Mathematics Uppsala University, Sweden escience Winter School, Geilo Introduction to AD When do we use derivatives? Introduction

More information

18.02 Multivariable Calculus Fall 2007

18.02 Multivariable Calculus Fall 2007 MIT OpenourseWare http://ocw.mit.edu 18.02 Multivariable alculus Fall 2007 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.02 Lecture 21. Test for

More information

Nonlinear Control as Program Synthesis (A Starter)

Nonlinear Control as Program Synthesis (A Starter) Nonlinear Control as Program Synthesis (A Starter) Sicun Gao MIT December 15, 2014 Preliminaries Definition (L RF ) L RF is the first-order language over the reals that allows arbitrary numerically computable

More information

An Overly Simplified and Brief Review of Differential Equation Solution Methods. 1. Some Common Exact Solution Methods for Differential Equations

An Overly Simplified and Brief Review of Differential Equation Solution Methods. 1. Some Common Exact Solution Methods for Differential Equations An Overly Simplified and Brief Review of Differential Equation Solution Methods We will be dealing with initial or boundary value problems. A typical initial value problem has the form y y 0 y(0) 1 A typical

More information

Requirements Validation. Content. What the standards say (*) ?? Validation, Verification, Accreditation!! Correctness and completeness

Requirements Validation. Content. What the standards say (*) ?? Validation, Verification, Accreditation!! Correctness and completeness Requirements Validation Requirements Management Requirements Validation?? Validation, Verification, Accreditation!! Check if evrything is OK With respect to what? Mesurement associated with requirements

More information

Elements of Floating-point Arithmetic

Elements of Floating-point Arithmetic Elements of Floating-point Arithmetic Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Floating-point Numbers Representations IEEE Floating-point Standards Underflow

More information

Contents. Preface... xi. Introduction...

Contents. Preface... xi. Introduction... Contents Preface... xi Introduction... xv Chapter 1. Computer Architectures... 1 1.1. Different types of parallelism... 1 1.1.1. Overlap, concurrency and parallelism... 1 1.1.2. Temporal and spatial parallelism

More information

Airfoil shape optimization using adjoint method and automatic differentiation

Airfoil shape optimization using adjoint method and automatic differentiation Airfoil shape optimization using adjoint method and automatic differentiation Praveen. C praveen@math.tifrbng.res.in Tata Institute of Fundamental Research Center for Applicable Mathematics Bangalore 5665

More information

CS 453X: Class 20. Jacob Whitehill

CS 453X: Class 20. Jacob Whitehill CS 3X: Class 20 Jacob Whitehill More on training neural networks Training neural networks While training neural networks by hand is (arguably) fun, it is completely impractical except for toy examples.

More information

2013 HSC Mathematics Extension 1 Marking Guidelines

2013 HSC Mathematics Extension 1 Marking Guidelines 03 HSC Mathematics Extension Marking Guidelines Section I Multiple-choice Answer Key Question Answer C D 3 C 4 D 5 A 6 B 7 A 8 D 9 B 0 C 03 HSC Mathematics Extension Marking Guidelines Section II Question

More information

Chapter 1 Error Analysis

Chapter 1 Error Analysis Chapter 1 Error Analysis Several sources of errors are important for numerical data processing: Experimental uncertainty: Input data from an experiment have a limited precision. Instead of the vector of

More information

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018 Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 3. Logarithmic Space Reinhard Pichler Institute of Logic and Computation DBAI Group TU Wien 3. Logarithmic Space 3.1 Computational

More information

INVARIANT RELATIONS: A CONCEPT FOR ANALYZING WHILE LOOPS. Ali Mili, NJIT NII, Tokyo, Japan December 20, 2011

INVARIANT RELATIONS: A CONCEPT FOR ANALYZING WHILE LOOPS. Ali Mili, NJIT NII, Tokyo, Japan December 20, 2011 INVARIANT RELATIONS: A CONCEPT FOR ANALYZING WHILE LOOPS Ali Mili, NJIT NII, Tokyo, Japan December 20, 2011 PLAN 2 Motivation Relational Mathematics Invariant Relations Invariant Relations and Loop Functions

More information

Programming Language Concepts, CS2104 Lecture 3

Programming Language Concepts, CS2104 Lecture 3 Programming Language Concepts, CS2104 Lecture 3 Statements, Kernel Language, Abstract Machine 31 Aug 2007 CS2104, Lecture 3 1 Reminder of last lecture Programming language definition: syntax, semantics

More information

Satisfiability Checking

Satisfiability Checking Satisfiability Checking Interval Constraint Propagation Prof. Dr. Erika Ábrahám RWTH Aachen University Informatik 2 LuFG Theory of Hybrid Systems WS 14/15 Satisfiability Checking Prof. Dr. Erika Ábrahám

More information

Line Search Algorithms

Line Search Algorithms Lab 1 Line Search Algorithms Investigate various Line-Search algorithms for numerical opti- Lab Objective: mization. Overview of Line Search Algorithms Imagine you are out hiking on a mountain, and you

More information

Synthesis of Winning Strategies for Interaction under Partial Information

Synthesis of Winning Strategies for Interaction under Partial Information Synthesis of Winning Strategies for Interaction under Partial Information Oberseminar Informatik Bernd Puchala RWTH Aachen University June 10th, 2013 1 Introduction Interaction Strategy Synthesis 2 Main

More information

Adjoint approach to optimization

Adjoint approach to optimization Adjoint approach to optimization Praveen. C praveen@math.tifrbng.res.in Tata Institute of Fundamental Research Center for Applicable Mathematics Bangalore 560065 http://math.tifrbng.res.in Health, Safety

More information

D03PEF NAG Fortran Library Routine Document

D03PEF NAG Fortran Library Routine Document D03 Partial Differential Equations D03PEF NAG Fortran Library Routine Document Note. Before using this routine, please read the Users Note for your implementation to check the interpretation of bold italicised

More information

Elements of Floating-point Arithmetic

Elements of Floating-point Arithmetic Elements of Floating-point Arithmetic Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Floating-point Numbers Representations IEEE Floating-point Standards Underflow

More information

A computational architecture for coupling heterogeneous numerical models and computing coupled derivatives

A computational architecture for coupling heterogeneous numerical models and computing coupled derivatives This is a preprint of the following article, which is available from http://mdolab.engin.umich.edu John T. Hwang and J. R. R. A. Martins. A computational architecture for coupling heterogeneous numerical

More information

Machine Learning Lecture 7

Machine Learning Lecture 7 Course Outline Machine Learning Lecture 7 Fundamentals (2 weeks) Bayes Decision Theory Probability Density Estimation Statistical Learning Theory 23.05.2016 Discriminative Approaches (5 weeks) Linear Discriminant

More information

Models of Computation, Recall Register Machines. A register machine (sometimes abbreviated to RM) is specified by:

Models of Computation, Recall Register Machines. A register machine (sometimes abbreviated to RM) is specified by: Models of Computation, 2010 1 Definition Recall Register Machines A register machine (sometimes abbreviated M) is specified by: Slide 1 finitely many registers R 0, R 1,..., R n, each capable of storing

More information

Course outline Mathematics: Methods ATAR Year 11

Course outline Mathematics: Methods ATAR Year 11 Course outline Mathematics: Methods ATAR Year 11 Unit 1 Sequential In Unit 1 students will be provided with opportunities to: underst the concepts techniques in algebra, functions, graphs, trigonometric

More information

Chapter 6 - Ordinary Differential Equations

Chapter 6 - Ordinary Differential Equations Chapter 6 - Ordinary Differential Equations 7.1 Solving Initial-Value Problems In this chapter, we will be interested in the solution of ordinary differential equations. Ordinary differential equations

More information

DELFT UNIVERSITY OF TECHNOLOGY

DELFT UNIVERSITY OF TECHNOLOGY DELFT UNIVERSITY OF TECHNOLOGY REPORT -09 Computational and Sensitivity Aspects of Eigenvalue-Based Methods for the Large-Scale Trust-Region Subproblem Marielba Rojas, Bjørn H. Fotland, and Trond Steihaug

More information

Discrete Mathematics Review

Discrete Mathematics Review CS 1813 Discrete Mathematics Discrete Mathematics Review or Yes, the Final Will Be Comprehensive 1 Truth Tables for Logical Operators P Q P Q False False False P Q False P Q False P Q True P Q True P True

More information

COMPUTATIONAL MODELING OF SHAPE MEMORY MATERIALS

COMPUTATIONAL MODELING OF SHAPE MEMORY MATERIALS COMPUTATIONAL MODELING OF SHAPE MEMORY MATERIALS Jan Valdman Institute of Information Theory and Automation, Czech Academy of Sciences (Prague) based on joint works with Martin Kružík and Miroslav Frost

More information

COSY INFINITY Version 7

COSY INFINITY Version 7 COSY INFINITY Version 7 Kyoko Makino and Martin Berz Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory Michigan State University, East Lansing, MI 48824 Abstract An

More information

Introduction to Finite Di erence Methods

Introduction to Finite Di erence Methods Introduction to Finite Di erence Methods ME 448/548 Notes Gerald Recktenwald Portland State University Department of Mechanical Engineering gerry@pdx.edu ME 448/548: Introduction to Finite Di erence Approximation

More information

Übung Informatik I - Programmierung - Blatt 7

Übung Informatik I - Programmierung - Blatt 7 RHEINISCH- WESTFÄLISCHE TECHNISCHE HOCHSCHULE AACHEN LEHR- UND FORSCHUNGSGEBIET INFORMATIK II RWTH Aachen D-52056 Aachen GERMANY http://programmierung.informatik.rwth-aachen.de LuFG Informatik II Prof.

More information

4 Nonlinear Equations

4 Nonlinear Equations 4 Nonlinear Equations lecture 27: Introduction to Nonlinear Equations lecture 28: Bracketing Algorithms The solution of nonlinear equations has been a motivating challenge throughout the history of numerical

More information

Exact Arithmetic on a Computer

Exact Arithmetic on a Computer Exact Arithmetic on a Computer Symbolic Computation and Computer Algebra William J. Turner Department of Mathematics & Computer Science Wabash College Crawfordsville, IN 47933 Tuesday 21 September 2010

More information

Uniqueness of the 5-ary Steiner Law. on Elliptic Curves. W. McCune. Argonne National Laboratory U.S.A. R. Padmanabhan y. Department of Mathematics

Uniqueness of the 5-ary Steiner Law. on Elliptic Curves. W. McCune. Argonne National Laboratory U.S.A. R. Padmanabhan y. Department of Mathematics Uniqueness of the 5-ary Steiner Law on Elliptic Curves W. McCune Mathematics and Computer Science Division Argonne National Laboratory Argonne, Illinois 60439-4844 U.S.A. R. Padmanabhan y Department of

More information

Part I: Definitions and Properties

Part I: Definitions and Properties Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States

More information

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel LECTURE NOTES on ELEMENTARY NUMERICAL METHODS Eusebius Doedel TABLE OF CONTENTS Vector and Matrix Norms 1 Banach Lemma 20 The Numerical Solution of Linear Systems 25 Gauss Elimination 25 Operation Count

More information

Pontryagin s maximum principle

Pontryagin s maximum principle Pontryagin s maximum principle Emo Todorov Applied Mathematics and Computer Science & Engineering University of Washington Winter 2012 Emo Todorov (UW) AMATH/CSE 579, Winter 2012 Lecture 5 1 / 9 Pontryagin

More information

Taylor Model Range Bounding Schemes

Taylor Model Range Bounding Schemes Taylor Model Range Bounding Schemes I Kyoko Makino II Martin Berz Department of Physics and Astronomy Michigan State University Introduction LDB (Linear Dominated Bounder) QDB (Quadratic Dominated Bounder)

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

Automating the Verification of Floating-point Algorithms

Automating the Verification of Floating-point Algorithms Introduction Interval+Error Advanced Gappa Conclusion Automating the Verification of Floating-point Algorithms Guillaume Melquiond Inria Saclay Île-de-France LRI, Université Paris Sud, CNRS 2014-07-18

More information

The Assignment Axiom (Hoare)

The Assignment Axiom (Hoare) The Assignment Axiom (Hoare) Syntax: V := E Semantics: value of V in final state is value of E in initial state Example: X:=X+ (adds one to the value of the variable X) The Assignment Axiom {Q[E/V ]} V

More information

Disjunctive relational abstract interpretation for interprocedural program analysis

Disjunctive relational abstract interpretation for interprocedural program analysis Disjunctive relational abstract interpretation for interprocedural program analysis Nicolas Halbwachs, joint work with Rémy Boutonnet Verimag/CNRS, and Grenoble-Alpes University Grenoble, France R. Boutonnet,

More information

Inference in Bayesian Networks

Inference in Bayesian Networks Andrea Passerini passerini@disi.unitn.it Machine Learning Inference in graphical models Description Assume we have evidence e on the state of a subset of variables E in the model (i.e. Bayesian Network)

More information

Groupe de travail. Analysis of Mobile Systems by Abstract Interpretation

Groupe de travail. Analysis of Mobile Systems by Abstract Interpretation Groupe de travail Analysis of Mobile Systems by Abstract Interpretation Jérôme Feret École Normale Supérieure http://www.di.ens.fr/ feret 31/03/2005 Introduction I We propose a unifying framework to design

More information

Chapter 2: Differentiation

Chapter 2: Differentiation Chapter 2: Differentiation Spring 2018 Department of Mathematics Hong Kong Baptist University 1 / 82 2.1 Tangent Lines and Their Slopes This section deals with the problem of finding a straight line L

More information

Automatic Differentiation Algorithms and Data Structures. Chen Fang PhD Candidate Joined: January 2013 FuRSST Inaugural Annual Meeting May 8 th, 2014

Automatic Differentiation Algorithms and Data Structures. Chen Fang PhD Candidate Joined: January 2013 FuRSST Inaugural Annual Meeting May 8 th, 2014 Automatic Differentiation Algorithms and Data Structures Chen Fang PhD Candidate Joined: January 2013 FuRSST Inaugural Annual Meeting May 8 th, 2014 1 About 2 3 of the code for physics in simulators computes

More information

Models of Computation

Models of Computation Models of Computation Analysis of Algorithms Week 1, Lecture 2 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Models of Computation (RAM) a) Random Access Machines

More information

Using AD to derive adjoints for large, legacy CFD solvers

Using AD to derive adjoints for large, legacy CFD solvers Using AD to derive adjoints for large, legacy CFD solvers J.-D. Müller Queen Mary, University of London collaborators: D. Jones, F. Christakpoulos, S. Xu, QMUL S. Bayyuk, ESI, Huntsville AL c Jens-Dominik

More information

Process Scheduling for RTS. RTS Scheduling Approach. Cyclic Executive Approach

Process Scheduling for RTS. RTS Scheduling Approach. Cyclic Executive Approach Process Scheduling for RTS Dr. Hugh Melvin, Dept. of IT, NUI,G RTS Scheduling Approach RTS typically control multiple parameters concurrently Eg. Flight Control System Speed, altitude, inclination etc..

More information

x (2) k even h n=(n) + (n+% x(6) X(3), x (5) 4 x(4)- x(), x (2), Decomposition of an N-point DFT into 2 N/2-point DFT's.

x (2) k even h n=(n) + (n+% x(6) X(3), x (5) 4 x(4)- x(), x (2), Decomposition of an N-point DFT into 2 N/2-point DFT's. COMPUTATION OF DISCRETE FOURIER TRANSFORM - PART 2 1. Lecture 19-49 minutes k even n.o h n=(n) + (n+% x (2), x (2) x(4)- x(6) Decomposition of an N-point DFT into 2 N/2-point DFT's. X(3), x (5) 4 x(),

More information

Trajectory-based optimization

Trajectory-based optimization Trajectory-based optimization Emo Todorov Applied Mathematics and Computer Science & Engineering University of Washington Winter 2012 Emo Todorov (UW) AMATH/CSE 579, Winter 2012 Lecture 6 1 / 13 Using

More information

Solving Polynomial Systems in the Cloud with Polynomial Homotopy Continuation

Solving Polynomial Systems in the Cloud with Polynomial Homotopy Continuation Solving Polynomial Systems in the Cloud with Polynomial Homotopy Continuation Jan Verschelde joint with Nathan Bliss, Jeff Sommars, and Xiangcheng Yu University of Illinois at Chicago Department of Mathematics,

More information

Lecture 1: Basics Concepts

Lecture 1: Basics Concepts National Technical University of Athens School of Chemical Engineering Department II: Process Analysis and Plant Design Lecture 1: Basics Concepts Instructor: Α. Kokossis Laboratory teaching staff: Α.

More information

Machine Learning Brett Bernstein. Recitation 1: Gradients and Directional Derivatives

Machine Learning Brett Bernstein. Recitation 1: Gradients and Directional Derivatives Machine Learning Brett Bernstein Recitation 1: Gradients and Directional Derivatives Intro Question 1 We are given the data set (x 1, y 1 ),, (x n, y n ) where x i R d and y i R We want to fit a linear

More information

X-machines - a computational model framework.

X-machines - a computational model framework. Chapter 2. X-machines - a computational model framework. This chapter has three aims: To examine the main existing computational models and assess their computational power. To present the X-machines as

More information

ON COMPUTAMBLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHENIDUGSPROBLEM. Turing 1936

ON COMPUTAMBLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHENIDUGSPROBLEM. Turing 1936 ON COMPUTAMBLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHENIDUGSPROBLEM Turing 1936 Where are We? Ignoramus et ignorabimus Wir mussen wissen Wir werden wissen We do not know We shall not know We must know

More information

Is My CFD Mesh Adequate? A Quantitative Answer

Is My CFD Mesh Adequate? A Quantitative Answer Is My CFD Mesh Adequate? A Quantitative Answer Krzysztof J. Fidkowski Gas Dynamics Research Colloqium Aerospace Engineering Department University of Michigan January 26, 2011 K.J. Fidkowski (UM) GDRC 2011

More information

Defining a function: f[x,y ]:= x 2 +y 2. Take care with the elements in red since they are different from the standard mathematical notation.

Defining a function: f[x,y ]:= x 2 +y 2. Take care with the elements in red since they are different from the standard mathematical notation. Chapter 1 Functions Exercises 1,, 3, 4, 5, 6 Mathematica useful commands Defining a function: f[x,y ]:= x +y Take care with the elements in red since they are different from the standard mathematical notation

More information

ECE521 Lecture 7/8. Logistic Regression

ECE521 Lecture 7/8. Logistic Regression ECE521 Lecture 7/8 Logistic Regression Outline Logistic regression (Continue) A single neuron Learning neural networks Multi-class classification 2 Logistic regression The output of a logistic regression

More information

A Trillion Particles: Studying Large-Scale Structure Formation on the BG/Q

A Trillion Particles: Studying Large-Scale Structure Formation on the BG/Q A Trillion Particles: Studying Large-Scale Structure Formation on the BG/Q David Daniel, Patricia Fasel, Hal Finkel, Nicholas Frontiere, Salman Habib, Katrin Heitmann, Zarija Lukic, Adrian Pope July 10,

More information

Injectivity of Composite Functions

Injectivity of Composite Functions Injectivity of Composite Functions Kim S. Larsen Michael I. Schwartzbach Computer Science Department, Aarhus University Ny Munkegade, 8000 Aarhus C, Denmark Present address: Department of Mathematics and

More information