Alternate Direction Implicit Method for a Stochastic Local Volatility Model:

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion Alternate Direction Implicit Method for a Stochastic Lo...
Author: Duane Robertson
17 downloads 0 Views 1MB Size
Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Alternate Direction Implicit Method for a Stochastic Local Volatility Model: High Performance Computing Platforms Comparison

Zaid AIT HADDOU Manchester Business School

May 15, 2013 HPCFinance conference Tampere

1 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Outline 1

Stochastic Local Volatility Model Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

2

Alternate Direction Implicit Scheme: ADI What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

3

Results Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

4

Conclusion 2 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

Why a Stochastic Local Volatility Model ? 1

Stochastic volatility models: (+) Tends to be more aligned with market dynamics. (-) Cannot capture the whole implied volatility surface. (-) Inability to price correctly short-term and far-in-the money orfar-out-of-the money options.

2

Local volatility models: (+) Able to replicate perfectly the market vanilla options prices. (-) The volatility dynamic is not realistic.

3

Stochastic Local Volatility models: (+) Keep the stochastic dynamic of the volatility while ensuring a better calibration to market data. (-) Could not be calibrated correctly when the vol-of-vol parameter is large. 3 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

Why a Stochastic Local Volatility Model ? 1

SLV model: SLV is a combination of a Local & Stochastic Volatility model Implemented SLV √ dSt = rSt dt + L(St , t) νt St dWt1

(1)

√ dνt = k(θ − νt ) + ξ νt dWt2

(2)

dWt1 .dWt2 = ρdt L(St , t): is the leverage function and it represents the weight of local volatility in the model. 4 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

SLV Calibration

Two steps calibration: 1

Find the stochastic parameters of the pure Heston model to match given market implied volatility data.

2

Calibrate the leverage function L(St , t) to the local volatility surface.

5 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

Leverage Function Calibration Assuming the following LV model: dSt = rSt dt + σLV (St, t)St dWt

(3)

The SLV model will behave like the LV model if: σLV (K , t)2 = E [L(St, t)2 νt |St = K ]

(4)

Solve the Fokker-Planck PDE of the transition probability density function P of the SLV model: dP d 1 d 1 d2 =− ((r − L2 (X , t)ν)P) − (k(θ − ν)P) + (L2 (X , t)νP)+ dt dX 2 dν 2 dX 2 1 2 d2 d2 ξ (νP) + ξρ (L(X , t)νP); X = log (S) 2 dν 2 dνdX

(5) 6 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

Leverage Function Calibration

Figure : Initial probability distribution for the forward Fokker-Planck PDE

7 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

Leverage Function Calibration

Figure : Interim probability distribution for the forward Fokker-Planck PDE

8 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Why a Stochastic Local Volatility Model ? SLV Calibration Leverage Function Calibration Option Pricing

Part 2: Option Pricing

After calibrating the Leverage function L(St , t), it could be then included it in the Heston PDE to price options. Calibrated Heston PDE: dV 1 d 2V 1 dV d 2V 1 d 2V + νL2 (X , t) + ρξνL(X , t) + ξ2ν + (r − νL2 (X , t)) − 2 dt 2 dX 2 dX dνdX 2 dν 2

r ν + [k(θ − ν) − λ(X , ν, t)]

dV =0 dν

(6)

9 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

What is ADI ?

ADI is a finite difference method used to solve PDEs in two or more dimensions Different type of ADI schemes: Peaceman-Rachford, Douglas-Rachford and Craig-sneyd, etc. The advantage of the ADI method is that the equations that have to be solved in each step have a simpler structure and can be solved efficiently with a simple tridiagonal matrix algorithm.

10 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Simple Implementation of the ADI Scheme Simple 2D Linear Diffusion equation: dV d 2V d 2V = + dt dX 2 dY 2

δx2 =

(7)

d2 2 d2 ; δ = dX 2 y dY 2

Implicit discretization: (1 −

∆t 2 ∆t 2 n+1 n δ − δ )V = Vi,j 2 x 2 y i,j

(8) 11 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Simple Implementation of the ADI Scheme 1

ADI Scheme: Douglas-Rachord (1956) n+1 Adding ∆t 2 δx2 δy2 Vi,j to both sides of equation (8):

1 1 n+1 n+1 n = Vi,j + ∆t 2 δx2 δy2 Vi,j (1 − ∆tδx2 )(1 − ∆tδy2 )Vi,j 2 2

(9)

n+1 n Assuming that ∆t 2 δx2 δy2 Vi,j = ∆t 2 δx2 δy2 Vi,j Splitting

1 1 n+ 1 n (1 − ∆tδx2 )Vi,j 2 = (1 + ∆tδy2 )Vi,j 2 2 1 n+ 1 n+1 n (1 − ∆tδy2 )Vi,j = Vi,j 2 − ∆tδy2 Vi,j 2

(10) (11) 12 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

