Power Grid Simulation using Matrix Exponential Method with ...

26
Power Grid Simulation using Matrix Exponential Method with Rational Krylov Subspaces Hao Zhuang, Shih-Hung Weng, and Chung-Kuan Cheng Department of Computer Science and Engineering University of California, San Diego, CA, USA Contact: {zhuangh, ckcheng}@ucsd.edu

Transcript of Power Grid Simulation using Matrix Exponential Method with ...

Page 1: Power Grid Simulation using Matrix Exponential Method with ...

Power Grid Simulation using Matrix Exponential

Method with Rational Krylov Subspaces

Hao Zhuang, Shih-Hung Weng, and Chung-Kuan Cheng Department of Computer Science and Engineering

University of California, San Diego, CA, USA Contact: {zhuangh, ckcheng}@ucsd.edu

Page 2: Power Grid Simulation using Matrix Exponential Method with ...

Outline • Background of Power Grid Transient Circuit Simulation

– Formulations – Problems

• Matrix Exponential Circuit Simulation (Mexp) – Stiffness Problem

• Rational Matrix Exponential (Rational Mexp) – Rational Krylov Subspace – Skip of Regularization – Flexible Time Stepping

• Experiments – Adaptive Time Stepping Experiment – Standard Mexp vs. Rational Mexp (RC Mesh) – Rational Mexp vs. Trapezoidal Method (PDN Cases)

• Conclusions

2

Page 3: Power Grid Simulation using Matrix Exponential Method with ...

Power Grid Circuit Power Grid modeled in RLC circuit

• Transient Power Grid formulation where • is the capacitance/inductance matrix • is the conductance matrix • is the voltage/current vector, and is input

sources

3

𝐂𝐱 𝑡 = −𝐆𝐱(𝑡) + 𝐁𝐮(𝑡)

𝐂

𝐆

𝐱 𝐁𝐮(𝑡)

Page 4: Power Grid Simulation using Matrix Exponential Method with ...

Power Grid Transient Circuit Simulation Transient simulation: Numerical integration

• Low order approximation

– Traditional methods: e.g. Backward Euler, Trapezoidal

– Local truncation error limits the time step

– Power grid simulation contest [TAU’12]

• Trapezoidal method with fixed time-step: only one LU factorization

• Stiffness: smallest time step

• High order approximation

– Matrix exponential based circuit simulation 4

𝐂

ℎ+𝐆

2𝐱 𝑡 + ℎ =

𝐂

ℎ−𝐆

2𝒙 𝑡 +

𝐁𝐮 𝑡 + ℎ − 𝐁𝐮(𝑡)

2

Page 5: Power Grid Simulation using Matrix Exponential Method with ...

Outline • Background of Power Grid Transient Circuit Simulation

– Formulations – Problems

• Matrix Exponential Circuit Simulation (Mexp) – Stiffness Problem

• Rational Matrix Exponential (Rational Mexp) – Rational Krylov Subspace – Skip of Regularization – Flexible Time Stepping

• Experiments – Adaptive Time Stepping Experiment – Standard Mexp vs. Rational Mexp (RC Mesh) – Rational Mexp vs. Trapezoidal Method (PDN Cases)

• Conclusions

5

Page 6: Power Grid Simulation using Matrix Exponential Method with ...

Matrix Exponential Method

• Linear differential equation

• Analytical solution

• Case: input is piecewise linear (PWL)

6

𝐂𝐱 𝑡 = −𝐆𝐱(𝑡) + 𝐁𝐮(𝑡) 𝐱 𝑡 = −𝐀𝐱(𝑡) + 𝐛(𝑡)

𝐀 = −𝐂−𝟏𝐆, 𝐛 = −𝐂−𝟏𝐁𝐮(𝐭)

𝐱 𝑡 + ℎ = 𝑒𝐀ℎ𝐱(𝑡) + 𝑒𝐀(ℎ−𝜏)𝐛(𝑡 + 𝜏) 𝑑𝜏ℎ

