Parallelizing a Black-Scholes Solver based on Finite Elements and - - PowerPoint PPT Presentation

parallelizing a black scholes solver based on finite
SMART_READER_LITE
LIVE PREVIEW

Parallelizing a Black-Scholes Solver based on Finite Elements and - - PowerPoint PPT Presentation

Scientific Computing in Computer Science, Technische Universit at M unchen Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010 Hans-Joachim Bungartz, Alexander Heinecke, Dirk Pfl uger , and


slide-1
SLIDE 1

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Parallelizing a Black-Scholes Solver based

  • n Finite Elements and Sparse Grids

PDCoF @ IPDPS 2010 Hans-Joachim Bungartz, Alexander Heinecke, Dirk Pfl¨ uger, and Stefanie Schraufstetter

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

April 19–23, 2010

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 1

slide-2
SLIDE 2

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Overview

1

Option Pricing

2

Sparse Grids

3

Parallelization

4

Parallel results

5

Conclusions

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 2

slide-3
SLIDE 3

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Financial Option Pricing

Options (contracts) reserve the right (no obligation) to buy (call option) or sell (put option) a certain good (asset, underlying) S at some point of time t for an agreed price K Useful, e.g., to limit potential loss (hedge against risks)

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 3

slide-4
SLIDE 4

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Financial Option Pricing

Options (contracts) reserve the right (no obligation) to buy (call option) or sell (put option) a certain good (asset, underlying) S at some point of time t for an agreed price K Useful, e.g., to limit potential loss (hedge against risks) Many different types. Consider, e.g., expiration time t: European options: t = T American options: t ∈ [0, T] Bermudan options: t ∈ {t0, t1, . . . , tn} (Payoff function at expiration time serves as end condition for pricing)

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 3

slide-5
SLIDE 5

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Financial Option Pricing (2)

Problem How to price an option (determine its current fair value V( S, t0))? Frequently used mathematical model: Black-Scholes equation Model underlying stock’s price S(t) as stochastic Wiener process dS(t) = µS(t)dt + σS(t)dW(t) Obtain general Black-Scholes equation ∂V ∂t + 1 2

d

  • i,j=1

σiσjρijSiSj ∂2V ∂Si∂Sj +

d

  • i=1

µiSi ∂V ∂Si − rV = 0 with volatilities σi, drifts µi, risk-free interest rate r, d stocks Si

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 4

slide-6
SLIDE 6

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Determining the Option Price

In general, no closed form solution Price stochastically (MC techniques) Easy to use, implement, parallelize Scaling independent of dimensionality Low(er) convergence rates Greeks (derivatibes) costly to compute

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 5

slide-7
SLIDE 7

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Determining the Option Price

In general, no closed form solution Price stochastically (MC techniques) Easy to use, implement, parallelize Scaling independent of dimensionality Low(er) convergence rates Greeks (derivatibes) costly to compute Price numerically (discretize PDE via finite differences/ elements/volumes) Hard to derive and solve PDE formulation for complex

  • ptions

Suffer curse of dimensionality Fast convergence rates Greeks faster to derive

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 5

slide-8
SLIDE 8

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Numerical Solution with Finite Elements

Employ spatial FE discretization Restrict solution to finite dimensional subspace VN, V( S, t) :=

N

  • i=1

αi(t)ϕi( S) ∈ VN Obtain time-dependent system of linear equations B ∂ ∂τ α(τ) = −1 2

d

  • i,j=1

σiσjρijC α+

d

  • i=1

 µi − 1 2

d

  • j=1

σiσjρij(1 + δij)   D α+rB α with, e.g., Bp,q := ϕp, ϕqL2 Discretize time (Euler/Crank-Nicolson/. . . ) Solve PDE backward in time τ := T = t, t = t0, t1, . . . , T

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 6

slide-9
SLIDE 9

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Sparse Grids (1)

Problem: curse of dimensionality Straightforward spatial discretization with h = n−1 fails: O(nd) grid points Therefore: sparse grids Reduce O(nd) to O(n log(n)d−1) Similar accuracy

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 7

slide-10
SLIDE 10

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Sparse Grids (1)

Problem: curse of dimensionality Straightforward spatial discretization with h = n−1 fails: O(nd) grid points Therefore: sparse grids Reduce O(nd) to O(n log(n)d−1) Similar accuracy Basic idea: 1) Hierarchical basis in 1d (here: piecewise linear)