ADI for Heston PDE Using Crank Nicolson discretization instead of its implicit counterpart. Following the same logic explained in the previous example: 1 1 1 n+ 1 n (1 − ∆tA1 )Vi,j 2 = (1 + A0 + ∆tA1 + ∆tA2 )Vi,j 2 2 2 1 1 n+ 1 n+1 n (1 − ∆tA2 )Vi,j = Vi,j 2 − ∆tA2 Vi.j 2 2

(12) (13)

We deal with the mixed derivative term A0 only explicitly.

13 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Simple Implementation of the ADI Scheme In the ADI first step, we solve for each ”j” a tridiagonal system of linear equations:   n+ 12  n    V0,j D   b0 c0 0 0 . . . . 0 1  n+ 2   0,j n  a1 b1 c1 0 . . .    . .  V1,j   D1,j     0 a2 b2 c2 0 . .  .   .  . .       .    . a3 b3 c3 . . . .  .   .   =  n  .  n+ 1  . . . . . . . .  Di,j    Vi,j 2     .     . . . a b c . . i i i   .   .    . . . . . . . . .   .   .  n . . . . . . . aiMax biMax  n+ 1  DiMax,j 2 ViMax,j 14 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Simple Implementation of the ADI Scheme In the ADI second step, we solve for each ”i” a tridiagonal system of linear equations:   n,n+ 21     V n+1 Hi,0 1  f0 g0 0 0 . . . . 0 i,0 n,n+ 2  n+1 V   e1 f1 g1 0 . . .   . .  i,1  Hi,1       0 e2 f2 g2 0 . . .  . .  .         .   . . e f g . . . . .   3 3 3    n+1 = 1 .   n,n+ . . . . . . . .  Vi,j  H 2     i,j .  . . . ej fj gj . .  .     .     . . . . . . . . .  .    .    n+1 . . . . . . . ejMax fjMax Vi,jMax n,n+ 12 Hi,jMax 15 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Thomas algorithm 1

Thomas algorithm: Forward elimination:

c i   0 bi ci = ci  0  bi − ci−1 ai  d   i  bi 0 di = d − d 0 a i  i−1 i   0 bi − ci−1 ai

;i = 1 ; i = 2, 3, ..., n − 1

(14)

;i = 1 (15) ; i = 2, 3, ..., n − 1 16 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Thomas algorithm 1

Thomas algorithm: Backward substitution:

 0  Vn = dn

(16)

 0 0  Vi = di − ci Vi+1 1

Characteristics: Complexity O(N). The fastest serial algorithm.

17 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Cyclic reduction 1

Cyclic Reduction: Forward reduction:   ai−1 Vi−2 + bi−1 Vi−1 + ci−1 Vi = di−1 ai Vi−1 + bi Vi + ci Vi+1 = di   ai+1 Vi + bi+1 Vi+1 + ci+1 Vi+2 = di+1

; i = 2, .., 2n (17)

The first of these equations is multiplied by αi =

−ai and the bi−1

−ci then the three equations are added in order bi+1 to eliminate Vi−1 , Vi+1 (odd indexed unknowns) last by λi =

18 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Cyclic reduction 1

Cyclic Reduction: Forward reduction: (1)

(1)

(1)

(1)

ai Vi−2 + bi Vi + ci Vi+2 = yi ; i = 2, .., 2n

(18)

Backward substitution: We use the even-indexed unknowns found through the forward reduction in order to solve all odd-indexed unknowns. 2

Characteristics: Complexity O(N) Each step of the CR algorithm could be parallelized.

19 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Cyclic reduction 1

CR algorithm:

Figure : Forward Reduction & Backward substitution in the CR algorithm (Zhang.y et al. (2010)) 20 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

What is ADI ? Simple Implementation of the ADI Scheme ADI for Heston PDE Tridiagonal Systems Solvers

Parallel cyclic reduction 1

PCR algorithm:

Figure : Forward Reduction in PCR algorithm (Zhang.y et al. (2010)) 21 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Market Implied Volatility Surface

Figure : Implied Volatility Surface

22 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Volatility curves (T=0.5 year)

Figure : Market volatility, Heston implied volatility and Local volatility curves for T=0.5

23 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Leverage function surface

Figure : Leverage function surface 24 / 41

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Call options pricing error V0 0.0713

ξ 0.4

k 1

θ 0.2

S0 120

ρ 0.3874

r 0.02

T 0.5

Table : Heston Parameters

Strike 180 100

LV 0.0338 0.0013

Heston 0.1532 0.1648

SLV 0.0383 0.0183

market price 1.0665 23.3577

Table : Pricing error according to different models

25 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Many-core GPU: CUDA M-Class NVIDIA GPU: TESLA M2050 Peak double precision floating point performance peak

515 Gigaflops

Peak single precision floating point performance peak

1030 Gigaflops

Memory clock speed

1.55GHz

Core clock speed

1.15GHz

CUDA cores

448

Memory size (GDDR5)

3 GigaBytes

Memory bandwidth (ECC off)

148 GBytes/sec

Power consumption

225w TDP

CUDA SDK

CUDA Driver API 4.2.9

Table : Technical Specifications GPU

