+ All Categories
Home > Documents > Speeding up HMC with better integrators

Speeding up HMC with better integrators

Date post: 05-Feb-2016
Category:
Upload: braima
View: 44 times
Download: 0 times
Share this document with a friend
Description:
Speeding up HMC with better integrators. A D Kennedy and M A Clark School of Physics & SUPA, The University of Edinburgh Boston University. Outline. Symmetric symplectic integrators in HMC Shadow Hamiltonians and Poisson brackets Tuning integrators using Poisson brackets - PowerPoint PPT Presentation
Popular Tags:
28
Saturday, June 18, 20 22 Speeding up HMC with better integrators A D Kennedy and M A Clark A D Kennedy and M A Clark School of Physics & SUPA, The University of Edinburgh School of Physics & SUPA, The University of Edinburgh Boston University Boston University
Transcript
Page 1: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

Speeding up HMC with

better integrators

Speeding up HMC with

better integrators

A D Kennedy and M A ClarkA D Kennedy and M A ClarkSchool of Physics & SUPA, The University of EdinburghSchool of Physics & SUPA, The University of Edinburgh

Boston UniversityBoston University

A D Kennedy and M A ClarkA D Kennedy and M A ClarkSchool of Physics & SUPA, The University of EdinburghSchool of Physics & SUPA, The University of Edinburgh

Boston UniversityBoston University

Page 2: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 33

OutlineOutlineSymmetric symplectic integrators in HMCShadow Hamiltonians and Poisson bracketsTuning integrators using Poisson bracketsHessian or Force-Gradient integratorsSymplectic integrators and Poisson brackets on Lie groupsResults for single-link updates

Symmetric symplectic integrators in HMCShadow Hamiltonians and Poisson bracketsTuning integrators using Poisson bracketsHessian or Force-Gradient integratorsSymplectic integrators and Poisson brackets on Lie groupsResults for single-link updates

Page 3: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 44

Symplectic IntegratorsSymplectic Integrators

212,H q p T p S q p S q

We are interested in finding the classical trajectory in phase space of a system described by the Hamiltonian

exp expd dp dqdt dt p dt q

The idea of a symplectic integrator is to write the time evolution operator (Lie derivative) as

ˆexp HH He

q p p q

exp S q T pp q

Page 4: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 55

Symplectic IntegratorsSymplectic Integrators

Define and so

that H T S

S S qp

T T pq

Since the kinetic energy T is a function only of p and the potential energy S is a function only of q, it follows that the action of and may be evaluated trivially

Se

Te

: , ,

: , ,

T

S

e f q p f q T p p

e f q p f q p S q

Page 5: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 66

If A and B belong to any (non-commutative)

algebra then , where constructed from commutators of A and B (i.e.,

is in the Free Lie Algebra generated by A and

B )

A B A Be e e

Symplectic IntegratorsSymplectic Integrators

1 2

1 2

1 2

221

1 2, , 10

1, , , ,

1 2 ! m

m

m

nm

n n k kk km

k k n

Bc c A B c c A B

n m

More precisely, where and

1

ln A Bn

n

e e c

1c A B

Baker-Campbell-Hausdorff (BCH) formula

Page 6: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 77

Symplectic IntegratorsSymplectic Integrators

Explicitly, the first few terms are

1 1 12 12 24

1720

ln , , , , , , , ,

, , , , 4 , , , ,

6 , , , , 4 , , , ,

2 , , , ,

A Be e A B A B A A B B A B B A A B

A A A A B B A A A B

A B A A B B B A A B

A B B A

, , , ,B B B B A B

In order to construct reversible integrators we use symmetric symplectic integrators

2 2 124

15760

ln , , 2 , ,

7 , , , , 28 , , , ,

12 , , , , 32 , , , ,

16 , , , , 8 , , , ,

A B Ae e e A B A A B B A B

A A A A B B A A A B

A B A A B B B A A B

A B B A B B B B A

B

The following identity follows directly from the BCH formula

Page 7: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 88

Symplectic IntegratorsSymplectic Integrators

From the BCH formula we find that the PQP symmetric symplectic integrator is given by

1 12 2

//

0( ) S STU e e e

3 5124

exp , , 2 , ,T S S S T T S T O

ˆ 2S THe e O

In addition to conserving energy to O (² ) such symmetric symplectic integrators are manifestly area preserving and reversible

2 4124exp , , 2 , ,T S S S T T S T O

Page 8: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 99

Shadow HamiltoniansShadow Hamiltonians

This may be obtained by replacing the

commutators in the BCH expansion

of

with the Poisson bracket

,S T

ln S Te e

,S T

For each symplectic integrator there

exists a Hamiltonian H’ which is exactly

conserved

