1 / 17

Extracting parallelism in Price-It Library

Learn how to benefit from parallelism in the Price-It Library by extracting low-level and high-level parallelism. Discover the use of OpenMP for low-level parallelism and the parallelization of Greek calculations for high-level parallelism.

Download Presentation

Extracting parallelism in Price-It Library

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Extracting parallelism in Price-It Library Pricing Partners

  2. Outline • The C++ Price-It library • Short description • Parallelism ? • Low-level parallelism: Multicore using OpenMP • High-level parallelism: Sensitivities with ProActive

  3. The C++ Price-It Library • Core Library of all Pricing Partners Product • Originally written for Price-It Excel, the Pricing Partners financial addin for Microsoft Excel • Used in Price-It for Summit and in Price-It Online and as an internal tool for Independent Valuation • Written in C++ • Originally written for Microsoft compiler • Has been ported to Sun Solaris • JNI, COM interfaces for easy integration • Unfortunately not conceived as thread safe

  4. How to benefit from parallelism ? • Well known industry fact • Moore’s Law will be sustained through multicore • « Free Lunch » is over • Upgrading the entire code base to thread-safe is very costly • Is there any easier (and cheaper) alternatives to extract parallelism from Price-it Library ?

  5. How to benefit from parallelism ? – 2 • To benefit from parallelism we need to find parts of code that can run independently • Low-level for and while loop can easily be made independent • High-level independent calculation such as Greeks (sensitivities) can also be parallelized at a low cost.

  6. Low-level Parallelism with OpenMP • Description • Set of standardized compiler directives to extract parallelism at the for/while loop level • Designed to use multiple core and/or processor on a single machine • Not vendor-specific • How we used it • Find a low-level loop bottleneck using a profiler • Make the loop code thread safe (easy as it is low-level code) • Add a few #pragma omp to the C++ source code • Does not alter source code as the directives can be turned with a global switch

  7. Low-level Parallelism with OpenMP – Limits • No parallelism across machinesLimited to the number of cores available on the workstation • Only for the inner loops of the codeLimited speed-up

  8. High-level Parallelism • In quantitative pricing a common high-level parallelism with mostly independent jobs is Greeks Calculation • Computing derivatives of the Price with the regard to various parameters: • The underlying price (the stock price or the interest rates curve) • Volatility • Correlation

  9. Greeks • P is the price of a product • dP/dx where x can be • Underlying value • Delta -> 1st order derivative • Gamma -> 2nd order derivative • Gamma cross -> multi-asset product : cross derivative • Interest rate -> theta • Underlying volatility -> vega

  10. Greeks – 2 • Differentiation will be numerical not analytical • 1st order derivative • 2nd order derivative • There can be up to 4 prices to compute for a single derivative value • Derivation is often done with regard to a curve

  11. Differentiation with regard to curves • Different ways to shift data curves • Many price calculations in perturbative and cumulative shift modes

  12. Representing a price computation • A Price-It computation can be seen as a tree of function calls • The tree of function calls can be serialized as an XML stream

  13. Distributing Calculations • Preprocessing • « Differentiating » the XML pricing calls, i.e. shifting some of the inputs • Distribution • Sending all those pricing requests to workers • Have them perform the calculation • Wait for the result • Postprocessing • « Calculating »

  14. Implementation using interprocess commuication • A first implementation: custom-developed grid middleware in C# -> not maintainable • A proof of concept very simple implementation was then made using Boost C++ thread and interprocess shared memory libraries • Limited to a single machine • Manual launching of the worker, no error recovery • Reference implementation that was the base of the joint ActiveEon / Pricing Partners work

  15. Pricing Partners-ActiveEon joint work Excel and Price-it DLL (C/C++) ProActive Scheduler (Java) ProActive Worker (Java) ProActive Worker (Java) ProActive Worker (Java) Price-it computation DLL (C++) Price-it computation DLL (C++) Price-it computation DLL (C++)

  16. Conclusion • Various ways to easily leverage parallelism in a large existing code base designed without parallelism in mind • Collaboration started 1 month ago • Most of the time spent building a C++/JNI bridge to integrate the ProActive scheduler and workers with Price-it DLL • Final tests needed before an estimated production-ready version in December ’08 • Come and watch the demo at 6:00 pm!

  17. Conclusions • Questions ?

More Related