26 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Multi-core CPU: OpenMP Two chips: Intel Xeon Processor E5-2670 Memory Size/Type

64Gb

Memory clock speed

1.3ghz/DDR3

Core clock speed (max turbo frequency)

3 Ghz

Number of cores (in each chip)

8

Number of threads (in each chip)

16

Cache memory size

20 Mb

Memory bandwidth

51.2 GBytes/sec

Power consumption

115w TDP

OpenMP version

2.0

Table : Technical Specifications CPU

27 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

GPU implementation: Method 1 1

First method on GPU: Thomas-CUDA All data arrays are stored linearly on the GPU global memory. Two kernels (each kernel solve one ADI step) Each thread build and solve one tridiagonal system using Thomas algorithm. The Transfer of the results from the GPU to the CPU happens once after completing the time iterations.

2

Charasteristics: Very easy to implement. Global memory is slow. For 2D ADI most GPU cores are idle.

28 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

GPU implementation: Method 2 1

Second method on GPU: PCR-CUDA The lower, main and upper diagonals of the tridiagonal system are all stored linearly in the GPU shared memory. Two kernels (each kernel solve one ADI step) Each tridiagonal system is solved and built by all the block threads using the PCR algorithm. The transfer of the results from the GPU to the CPU happens once after completing the time iterations.

2

Charasteristics: Harder to implement. Shared memory is fast. For 2D ADI, quite good use of GPU cores. 29 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Platform comparison

Figure : Summary of the acceleration achieved (510 systems of 512 linear equations at each ADI step) 30 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Profiling

Figure : Buiding & solving systems

31 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Profiling

1

First Method: Thomas-CUDA Poor performance in the V direction due to uncoalesced global memory access.

2

Second method: PCR-CUDA Poor performance in the S direction due to uncoalesced global memory access.

32 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Global memory access coalesced global memory access:

Figure : Coalesced memory access

Uncoalesced global memory access:

Figure : Uncoalesced memory access 33 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Profiling: Memory Optimization

Figure : Building systems optimization

34 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Volatility & Leverage Function Call Options Price Experimental Environment CUDA Implementation Platform Comparison

Platform comparison: Memory Optimization

Figure : Summary of the acceleration achieved after memory access optimization (510 systems of 512 linear equations at each ADI step) 35 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Conclusion

SLV models could be a good alternative for SV and LV models. Calibration is not stable for large vol-of-vol There are several sources that lead to inaccurate pricing in the SLV model using ADI: Choice of the boundary conditions Approximating the leverage function while solving the forward Kolmogorov PDE with ADI.

36 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Conclusion

Of course ! the GPU codes could still be optimized. Coalesced global memory access is very important for optimization. GPU become much more competitive as we increase the density of the grids. CUDA code requires a reasonable programming effort to optimize performance ! OpenMP is very easy to implement !

37 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Questions ?

Thank you for your attention

38 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

References “Tridiagonal solvers on the GPU and applications to fluid simulation” Nikolai Sakharnykh, GTC 2009 “Fast tridiagonal solvers on the GPU” Y. Zhang, J. Cohen, J.D. Owens, PPoPP 2010 “High performance finite difference PDE solvers on GPUs.” D. Egloff, http://download.quantalea.net/fdm gpu.pdf, Feb. 2010 “Foreign exchange option pricing: A Practitioner’s guide”,IAIN J. Clark, Wiley finance. 2010 “Calibrating and Pricing with Stochastic-Local Volatility Model” Tian. Y, Z. Zili, K. Fima, H. Kais “On the Numerical solution of heat conduction problems in two and three space variables”,J. Douglas, JR., H. H. Rachford, JR.

39 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Acknowledgement Zaid ait Haddou is a Marie Curie fellow at the University of Manchester. The research leading to these results has received funding from the European Community’s Seventh Framework Programme FP7-PEOPLE-ITN-2008 under grant agreement number PITN-GA-2009-237984. I would like to thank NAG, advice and technical support, and Chris Armstrong and Jacques Du Toit (both from NAG) for poviding codes and for many helpful comments and suggestions. My deepest gratitude goes also to my supervisor Prof. Ser-Huang Poon, in Manchester Business School, for her precious help and understanding during the whole project. Furthermore, I would like to acknowledge with much appreciation the help provided by Mr. Erik Vynkier and also for having me one month in SWIP office in Edinburgh. I would like to also thank Mr. Daniel egloff for his technical help and for providing the PCR solver CUDA code. 40 / 41

Stochastic Local Volatility Model Alternate Direction Implicit Scheme: ADI Results Conclusion

Appendix ADI for Heston PDE: A0 corresponds to the mixed derivative term, A1 the spatial derivatives in S direction and A2 the spatial derivatives in V direction.

1 A0 = ∆tρσVj Si δsv 2 1 A1 = ∆t[Vj Si2 δss + rSδs − r ] 2 1 A2 = ∆t[σVj δvv + [k(θ − Vj ) − λ(Si , Vj , t)]δv − r ] 2

(19) (20) (21)

41 / 41

Suggest Documents