Page 9: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1010

Conserved HamiltonianConserved Hamiltonian

For the PQP integrator we have

124

15760

' , , 2 , ,

7 , , , , 28 , , , ,

12 , , , 32 , , , ,

16 , , , 8 , , , ,

H T S S S T T S T

S S S S T T S S S T

S T S S T T T S S T

S T T S T T T T S T

Page 10: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1111

Tuning HMCTuning HMCFor any (symmetric) symplectic integrator the conserved Hamiltonian is constructed from the same Poisson bracketsA procedure for tuning such integrators is

Measure the Poisson brackets during an HMC runOptimize the integrator (number of pseudofermions, step-sizes, order of integration scheme, etc.) offline using these measured valuesThis can be done because the acceptance rate (and instabilities) are completely determined by δH = H’ - H

For any (symmetric) symplectic integrator the conserved Hamiltonian is constructed from the same Poisson bracketsA procedure for tuning such integrators is

Measure the Poisson brackets during an HMC runOptimize the integrator (number of pseudofermions, step-sizes, order of integration scheme, etc.) offline using these measured valuesThis can be done because the acceptance rate (and instabilities) are completely determined by δH = H’ - H

Page 11: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1212

Simple Example (Omelyan)Simple Example (Omelyan)

1 12 21 2Q QPP Pe e e e e Consider the PQPQP integrator

The conserved Hamiltonian is thus

2

3 56 6 1 1 6' , , , ,

12 24H H S S T T S T O

Measure the “operators” and minimize the cost by adjusting the parameter α

2

3 5, , , ,6 6 1 1 6

12 24SH OS T T S T

, ,12 ,

14 ,

T S T

S S T

Page 12: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1313

Hessian IntegratorsHessian Integrators

We may therefore evaluate the integrator explicitly

We may therefore evaluate the integrator explicitly

3, ,S S Te

An interesting observation is that the Poisson bracket depends only of q

An interesting observation is that the Poisson bracket depends only of q

, ,S S T

The force for this integrator involves second derivatives of the actionUsing this type of step we can construct very efficient Force-Gradient integrators

The force for this integrator involves second derivatives of the actionUsing this type of step we can construct very efficient Force-Gradient integrators

Page 13: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1414

Higher-Order IntegratorsHigher-Order Integrators

We can eliminate all the leading order Poisson brackets in the shadow Hamiltonian leaving errors of O (δτ2)The coefficients of the higher-order Poisson brackets are much smaller than those from the Campostrini integrator

We can eliminate all the leading order Poisson brackets in the shadow Hamiltonian leaving errors of O (δτ2)The coefficients of the higher-order Poisson brackets are much smaller than those from the Campostrini integrator

Page 14: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1515

Beyond Scalar Field TheoryBeyond Scalar Field Theory

We need to extend the formalism beyond a scalar field theoryFermions are easy

† 1 1 †TrFS U U U M M1

1 1

U U

M M

M M

How do we extend all this fancy differential geometry formalism to gauge fields?

Page 15: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1616

Hamiltonian MechanicsHamiltonian Mechanics

,A B A B

A Bp q q p

: 0d dq dp

Flat Manifold General

Symplectic 2-form

Hamiltonian vector field

Equations of motion

Poisson bracket

ˆ H HH

p q q p

H

dH i

,H H

q pp q

ˆdH

dt

ˆ ˆ, ( , )A B A B

Darboux theorem:

All manifolds are locally flat

Page 16: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1717

Maurer-Cartan EquationsMaurer-Cartan Equations

12

i i j kjk

jk

d c

The left invariant forms dual to the

generators of a Lie algebra satisfy the

Maurer-Cartan equations

i

Page 17: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1818

We can invent any Classical Mechanics we want…So we may therefore define a closed symplectic 2-form which globally defines an invariant Poisson bracket by

i i

i

d p

Fundamental 2-formFundamental 2-form

12

i i i i j kjk

i

dp p c

i i i i

i

dp p d

Page 18: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 1919

We may now follow the usual procedure to find the equations of motion:

Introduce a Hamiltonian function (0-form) H on the cotangent bundle (phase space) over the group manifold

Hamiltonian Vector FieldHamiltonian Vector Field

Define a vector field such thatH

dH i H

k ki ji ii j i

i jk

H HH e c p e H

p p p

Page 19: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2020

Integral CurvesIntegral CurvesThe classical trajectories are then the integral curves of h:

,t t tQ P t th

Page 20: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2121

Poisson BracketsPoisson Brackets

ˆ k ki ji ii j i

i jk

H HH e c p e H

p p p

Recall our Hamiltonian vector field

For H(q,p) = T(p) + S(q) we have vector fields

ˆ k ki jii j i

i jk

