Outline GPU for Finance SciFinance SciFinance CUDA Risk Applications Testing Monte Carlo PDE Conclusions 2
Why GPU for Finance? Need for effective portfolio/risk management solutions Accurately measuring, managing and hedging derivatives risk exposure in a timely fashion is a primary objective for financial institutions. Fast, accurate derivative pricing models are therefore of key importance GPU-enabled pricing models offer: Accurate derivatives valuation (Reduced reliance on approximations) Broader scenario analysis Alternative or multiple risk assessment and methodologies Real-time risk management Huge reduction in datacenter footprint and power consumed 3
GPU Deployment in Finance 4
CUDA development approaches Hand-coding pricing model in CUDA Requires CUDA programming expertise Re-thinking pricing model implementation, and experimentation Re-assess underlying numerical routines and methodologies Automatically generate CUDA-enabled pricing model source code Harness the benefits of GPU computing without manual porting of each model to CUDA C/C++ Follows the best practice guidelines for CUDA C/C++ 5
SciFinance Overview Automatically generates C/C++ pricing model source code from concise, high-level model specifications NVIDIA GPU (CUDA C/C++) and multi-core CPU (OpenMP) support SciFinance is not a scripting language for assembling a set of black-box components Stand alone cross-platform C/C++ code Support for any financial derivative valued using any system of partial differential equations (PDEs, Finite Differences) or stochastic differential equations (SDEs, Monte Carlo simulations) SciFinance has been developed over 15 years with the input and guidance of practitioners at top tier institutions worldwide SciFinance generated pricing model source code is yours in perpetuity No run-time licenses or links to vendor binary libraries 6
SciFinance Description SciFinance is a flexible/extensible financial language/compiler with a high-level, keyword rich language End users have full modeling control over: Contract terms Instrument features Underlying dynamics Numerical routines and methodologies No imposed data model Hundreds of example model specifications included, covering all asset classes and popular models, all of which are completely customizable and composable SciCalibrator is a cross asset calibration framework for generating C/C++ model calibration routines 7
SciPDE features Any number of PDEs, arbitrary dimensionality Fast Craig-Sneyd ADI solvers Any linear PDE s and PIDE s - many non-linear e.g., transaction costs and HJB (in development) Complete control over discretizations, grid building, boundary conditions, etc Sensitivity measures calculated on any model parameter (FD or automatic differentiation of pricing PDE) 8
SciMC features Arbitrary form and number of stochastic processes Expressed as SDEs (stochastic differential equations) May include state-dependent parameters and jumps (arbitrary distributions) Sensitivity functions for any parameter of SDEs Finite Difference standard Hybrid FD-Likelihood method American/Bermudan exercise Choice of high-quality (pass TestU01 and DIEHARD statistical test suites) pseudo- random number generators Quasi-random number generators (Sobol, Faure, Halton) 9
SciFinance Cross Asset Support Convertible Bonds Cross Currency Hybrid Instruments Equity Interest Rate FX Credit Commodity Energy SciFinance 10
SciFinance Work Flow example.s (SciFinance specification, ASPEN) (* European option *) der[v,t] + 1/2 sigma^2 S^2 der[v,{s,2}] + (r-q) S der[v,s] - r V = 0; Payoff[Max[K-S,0]]; Output[V, S=Spot]; ASPEN Specification language Mathematica-like syntax High level description Direct SDE/PDE expressions Access external proprietary functions/classes Synthesized C/C++ code has NO EXTERNAL DEPENDENCIES NO BINARIES, pure source code Compile on ANY TARGET MACHINE with any C/C++ compiler *.cpp/.cu *.h *.vcproj, *.sln Makefile *.Main.cpp *.xml C/C++ (CUDA C/C++, OpenMP) source code Build scripts test harness Configuration/ Interface info 11
SciFinance code integration *.cpp *.h C/C++ source code *.xml Configuration/ Interface info SciPython SciNET SciCOM SciJava SciXLL.Net wrapper (managed code) COM wrapper Excel Add-In (XLL) Java wrapper (JNI) Python wrapper (Python C API) C#, Java, Python test harnesses MS Excel spreadsheets Build scripts 12
SciFinance - CUDA Code Synthesis automatically generates CUDA pricing and risk model source code Create an ASPEN specification for the pricing model Synthesize the serial source code and test it Add keyword CUDA to the specification Re-synthesize to get CUDA-enabled code No CUDA/parallel programming expertise is required 13
SciFinance CUDA-enabled pricing models Features: Cross-platform (MS Windows, Linux and OS X) Support CUDA Compute Capability 1.x, 2.x and 3.x Multi-GPU support via OpenMP threading Mixed single/double precision or full double precision Typical CUDA accelerations: Monte Carlo pricing models: 20X* - 60X* faster than CPU code (single GPU, double precision) PDE pricing models: 10X* - 40X* faster than CPU code (single GPU, double precision) * 4 core Intel Xeon W5580@3.2GHz vs 1 NVIDIA Tesla K20 (Kepler) 14
Example GPU risk computation : PFE Portfolio of 1000 swaps 1 -> 20yr maturities Mixture of Vanilla, CMS/Libor, and CMS/CMS 2yr, 5yr, 10yr CMS, random start dates 60 Counterparties - 1 to 50 swaps per counterparty Half subject to netting agreements, half not Evolution under multi-factor Gaussian model 95% PFE daily for 1 month, then weekly for 1 year Full double precision: 50X* for paths > 1024 Mixed single/double precision: 90X* for paths > 1024 * 4 core Intel Xeon W5580@3.2GHz vs 1 NVIDIA Tesla K20 (Kepler) 15
Benchmarking: Dell Workstation 1 GPU Hardware specifications: Dell Precision T5500 NVIDIA Tesla K20 (Kepler), 1 GPU Intel Xeon W5580 (4 cores) @ 3.2 GHz Testing environment: Windows 7 Enterprise 64-bit MS Visual C++ 9.0 (2008 SP1) 64-bit CUDA 5.0 64-bit Timing for the entire pricer code (initialization + memory transfers + GPU kernels) Full double precision code Error-Correcting Code (ECC) memory is ON 16
Monte Carlo Basket Option with Greeks 10 assets Deltas and diagonal Gammas Monte Carlo, Sobol sequence 17
Monte Carlo Callable Range Accrual Note Two-factor LIBOR market Model Monte Carlo, Sobol sequence Regression dominates Valuation dominates 18
Misc Monte Carlo Model Results CPU CPU 19X CPU 21X 30X GPU GPU GPU 19
PDE: The challenges 1D PDEs: Already very fast on the CPU: <1ms for Crank-Nicolson/Penalty Method American option solution. Finite difference schemes -> low order banded matrix. Discrete path dependency, e.g. Asian, soft call, range accrual features add additional pseudo-dimensions, PDE unchanged. Multi-D PDEs: ADI (Alternating Direction Implicit) usually optimal. Reduces to a series of 1D banded matrices. For ADI parallelization in the 2 nd, 3 rd, dimension and/or path quasi-dimensions is trivial BUT This easy parallelization is usually insufficient for an architecture like CUDA which requires 1000 s of threads for optimal performance. Must parallelize the basic 1D banded solver itself in addition to the multi-d and path factors. Possibilities include Cyclic Reduction and Recursive Doubling solvers (designed for fine-grained parallelism). 20
3D PDE examples Algorithm: Predictor-Corrector ADI (Craig-Sneyd) 2nd order accuracy, unconditional stability Any positive definite correlation matrix Non-uniform (conforming) grids via coordinate transformations 21
PDE Three Asset Option ADI Penalty Method for American exercise Grid dimensions 22
PDE Cancellable Knockout PRDC Swap Gaussian IR Lognormal FX Term structure of vols Speedup (X) 1 GPU vs 1 CPU core Number of grid points for the FX exchange rate Number of grid points for each interest rate factor 23
Conclusions State-of-the art solution for derivatives management: Automated CUDA programming for derivatives pricing models Faster derivatives pricing and risk management Energy Efficient: huge reduction in datacenter footprint and power consumed Cost effective technologies Higher performance/price ratio than for a CPU cluster 24
SciFinance evaluation SciFinance evaluations are available Test the performance of your own GPU-enabled pricing models and the ease with which they can be developed with SciFinance SciComp Sales Representative (Europe) Dick Verkerk verkerk@scicomp.com http://www.scicomp.com 25