Integration

Integration approach

Learn how MatLogica AADC is integrated to turn your object-oriented code into data-oriented performance, achieving 6-100x speed ups for your analytics and computing sensitivities using ultra-fast AAD

MatLogica uses an unorthodox integration approach that delivers results in a few weeks while our competitors can take months or even years. The required code changes are minimal and can be performed by an experienced quant or developer with little to no additional training.

You can do the integration yourself, invite our integration expert, or work with a certified third-party vendor to supercharge your business.

What it Takes to Integrate MatLogica AADC?

Integrating into Existing Quant Library

For well-established libraries (10+ years old, 10M+ code lines) performance, numerical stability, and refactoring effort are critical factors. Incorporating AADC is a semi-automated process powered by a rich set of tools and methodologies to assist the initial integration and debugging processes.

An automated replacement of double with idouble is required as a first step, resulting in the same numerical and performance results. The next step is to identify the main Monte-Carlo loop, mark the inputs and outputs, and indicate the recording of the parameters for a single path to obtain the kernel for use in subsequent iterations. While this process demands a nuanced understanding of the library's intricacies, the integration process is straightforward and its benefits are profound - transforming legacy code into a high-performance powerhouse.

Using MatLogica AADC for a New Project

By leveraging AADC’s capabilities from the outset and recalibrating quant libraries from the ground up Developers are liberated from the time-consuming challenge of retrofitting an existing codebase. There are three main benefits to this approach, (1). clean up-front design, (2). minimal wasteful development efforts, and (3). a guilt-free path to harnessing the full potential of the desired hardware. Starting afresh is therefore an opportunity to craft a library with baked-in efficiency, enabling a seamless process for subsequent iterations.

A Step-by-Step Approach to Integrating MatLogica

Step 1: Drop-in Replacement

As a first step, the MatLogica active type must be introduced into the library. This active type will enable MatLogica AADC to extract the valuation graph.

This can be performed by running a suite of integration scripts that safely and efficiently transform an existing code base into a robust framework, ready to harness the benefits of MatLogica AADC.

AADC Integration: Step 1

AADC Integration: Step 1 - Drop-in Replacement

An automated replacement of double with idouble is required as a first step, resulting in the same numerical and performance results. The next step is to identify the main Monte-Carlo loop, mark the inputs and outputs, and indicate the recording of the parameters for a single path to obtain the kernel for use in subsequent iterations. While this process demands a nuanced understanding of the library's intricacies, the integration process is straightforward and its benefits are profound - transforming legacy code into a high-performance powerhouse.

Step 2: Record the Function

Next, we identify the function that is executed in simulations and/or needs to have sensitivities computed. We instruct AADC to record the function and specify the inputs and outputs of the function.

AADC Integration: Step 2

AADC Integration: Step 2 - Recording

Once this step is complete, AADC will record the kernels that represent this function.

Step 3: Execute the Function

Once we have the recording (or kernel), it is used instead of the original function to compute the function itself, and its derivatives where needed. All done!

AADC Integration: Step 3

AADC Integration: Step 3 - Execute the Function

All done!

What if Something Goes Wrong?

Debugging tool

In most cases, the results produced by AADC are identical to the numbers produced by the original program. In some instances, numerical differences can be observed due to optimisations performed by AADC. Consider an expression (a+b+c): mathematically, the order of operations doesn’t matter, but in computer terms, it may be impactful due to compounded rounding differences.

AADC comes with a debugging toolkit that targets such corner cases. It will point exactly to the line of code where numerical differences arise, allowing confident resolution of any mismatches.

Diagnostics toolkit

Also important is the handling of branches and if-statements. When the function depends on stochastic conditions, both branches must be recorded. MatLogica’s Diagnostics toolkit is designed for this purpose and will flag up any part of the code where branches are not handled correctly.

No-trade-off Integration Explained

Introducing a traditional Operator Overloading AAD library will slow down the code base by a factor of ~2. MatLogica has developed an approach that avoids this undesired effect, and the code will not slow down once AADC is introduced.

Our semi-automated integration approach enables you to have a single branch of code during the integration and development processes. MatLogica integration scripts can be part of your CI/CD, meaning that team members will not be impacted by the changes introduced. You can then transition to production once you have full confidence in the results!