0

𝐱 𝑡 + ℎ = 𝑒𝐀ℎ𝐱 𝑡 + (𝑒𝐀ℎ−𝐈)𝐀−𝟏𝐛(𝑡) + (𝑒𝐀ℎ−(𝐀ℎ + 𝐈))𝐀−𝟐𝐛(𝑡 + ℎ) − 𝐛(𝑡)

Page 7: Power Grid Simulation using Matrix Exponential Method with ...

Matrix Exponential Computation

• Transform into

• The computation of matrix exponential is expensive (for simplicity, we use 𝐀 to represent 𝐀 , from now on)

Memory and time complexities of O(n3)

7

𝐱 𝑡 + ℎ = 𝐈𝑛 𝟎 𝑒𝐀 ℎ 𝐱(𝑡)

𝐞2

𝐀 =𝐀 𝐖𝟎 𝐉

, 𝐉 =0 10 0

, 𝐞2 =𝟎1,𝐖 =

𝐛 𝑡 + ℎ − 𝐛(𝑡)

ℎ𝐛(𝑡)

𝒆𝐀 = 𝐈 + 𝐀 +𝐀2

2+𝐀3

3!+ ⋯+

𝐀𝑘

𝑘!+ ⋯

Page 8: Power Grid Simulation using Matrix Exponential Method with ...

Krylov Subspace Approximation

• We derive matrix-vector product:

• Krylov subspace

– Standard Basis Generation

– Orthogonalization (Arnoldi Process):

– Matrix reduction: Hm,m has m=10~30 while size of A can be millions

• Matrix exponential operator

– time stepping, h, via scaling

– Posteriori error estimate [Saad92]

8

𝒆𝐀𝐯

𝑲𝒎 𝐀, 𝐯 = 𝐯,𝐀𝐯, 𝐀𝟐𝐯,… , 𝐀𝒎−𝟏𝐯

𝐀𝐯 = −𝐂−𝟏(𝐆𝐯)

𝐕𝒎 = 𝐯𝟏, 𝐯𝟐, ⋯ , 𝐯𝒎

𝐀𝐕𝒎 = 𝐕𝒎𝐇𝒎,𝒎 + 𝒉𝒎+𝟏,𝒎𝐯𝒎+𝟏𝒆𝒎T 𝐇𝒎,𝒎 = 𝐕𝒎

T𝐀𝐕𝒎

𝒆𝐀ℎ𝐯 ≈ 𝐯 𝟐𝐕𝒎 𝒆𝐇𝒎,𝒎ℎ𝒆𝟏

1

Τ

21, eeehmmErr h

mkrylovmH

Hv

Page 9: Power Grid Simulation using Matrix Exponential Method with ...

Problems of Standard Krylov Subspace Approximations

Problem of Stiffness:

• When the system is stiff, we need high order approximation so that the solution can converge,

• Standard Krylov subspace tends to capture the eigenvalues of large magnitude

• For transient analysis, the eigenvalues of small real magnitude are wanted to describe the dynamic behavior.

9

𝐀 = −𝐂−𝟏𝐆

𝐱 𝑡 = 𝐀𝐱(𝑡) + 𝐛(𝑡)

𝒆𝐀 = 𝐈 + 𝐀 +𝐀2

2+

𝐀3

3!+⋯+

𝐀𝑘

𝑘!.

Page 10: Power Grid Simulation using Matrix Exponential Method with ...

Outline • Background of Power Grid Transient Circuit Simulation

– Formulations – Problems

• Matrix Exponential Circuit Simulation (Mexp) – Stiffness Problem

• Rational Matrix Exponential (Rational Mexp) – Rational Krylov Subspace – Skip of Regularization – Flexible Time Stepping

• Experiments – Adaptive Time Stepping Experiment – Standard Mexp vs. Rational Mexp (RC Mesh) – Rational Mexp vs. Trapezoidal Method (PDN Cases)

• Conclusions

10

