Transcript
Page 1: CVA at Scale with Adjoint Sensitivities Xi-FINTIQ · CVA is calculated per netting set, and sensitivities with respect to market instruments are computed using adjoint AD. The resulting

Xi-FINTIQCVA at Scale with Adjoint Sensitivities

Combining the NAG Library with dco/c++ and Origami

Justin Ware, Jacques du Toit, Viktor Mosenkis and Ian Hotchkiss

Performance Challenge of XVACalculating XVA in a timely manner poses a big performance challengefor financial institutions. The number of trades encompasses the entireinstitution, not just an individual desk’s book(s). It is needed intradayas positions and markets update.

ToolsPractitioners use many tools to achieve the performance required todeliver XVA on time. Some of the most popular are:

Numerical Software Financial modelling typically uses sophisticatednumerical software. Here quality (through rigorous testing) and per-formance are key.

Algorithmic Differentiation (AD) The sensitivities of XVA risk mea-sures to market instruments are often required when reporting re-sults. Estimating these numerically can be very expensive. Algorith-mic differentiation, in particular adjoint algorithmic differentiation,offers a more accurate and computationally cheaper alternative.

Grid / Cloud XVA calculations have stages that are highly data paral-lel and computationally intensive. These can be split into multipletasks which are run on in-house grids and/or public clouds.

The Importance of DAGsDirected Acyclic Graphs (DAGs) have proven extremely useful in HPC

• They are data-centric: data dependencies are explicit, meaning datamovement can be aggressively optimized.

• They describe all levels of parallelism implicitly: programmers don’thave to try and express it, which can be challenging.

• They are platform agnostic: DAGs can be run on heterogeneous sys-tems with local and remote resources, spanning CPUs and GPUs.

• They are modular: programmers focus on describing individual tasks.Interdependence between tasks describes the overall application.

The figure below shows a DAG for a large-scale adjoint CVA calcula-tion.

Origami: a DAG Execution EngineOrigami is a light-weight task execution framework which is easy touse and maintain. Users combine tasks into a DAG. Origami can ex-ecute the DAG on an ad hoc cluster of workstations on the local net-work, on a dedicated in-house grid, on production cloud, or on a hybridof all these. Origami handles all data transfers. Machines can have dif-ferent hardware, including some with GPUs. Origami reports variousstatistics including full accounting figures for hardware use on a per-task basis. The result is a flexible, high performance execution engineaimed at business productivity and transparency.

CVA DemonstratorNAG has developed a CVA demonstration code to show how our (ad-joint) numerical libraries and our AD tool dco/c++ can be combinedwith Origami to solve large scale CVA computations. Model calibra-tion to market data is in separate tasks. Trades in netting sets are valuedin separate batches. CVA is calculated per netting set, and sensitivitieswith respect to market instruments are computed using adjoint AD. Theresulting DAG has a large number of tasks with non-trivial dependen-cies (see below) which Origami can automatically process and execute.

Combining Tools

• dco/c++ is an (A)AD tool computing sensitivities of C++ codesvia operator overloading. Since it operates at the source code level,closed source 3rd party dependencies (such as the NAG Library)cause problems.

• AD-enabled (adjoint and tangent) versions of NAG Library routinesare available which interface seamlessly with dco/c++. These al-low adjoint calculations to pass through NAG Library dependencies.

• Creating an adjoint of a distributed code is straightforward.

• The entire application is run forward as normal.

• The DAG is then reversed and the dco/c++ adjoint version of eachtask is run.

• The adjoint propagates sensitivities backward through the task. Ad-joints are taken seamlessly through NAG Library routines.

• Origami handles the data movement of adjoints between tasks.

AvailabilityThese tools are available to trial. Please contact [email protected] arrange access.

initialise

interest_rate_calibration1

interest_rate_calibration2

interest_rate_calibration3

credit_calibration1

credit_calibration2

credit_calibration3

credit_calibration4

netting_set1_batch1

netting_set1_batch2

netting_set1_batch3

netting_set1_batch4

netting_set1_batch5

netting_set1_batch6

netting_set1_cva

netting_set1_batch1_ad

netting_set1_batch2_ad

netting_set1_batch3_ad

netting_set1_batch4_ad

netting_set1_batch5_ad

netting_set1_batch6_ad

credit_calibration1_ad interest_rate_calibration1_ns1_ad netting_set1_report

netting_set2_batch1

netting_set2_batch2

netting_set2_batch3

netting_set2_batch4

netting_set2_batch5

netting_set2_batch6

netting_set2_cva

netting_set2_batch1_ad

netting_set2_batch2_ad

netting_set2_batch3_ad

netting_set2_batch4_ad

netting_set2_batch5_ad

netting_set2_batch6_ad

credit_calibration2_ad interest_rate_calibration1_ns2_ad netting_set2_report