.

x1,1

. .

x2,1 x2,3 x3,1 x3,3 x3,5 x3,7 ϕ1,1 ϕ2,1 ϕ2,3 ϕ3,1 ϕ3,3 ϕ3,5 ϕ3,7 l =1 l =3 l =2 W1 W3 V3 W2

.

x1,1

. .

x2,1 x2,3 x3,1 x3,3 x3,5 x3,7 x2,2 x3,2 x3,6 x3,4 V1 V2 V3 Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 7

slide-11
SLIDE 11

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Sparse Grids (2)

2) Extension to d-dimensional basis functions via tensor product approach

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 8

slide-12
SLIDE 12

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Sparse Grids (3)

Sparse grid space V (1)

n

(take only most important sub spaces): V (1)

n

:=

  • |
  • l|1≤n+d−1

W

  • l

l1=1 l1=2 l1=3 l1 l2=1 l2=2 l2=3 l2

V (1)

3

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 9

slide-13
SLIDE 13

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Parallelization

Parallelization on shared memory systems (multi-/many-core) Difficult to parallelize (no data/domain splitting) Application of matrices requires multi-recursive algorithms

Up(d) Down(d) + UpDown(1): Up(d) UpDown(d-1) Down(d) UpDown(d-1) + UpDown(d):

Parallelization of critical parts using OpenMP 3.0’s task concept New task for each recursive descend

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 10

slide-14
SLIDE 14

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Parallel Results

Hardware Mobile Intel Penryn Core2Duo (2×2.26 GHz) Two-socket Intel Nehalem (8×2.93 GHz, Quick Path Interconnect) Two-socket AMD Shanghai (8×2.4 GHz, Hypertransport) Two-socket AMD Istanbul (24×2.6 GHz, Hypertransport) Multi-socket systems all NUMA Measure parallel efficiency on n cores En := t1 tn · n

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 11

slide-15
SLIDE 15

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Parallel Results (2)

Example: Intel Xeon X5570 (Nehalem)

  • ption type

1 thread 2 threads 4 threads 8 threads d r t1 (s) t2 (s) E2 t4 (s) E4 t8 (s) E8 2 0.00 580 300 0.97 220 0.66 220 0.33 0.05 610 310 0.98 230 0.66 230 0.33 3 0.00 3,060 1,540 0.99 950 0.81 810 0.47 0.05 3,060 1,540 0.99 970 0.79 810 0.47 4 0.00 26,860 12,100 1.11 6,960 0.97 4,760 0.71 0.05 26,900 12,150 1.11 7,000 0.96 4,790 0.70 5 0.00 176,700 23,600 0.94

Task size has to be big enough Super-linear speed-up possible (cache sharing)

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 12

slide-16
SLIDE 16

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Parallel Results (3)

  • Parallelization strongly memory bounded

Memory access equally distributed Intel’s 32 KB 8-way level-one cache better suited than AMD’s 64 KB 2-way level-one cache Similarly QPI better suited than Hypertransport

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 13

slide-17
SLIDE 17

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Conclusions and Future Work

Sparse Grids enable FE discretizations in dimensions d > 3 Parallelization of multi-recursive algorithms with OMP tasks Strongly memory bounded Parallel efficiency depends on chache-associativity and bandwith of memory access First experiments: Adaptively refined sparse grids OMP’s built-in task load balancing works very well

0.5 1 1.5 2 0 0.5 1 1.5 2 0.2 0.4 0.6 0.8 1 S1 S2 0.5 1 1.5 2 0 0.5 1 1.5 2 0.2 0.4 0.6 0.8 1 S1 S2

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 14

slide-18
SLIDE 18

Scientific Computing in Computer Science, Technische Universit¨ at M¨ unchen

Conclusions and Future Work

Sparse Grids enable FE discretizations in dimensions d > 3 Parallelization of multi-recursive algorithms with OMP tasks Strongly memory bounded Parallel efficiency depends on chache-associativity and bandwith of memory access First experiments: Adaptively refined sparse grids OMP’s built-in task load balancing works very well Ongoing and future work: Even higher-dimensional options (spatial adaptivity, optimize algorithms) Improve memory access pattern

Dirk Pfl¨ uger: Parallelizing a Black-Scholes Solver based on Finite Elements and Sparse Grids PDCoF @ IPDPS 2010, April 19–23, 2010 14