On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU...

22
On a GPU Acceleration of the Stochastic Grid Bundling Method ´ Alvaro Leitao Rodr´ ıguez and Cornelis W. Oosterlee Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI) 13/6/2014 ´ Alvaro Leitao Rodr´ ıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI)) On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 1 / 21

Transcript of On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU...

Page 1: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

On a GPU Acceleration of the Stochastic GridBundling Method

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee

Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI)

13/6/2014

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 1 / 21

Page 2: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Outline

1 Introduction

2 Bermudan Options

3 Stochastic Grid Bundling Method

4 Parallel GPU Implementation

5 Results

6 Conclusions

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 2 / 21

Page 3: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Introduction and Motivation

Multi-dimensional early-exercise option contracts.

Increasing the dimensionality.I Counterparty Valuation Adjustment (CVA).

SGBM becomes expensive.

Solution: parallelization of the method.

General-Purpose computing on Graphics Processing Units (GPGPU).

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 3 / 21

Page 4: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Bermudan Options

Right to exercise at a set number of times:t ∈ [t0 = 0, . . . , tm, . . . , tM = T ].

d-dimensional underlying process: St = (S1t , . . . ,S

dt ) ∈ Rd .

Intrinsic value of the option: ht := h(St).

The value of the option at the terminal time T:

VT (ST ) = max(h(ST ), 0).

The conditional continuation value Qtm , i.e. the discounted expectedpayoff at time tm:

Qtm(Stm) = DtmE[Vtm+1(Stm+1)|Stm

].

The Bermudan option value at time tm and state Stm :

Vtm(Stm) = max(h(Stm),Qtm(Stm)).

Value of the option at the initial state St0 , i.e. Vt0(St0).

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 4 / 21

Page 5: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Bermudan options scheme

Figure: d-dimensional Bermudan option

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 5 / 21

Page 6: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Stochastic Grid Bundling Method

Regression-based method.

Forward in time: Monte Carlo simulation.

Backward in time: Early-exercise policy by using dynamicprogramming.

Step I: Generation of stochastic grid points

{St0(n), . . . ,StM (n)}, n = 1, . . . ,N.

Step II: Option value at terminal time tM = T

VtM (StM ) = max(h(StM ), 0).

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 6 / 21

Page 7: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Stochastic Grid Bundling Method (II)

Backward in time, tm, m ≤ M,:

Step III: Bundling into ν non-overlapping sets or partitions

Btm−1(1), . . . ,Btm−1(ν)

Step IV: Mapping high-dimensional state space onto alow-dimensional space (least squares regression)

Z (Stm , αβtm) ≈ Vtm(Stm).

Step V: Computing the continuation and option values at tm−1

Qtm−1(Stm−1(n)) = E[Z (Stm , αβtm)|Stm−1(n)].

The option value is then given by:

Vtm−1(Stm−1(n)) = max(h(Stm−1(n)), Qtm−1(Stm−1(n))).

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 7 / 21

Page 8: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

BundlingOriginal: Iterative process (K-means clustering).Problems: Too expensive (time and memory) and distribution.New technique: Equal-partitioning.Two stages: sorting and splitting.

SORT SPLIT

Figure: Equal partitioning scheme

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 8 / 21

Page 9: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Parallel SGBM on GPU

First implementation: efficient C-version.

NVIDIA CUDA platform.

Two parallelization stages:I Forward: Monte Carlo simulation.I Backward: Bundles at each time step.

Memory transfers to/from GPU: Unified Virtual Addressing (UVA).I Asynchronous transfers.I Page-locked memory accesses.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 9 / 21

Page 10: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Parallel SGBM on GPU - Forward in time

One GPU thread per Monte Carlo simulation.

Random numbers “on the fly”: cuRAND library.

Avoiding memory transfers and usage:I Compute the intrinsic value of the option.I Equal-partitioning: sorting criterion calculations.

Original: memory transfers and usage cannot be avoided.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 10 / 21

Page 11: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Monte Carlo implementation scheme

Figure: SGBM Monte Carlo

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 11 / 21