Page 11: Power Grid Simulation using Matrix Exponential Method with ...

Rational Krylov Subspace • Spectral Transformation:

– Shift-and-invert matrix A

– Rational Krylov subspace captures slow-decay components

– Use rational Krylov subspace for matrix exponential

11

100

Important eigenvalue: Component that decays slowly. Not so important eigenvalue: Component that decays fast.

𝑲𝒎 𝐀, 𝐯 𝑲𝒎 (𝐈 − 𝛾𝐀)−𝟏, 𝐯

(𝐈 − 𝛾𝐀)−𝟏

Page 12: Power Grid Simulation using Matrix Exponential Method with ...

Rational Krylov Subspace

Rational Krylov subspace

• Arnoldi process to obtain Vm=[v1 v2 … vm]

• Matrix exponential

– Time stepping by scaling

– No need of new Krylov subspace computation.

• Posterior error to terminate the process

– Larger time step => smaller error

12

𝑲𝒎 (𝐈 − 𝛾𝐀)−𝟏, 𝐯 = 𝐯, (𝐈 − 𝛾𝐀)−𝟏𝐯, (𝐈 − 𝛾𝐀)−𝟐 𝐯,… , (𝐈 − 𝛾𝐀)−𝒎+𝟏𝐯

𝐕𝒎T𝐀𝐕𝒎 ≈

𝐈 − 𝐇𝒎,𝒎−𝟏

𝜸

𝒆𝐀𝒉𝐯 ≈ 𝐯 𝟐𝐕𝒎 𝒆𝒉/𝜸(𝐈−𝐇𝒎,𝒎−𝟏)𝒆𝟏

𝒆𝒓𝒓 𝒎,𝜶 =𝐯 𝟐

𝜸ℎ𝒎+𝟏,𝒎 (𝐈 − 𝛾𝐀)𝐯𝒎+𝟏𝒆𝒎

T𝐇𝒎,𝒎−𝟏𝒆ℎ/𝛾 (𝐈−𝐇𝒎,𝒎

−𝟏)𝒆𝟏

Page 13: Power Grid Simulation using Matrix Exponential Method with ...

Skip of Regularization

1. No need of regularization for A= 𝑪 −𝟏𝑮 using matrix pencil (𝑮 , 𝑪 )

2. LU decomposition at a fixed 𝛾

• Require LU every time step?

13

𝐯𝒌+𝟏 = (𝐈 − 𝛾𝐀)−𝟏𝐯𝒌 = (𝐂 − 𝛾𝐆 )−𝟏𝐂 𝐯𝒌

𝑳𝑼_𝑫𝒆𝒄𝒐𝒎𝒑 𝐂 − 𝛾𝐆 = 𝐋 𝐔

𝐂 =𝐂 𝟎𝟎 𝐈

, 𝐆 =−𝐆 𝐖

𝟎 𝐉,𝐖 =

𝐁𝐮 𝑡 + ℎ − 𝐁𝐮(𝑡)

ℎ𝐁𝐮(𝑡)

Page 14: Power Grid Simulation using Matrix Exponential Method with ...

Block LU and Updating Sub-matrix

• The majority of matrix is the same,

• Block LU can be utilized here and the former LU matrices are updated as

• We avoid LU in each time step by reusing and Block LU and updating a small part of U

14

𝑳𝑼_𝑫𝒆𝒄𝒐𝒎𝒑 𝐂 + 𝛾𝐆 = 𝐋𝒔𝒖𝒃 𝐔𝒔𝒖𝒃

𝐋 =𝐋𝒔𝒖𝒃 𝟎𝟎 𝐈

, 𝐔 =𝐔𝒔𝒖𝒃 −𝛾𝐋𝒔𝒖𝒃

−𝟏𝐖

𝟎 𝐈𝐉, 𝐈𝐉 = 𝐈 − 𝛾𝐉

𝑳𝑼_𝑫𝒆𝒄𝒐𝒎𝒑 𝐂 − 𝛾𝐆 = 𝐋 𝐔

