30
Experts in numerical algorithms and HPC services Recent developments from NAG NAG / Wilmott Quant Event 22 nd October 2009 John Holden David Sayers Robert Tong

Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

  • Upload
    others

  • View
    25

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

Experts in numerical algorithms and HPC services

Recent developments from NAG

NAG / Wilmott Quant Event22nd October 2009

John Holden

David Sayers

Robert Tong

Page 2: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

2

Agenda

NAG Library and latest releases New Functionality

NAG Toolbox for MATLAB version Easily called into Excel

NAG and .NET NAG Numerical Routines for GPUs

Page 3: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

33

New Functionality

Global optimizationANOVA – Analysis of

VarianceNearest Correlation MatrixPartial Least Squares

Regression AnalysisPrediction intervals for

fitted modelsOption PricingAdditional CopulasExtreme Value Theory Stats

Fast quantile selection routineGeneralised Mixed Effect

Regression WaveletsAdoption of LAPACK 3.1New RNGs

Scrambled Seq for QMC

Mersenne Twister

Sobol Sequence generator (50,000 dimensions)

Page 4: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

4

Nearest correlation matrix

Based on a method by Qi and Sun, with improvements suggested by Higham and Borsdorf.

NAG routine minimises the Frobenius norm of the difference between the original matrix and the correlation matrix.

Page 5: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

5

Nearest correlation matrix

One of the features of this algorithm is that large matrices may be handled. As extensive use is made of BLAS routines we can exploit the optimized BLAS libraries available on many machines.

The algorithm thus lends itself well to exploitation of the machine architecture in both our serial and SMP implementations.

Page 6: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

6

0

5

10

15

20

25

30

1 2 4 8

FL22+MKLFS22+MKL

Multi-Core example Nearest-correlation matrix (NCM)

Tim

e (s

ecs)

Number of cores

Intel Xeon E5310 1.6 GHz, N=1000

Page 7: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

7

Global Optimization

A suite of routines to find the global minimum of a general function subject to simple bound constraints. The method used is Multilevel Coordinate

Search Use a systematic means of searching the

feasible area. Has already been used in earnest:

http://www.nag.co.uk/IndustryArticles/OptimizingOmegaPaper.pdf

Page 8: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

8

Option Pricing Functions

Closed form solutions with Greeks which provide a reference framework for approximate numerical methods: Monte Carlo, PDE, Trees Written initially for the academic audience i.e. to aid the

teaching of financial mathematics*

*we are now told by some of you that there will be circumstances where these functions are useful for the real practitioner!

Page 9: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

9

Why use closed form solutions?

FastEasy to calibrateRobustAccurate (in terms of mathematical model)

But Only exist for some optionsLack the flexibility of simulation

Page 10: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

10

Option Pricing Functions

European options: Black-Scholes-Merton Lookback – Floating-

Strike Binary

Cash-or-Nothing

Asset-or-Nothing

Barrier – Standard Jump-diffusion – Merton

Model

Heston’s Stochastic Volatility Model

American option: Bjerksund & Stensland

(2002) approximationAsian option: Geometric Continuous

Average-Rate

Page 11: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

11

Wavelets

Market Intervention/Manipulation

Are market prices influenced by large players – hedge funds, …?

June 2007 – New Zealand government attempted to reverse rise in NZD by injecting large sums into FX markets.

Wavelet analysis of time series of spot prices shows result …

Page 12: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

1212

USD-NZD, Haar MODWT (end effects removed) – NZ govt intervention towards end (right)

x(t)

d4

d5

d6

s6

x(t)

spot

prices

d4

d5

d6

s6

smooth coeffs – trend

Page 13: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

1313

Wavelet Transforms (1D)

Wavelet filter queryDiscrete wavelet transform in 1D (DWT)Inverse discrete wavelet transform in 1D (IDWT)Multi-level discrete wavelet transform in 1D (MLDWT)Inverse multi-level discrete wavelet transform in 1D (IMLDWT)

Page 14: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

14

NAG and Excel..