Page 12: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Parallel SGBM on GPU - Backward in time

One GPU thread per bundle.

Each bundle calculations (option value and regression) in parallel.

All threads collaborate in order to compute the continuation value.

Final reduction: Thrust library.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 12 / 21

Page 13: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Backward implementation scheme

Figure: SGBM backward stage

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 13 / 21

Page 14: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Results

Accelerator Island system of Cartesius Supercomputer.I Intel Xeon E5-2420 (Sandy Bridge).I NVIDIA Tesla K20m.I C-compiler: GCC 4.4.6.I CUDA version: 5.5.

Geometric basket Bermudan put option: St0 = (40, . . . , 40) ∈ Rd ,K = 40, rt = 0.06, σ = (0.2, . . . , 0.2) ∈ Rd , ρij = 0.25, T = 1 andM = 10.

Multi-dimensional Geometric Brownian Motion.

Euler discretization, δt = T/M.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 14 / 21

Page 15: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Results

1 2 4 8 161

1.05

1.1

1.15

1.2

1.25

1.3

1.35

1.4

1.45

1.5

Bundles ν

Vt0(S

0)

5d True price

5d Equal−part.

15d True price

15d Equal−part.

50d True price

50d Equal−part.

Figure: Convergence of SGBM with Equal-partitioning technique.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 15 / 21

Page 16: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Results

Table: Time (s) for the C and CUDA versions. Test configuration: N = 222,δt = T/M and ν = 211.

k-means Equal-partitioning

5d 10d 15d 5d 10d 15d

C 676.25 1347.07 2008.16 157.83 234.60 320.59CUDA 38.77 145.28 307.64 13.85 14.78 15.42

Speedup 17.44 9.27 6.52 11.40 15.87 20.79

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 16 / 21

Page 17: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Results

Table: Time (s) for a high-dimensional problem with equal-partitioning. Testconfiguration: N = 222 and δt = T/M.

ν = 212 ν = 214

30d 40d 50d 30d 40d 50d

C 570.83 787.36 989.15 571.97 787.22 984.51CUDA 18.06 21.44 25.09 19.25 22.60 26.06

Speedup 31.61 36.72 39.42 29.71 34.83 37.78

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 17 / 21

Page 18: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Conclusions

Efficient parallel GPU implementation.

Extend the SGBM’s applicability: Increasing dimensionality andamount of bundles.

New bundling technique.

Future work:I American options.I CVA calculations.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 18 / 21

Page 19: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

References

CUDA webpage.http://www.nvidia.com/object/cuda home new.html.

cuRAND webpage.https://developer.nvidia.com/curand.

Shashi Jain and Cornelis W. Oosterlee.The stochastic grid bundling method: Efficient pricing of bermudanoptions and their greeks, 2013.

Thrust webpage.http://thrust.github.io/.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 19 / 21

Page 20: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Questions and/or suggestions

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 20 / 21

Page 21: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Acknowledgements

Thanks

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 20 / 21

Page 22: On a GPU Acceleration of the Stochastic Grid Bundling Method · 2020-05-19 · On a GPU Acceleration of the Stochastic Grid Bundling Method Alvaro Leitao Rodr guez and Cornelis W.

Appendix

Basis functions:

φk(Stm) =

((

d∏δ=1

Sδtm)

1d

)k−1

, k = 1, . . . , 5,

The expectation can directly be computed as:

E[φk(Stm)|Stm−1(n)

]=

(Ptm−1(n)e

(µ+ (k−1)σ2

2

)∆t)k−1

,

where,

Ptm−1 (n) =

(d∏

δ=1

Sδtm−1

(n)

) 1d

, µ =1

d

d∑δ=1

(r − qδ −

σ2δ

2

), σ2 =

1

d2

d∑p=1

(d∑

q=1

C 2pq

)2

.

Alvaro Leitao Rodrıguez and Cornelis W. Oosterlee (Technische Universiteit Delft (TU Delft) - Centrum Wiskunde & Informatica (CWI))On a GPU Acceleration of the Stochastic Grid Bundling Method 13/6/2014 21 / 21