Page 15: Power Grid Simulation using Matrix Exponential Method with ...

Rational MEXP with Adaptive Step Control

15

𝐯 𝟐𝐕𝒎 𝒆𝜶(𝐈−𝐇𝒎,𝒎−𝟏)𝒆𝟏

Page 16: Power Grid Simulation using Matrix Exponential Method with ...

• large step size with less dimension

Rational Matrix Exponential

16

fix , sweep m and h 1

~

2eeeError

h

hmH

m

AVvv

Page 17: Power Grid Simulation using Matrix Exponential Method with ...

• large step size with less dimension

Rational Matrix Exponential

17

1

~

2eeeError

h

hmH

m

AVvv fix h, sweep m and

Page 18: Power Grid Simulation using Matrix Exponential Method with ...

Outline • Background of Power Grid Transient Circuit

Simulation – Formulations – Problems

• Matrix Exponential Circuit Simulation (Mexp) – Matrix Exponential Computation

• Previous Standard Krylov Subspace and Stiffness Problems • Rational Krylov Subspace (Rational Mexp)

– Adaptive Time Stepping in Rational Mexp

• Experiment – Mexp vs. Rational Mexp (RC Mesh) – Rational Mexp vs. Trapezoidal Method (PDN Cases)

• Conclusions 18

Page 19: Power Grid Simulation using Matrix Exponential Method with ...

Experiment

• Linux workstation

– Intel Core i7-920 2.67GHz CPU

– 12GB memory.

• Test Cases

– Stiff RC mesh network (2500 Nodes)

• Mexp vs. Rational Mexp

– Power Distribution Network (45.7K~7.4M Nodes)

• Rational Mexp vs. Trapezoidal (TR) with fixed time step (avoid LU during the simulation)

19

Page 20: Power Grid Simulation using Matrix Exponential Method with ...

Experiment (I) • RC mesh network with 2500 nodes. (Time span [0, 1ns] with a fixed step

size 10ps)

stiffness definition:

• Comparisons between average (mavg) and peak dimensions (mpeak) of Krylov subspace using

– Standard Basis:

• mavg = 115 and mpeak=264

– Rational Basis:

• mavg = 3.11, and mpeak=10

• Rational Basis-MEXP achieves 224X speedup for the whole simulation (vs. Standard Basis-MEXP).

20

𝑹𝒆(𝝀𝒎𝒊𝒏)

𝑹𝒆(𝝀𝒎𝒂𝒙)= 𝟐. 𝟏𝟐 × 𝟏𝟎𝟖

Page 21: Power Grid Simulation using Matrix Exponential Method with ...

Experiment (II) • PDN Cases

– On-chip and off-chip components

– Low-, middle-, and high-frequency responses

– The time span of whole simulation [0, 1ps]

21

Page 22: Power Grid Simulation using Matrix Exponential Method with ...

Experiment (II)

22

• Mixture of low, mid, and high frequency components.

• 16X speedups over TR.

• Difference of MEXP and HSPICE: 7.33×10-4; TR and HSPICE: 7.47×10-4

Page 23: Power Grid Simulation using Matrix Exponential Method with ...

Experiment: CPU time

23

Page 24: Power Grid Simulation using Matrix Exponential Method with ...

Conclusions

• Rational Krylov Subspace solves the stiffness problem.

– No need of regularization

– Small dimensions of basis.

– Flexible time steps.

• Adaptive time stepping is efficient to explore the different frequency responses of power grid transient simulation (considering both on-chip and off-chip components)

– 15X speedup over trapezoidal method.

24

Page 25: Power Grid Simulation using Matrix Exponential Method with ...

Conclusions: Future Works

• Setting of constant 𝛾

– Theory and practice

• Distributed computation

– Parallel processing

– Limitation of memory

• Nonlinear dynamic system

25

Page 26: Power Grid Simulation using Matrix Exponential Method with ...

Thanks and Q&A

26