Our libraries are easily accessible from Excel Calling DLLs using VBA NAG provide VB Declaration Statements and Examples

Page 15: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

15

NAG Toolbox for MATLAB

Contains essentially all NAG functionality not a subset

Runs under Windows (32/64bit) and Linux (32/64-bit). Installed by default under the usual MATLAB

toolbox directory Can be used with MATLAB compiler

Page 16: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

16

NAG and .NET

Current Solutions Timings Next Release Roadmap

Page 17: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

17

NAG and .NET

NAG solutions for .NET1. Call NAG C (or Fortran) DLL from C#

2. NAG Library for .NET (beta 1)“a more natural solution”

DLL with C# wrappers Integrated help

3. NAG Library for .NET (Work-in-Progress) as above pure C# functions

Page 18: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

18

NAG Library for .NET – beta 1

Two main components1. .NET managed assembly

set of classes with static methods

2. NAG DLL

Also supplied Examples of Use

All functions come with examples

Fully Integrated Help with Visual Studio Including Intellisense

Page 19: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

19

NAG Library for .NET - Timings

DLL Vs Pure .NET Code Timings

DGEMM (matrix matrix multiply 50,000 x 5) DLL – 297ms

Pure .NET – 953 ms

Quadrature (2,000 solutions with call-back) DLL – 798ms

Pure .NET – 316ms

Page 20: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

20

NAG Library for .NET - Next Beta Release

Due November 2009 Quadrature (d01) Statistics Simple Stats (g01) Regression (g02) RNGs and distributions (g05) Time Series Analysis (g13)

Page 21: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

21

NAG Library for .NET - Road Map

Curve and Surface Fitting Linear Algebra Statistics .. .. You can help set the priorities

Pure .NET and DLL solutions Aim to incorporate the full NAG Library

Page 22: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

22

NAG and GPUs

Current offering

User quotes

Next steps

Page 23: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

23

Currently in beta, but pressure to productise Currently a few RNGs and distributions and

Brownian Bridge Available as a beta release

NAG Numerical Routines for GPUs

Page 24: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

24

Working with Fixed Income Research & Strategies Team (FIRST) NAG mrg32k3a works well in BNP Paribas CUDA “Local Vol

Monte-Carlo”

Passes “tests of randomness”[Double Precision - version passes TestU01]

Performance good (next slide)

Being able to match the GPU random numbers with the CPU version of mrg32k3a has been very valuable for debugging purposes

Early Success with BNP Paribas

Page 25: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

25

BNP Paribas Results

Page 26: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

26

“The NAG GPU libraries are helping us enormously by providing us with fast, good quality algorithms. This has let us concentrate on our models and deliver GPGPU based pricing much more quickly.” Matt Leslie, Equity Linked Analytics Group, Merrill Lynch

And with Merrill Lynch (BoA)

Page 27: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

27

Which other algorithms do we need to implement? Copulas, Linear Algebra, Optimization, PDEs, Wavelets,... ?

NAG Numerical Routines for GPUs

Page 28: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

28

AcknowledgementsWe would like to thank the Technology Strategy Board (TSB) and the Smith Institute for their support in sponsoring this project and EPSRC for supporting Professor Mike Giles’ academic research

NAG Numerical Routines for GPUs

Page 29: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

29

Summary

NAG for Quality, World-leading Numerical Software Components accurate, reliable, robust

extensively tested, supported and maintained code

updated for new architectures and new algorithms

Page 30: Recent developments from NAG · 2019-01-31 · Recent developments from NAG NAG / Wilmott Quant Event 22nd October 2009 John Holden David Sayers ... Easily called into Excel ... Call

30

Further Information

NAG Libraries www.nag.co.uk/numeric/numerical_libraries.asp

NAG Toolbox for MATLAB www.nag.co.uk/numeric/MB/start.asp

NAG and Excel www.nag.co.uk/numeric/nagandexcel.asp

NAG and .NET www.nag.co.uk/microsoft_dotnet.asp

NAG and GPUs www.nag.co.uk/numeric/GPUs/