netting_set3_batch1

netting_set3_batch2

netting_set3_batch3

netting_set3_batch4

netting_set3_batch5

netting_set3_batch6

netting_set3_cva

netting_set3_batch1_ad

netting_set3_batch2_ad

netting_set3_batch3_ad

netting_set3_batch4_ad

netting_set3_batch5_ad

netting_set3_batch6_ad

credit_calibration3_ad interest_rate_calibration1_ns3_ad netting_set3_report

netting_set4_batch1

netting_set4_batch2

netting_set4_batch3

netting_set4_batch4

netting_set4_cva

netting_set4_batch1_ad

netting_set4_batch2_ad

netting_set4_batch3_ad

netting_set4_batch4_ad

credit_calibration4_ad interest_rate_calibration1_ns4_ad netting_set4_report

credit_calibration5

credit_calibration6

credit_calibration7

netting_set5_batch1

netting_set5_batch2

netting_set5_batch3

netting_set5_batch4

netting_set5_cva

netting_set5_batch1_ad

netting_set5_batch2_ad

netting_set5_batch3_ad

netting_set5_batch4_ad

credit_calibration5_ad interest_rate_calibration2_ns5_ad netting_set5_report

netting_set6_batch1

netting_set6_batch2

netting_set6_batch3

netting_set6_batch4

netting_set6_batch5

netting_set6_batch6

netting_set6_cva

netting_set6_batch1_ad

netting_set6_batch2_ad

netting_set6_batch3_ad

netting_set6_batch4_ad

netting_set6_batch5_ad

netting_set6_batch6_ad

credit_calibration6_ad interest_rate_calibration2_ns6_ad netting_set6_report

netting_set7_batch1

netting_set7_batch2

netting_set7_batch3

netting_set7_batch4

netting_set7_batch5

netting_set7_batch6

netting_set7_cva

netting_set7_batch1_ad

netting_set7_batch2_ad

netting_set7_batch3_ad

netting_set7_batch4_ad

netting_set7_batch5_ad

netting_set7_batch6_ad

credit_calibration7_ad interest_rate_calibration2_ns7_ad netting_set7_report

credit_calibration8credit_calibration9

credit_calibration10

credit_calibration11

credit_calibration12

netting_set8_batch1

netting_set8_batch2

netting_set8_batch3

netting_set8_batch4

netting_set8_batch5

netting_set8_batch6

netting_set8_batch7

netting_set8_cva

netting_set8_batch1_ad

netting_set8_batch2_ad

netting_set8_batch3_ad

netting_set8_batch4_ad

netting_set8_batch5_ad

netting_set8_batch6_ad

netting_set8_batch7_ad

credit_calibration8_ad interest_rate_calibration3_ns8_ad netting_set8_report

netting_set9_batch1

netting_set9_batch2

netting_set9_batch3

netting_set9_batch4

netting_set9_batch5

netting_set9_batch6

netting_set9_batch7

netting_set9_cva

netting_set9_batch1_ad

netting_set9_batch2_ad

netting_set9_batch3_ad

netting_set9_batch4_ad

netting_set9_batch5_ad

netting_set9_batch6_ad

netting_set9_batch7_ad

credit_calibration9_ad interest_rate_calibration3_ns9_ad netting_set9_report

netting_set10_batch1

netting_set10_batch2

netting_set10_batch3

netting_set10_batch4

netting_set10_batch5

netting_set10_cva

netting_set10_batch1_ad

netting_set10_batch2_ad

netting_set10_batch3_ad

netting_set10_batch4_ad

netting_set10_batch5_ad

credit_calibration10_ad interest_rate_calibration3_ns10_ad netting_set10_report

netting_set11_batch1

netting_set11_batch2

netting_set11_batch3

netting_set11_batch4

netting_set11_batch5

netting_set11_batch6

netting_set11_batch7

netting_set11_cva

netting_set11_batch1_ad

netting_set11_batch2_ad

netting_set11_batch3_ad

netting_set11_batch4_ad

netting_set11_batch5_ad

netting_set11_batch6_ad

netting_set11_batch7_ad

credit_calibration11_ad interest_rate_calibration3_ns11_ad netting_set11_report

netting_set12_batch1

netting_set12_batch2

netting_set12_batch3

netting_set12_batch4

netting_set12_batch5

netting_set12_batch6

netting_set12_cva

netting_set12_batch1_ad

netting_set12_batch2_ad

netting_set12_batch3_ad

netting_set12_batch4_ad

netting_set12_batch5_ad

netting_set12_batch6_ad

credit_calibration12_ad interest_rate_calibration3_ns12_ad netting_set12_report

start / end nodes forward calculation repeat calculation with AD

September 2018 [email protected] www.nag.com

Recommended