T TT e c p

p p p

ˆi i

i

S e Sp

2

if 2

i k k ji ji i

i jk

pp e c p p T p

p

Page 21: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2222

More Poisson BracketsMore Poisson Brackets

12

ˆ ˆˆ ˆ, , ,i i i i j kjkS T S T dp p c S T

We thus compute the lowest-order Poisson bracket

Retrii

Sp e S PU

U

and the Hamiltonian vector corresponding to it

, ,, ,k k

i ji ii j ii jk

S T S TS T e c p e S T

p p p

k k ji i ji j i j ie S e c p e S p e e S

p

Page 22: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2323

Even More Poisson BracketsEven More Poisson Brackets

, , ( ) ( )

, , ( )

, , , , 2 ( ) ( ) ( ) ( )

, , , , 3 ( ) ( ) ( )

( ) ( ) ( ) ( ) ( )

, , , , 0

, , , , 2

i i

i ji j

i ji j k k i k j k

i ijk j k k

i jk k i j k i i k k j

S S T e S e S

T S T p p e e S

T T S S T p p e e e S e S e e S e e S

S T T S T c p p e S e e S e e S

p p e S e e e S e e S e e S e e S

T T S S T

S T S S T e

( ) ( ) ( )

, , , , ( )

, , , , 0

i j i j

i j ki j k

S e S e e S

T T T S T p p p p e e e e S

S S S S T

Page 23: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2424

IntegratorsIntegrators

2/ 2 / 2

22 2

2 26 3 62 2

3 3 3

36 2 2

Integrator Update Steps Shadow Hamiltonian

, , 2 , ,24

2 , , , ,24

Omelyan , ,72

Omelyan

S T S

T TS

S S ST T

S ST T

PQP e e e T S S S T T S T

QPQ e e e T S S S T T S T

SST e e e e e T S S S T

TST e e e e e

3

26 3 2T, S,T

24

S

T S

Page 24: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2525

Campostrini IntegratorCampostrini Integrator

3 33 3

3 33 3 3 3

3 3 3 3

3 3 3

3

4 2 2 44 2 2 4612

4 2 2 14 2 2 2 4 2 2 2312 12

4 2 2 4 4 2 2 46 12

40 4+40 2+48 , , , , + 20 2+32 , , , ,

60 4+

Integrator Campostrini

Update Steps

Shadow Hamiltonian

ST

ST T

S T

T S

S S S S T T T S S T

e e

e e e

e e

3 3

3 3 3

80 2+104 , , , , 20 4+8 , , , ,

+ 180 4+240 2+312 , , , , 5 2+8 , , , ,4

34560

S T T S T T S S S T

S T S S T T T T S T

Page 25: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2626

3

36 8 3

48 , ,

192

33 8 6

2259 , , , , 4224 , , , ,

768 , , , , 5616 , , , ,

3024 , , , , 896 , , , ,

Integrator Update Steps Shadow Hamiltonian

Force-Gradient 1

T S T

S S S T

T S T

T S

S S S S T T T S S T

S T T S T T S S S T

S T S S T T T T S T

e e e

e

e e e

3

6 2

48 , ,

72

62

46635520

41 , , , , +126 , , , ,

+72 , , , , +84 , , , ,

+36 , , , , +54 , , , ,4

155520

Force-Gradient 2

S T

S S S T

ST

T S

S S S S T T T S S T

S T T S T T S S S T

S T S S T T T T S T

e e

e

e e

Hessian IntegratorsHessian Integrators

Page 26: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2727

One-Link ResultsOne-Link Results

-6

-5

-4

-3

-2

-1

0

1

2

3

4

5

0 1 2 3 4 5 6 7 8 9 10

t

x 1

07

dH

dH Shadow

Page 27: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2828

Scaling BehaviourScaling Behaviour

-11

-10

-9

-8

-7

-6

-5

-4

-3

-2

-1

-1.3 -1.2 -1.1 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3

-log10 Step Size

log

10 E

rror

PQPOmelyan {S,{S,T}}CampostriniForce-Gradient

Page 28: Speeding up HMC with better integrators

Saturday, April 22, 2023Saturday, April 22, 2023

A D KennedyA D Kennedy 2929

ConclusionsConclusionsWe hope that very significant performance improvements can be obtained using Force-Gradient integratorsFor fermions one extra inversion of the Dirac operator is requiredPure gauge force terms and Poisson brackets get quite complicated to programReal-life speed-up factors will be measured really soon…

We hope that very significant performance improvements can be obtained using Force-Gradient integratorsFor fermions one extra inversion of the Dirac operator is requiredPure gauge force terms and Poisson brackets get quite complicated to programReal-life speed-up factors will be measured really soon…


Recommended