From: Peter C. <pca...@gm...> - 2023-06-21 16:59:34
|
Hi Jörg, thank you. This is interesting! A basic concern I have with the approach is the risk of slowing down computations unnecessarily for which you don't need the AD instrumentation. I tested this by building QuantLib from the current master (1.31-dev) with and without XAD and running the test suites. This is what I observe on my mac book pro which has an intel i9 processor: - a slowdown of around 2x averaging over all unit test cases - a slowdown of around 3x for the quantlib-benchmark cases - a slowdown of up to 10x for single test cases, e.g. MarketModelTest__testPathwiseGreeks (10.5x) or testRandomizedLattices (7x) I think this is expected and it was also discussed on this list before, when Compatibl suggested a similar approach. I still wanted to ask whether you see possibilities to address this issue for practical use cases? The clean solution is obviously to use templated functions and instantiate them with double or the ad-type as needed. You can also try and run the computations in two versions of the library. Neither seems easy to do / straightforward though. I know this question has little to do with your tool as such! Thank you Peter On Tue, 30 May 2023 at 12:39, Jorg Lotze <jor...@xc...> wrote: > > Hello all, > > As of QuantLib 1.28 (October 2022), Automatic Differentiation (AD) can be enabled in QuantLib using the open-source XAD AD tool and an XAD/QuantLib integration module. QuantLib's AD-compatibility is actively maintained via automated CI/CD checks, running daily against QuantLib's master branch. > > Below are performance results for a set of examples using QuantLib, showing the cost of AD compared to the matching plain pricing valuation (no AD) for an arbitrary number of sensitivities. Those results are reproducible and the code used is publicly available. > > The results show the time taken by the AD enabled version of QuantLib vs. the time taken for a plain (double) valuation is between a factor of 1.4 and 2.8. This means one can get arbitrary numbers of sensitivities in less than 2.8x the time taken by a plain valuation. We've included details for the benchmark configuration at the end of this email. > > Equity Option Portfolio (98 sensitivities) > - Valuation run: 2.83 ms > - AAD run: 7.00 ms (2.47 X) > > Barrier Option Replication (13 sensitivities) > - Valuation run: 1.48 ms > - AAD run: 4.16 ms (2.81 X) > > Swap Portfolio (55 sensitivities) > - Valuation run: 26.05 ms > - AAD run: 36.28 ms (1.39 X) > > Multicurve Bootstrapping (65 sensitivities) > - Valuation run: 192.11 ms > - AAD run: 299.63 ms (1.56 X) > > More details here: https://auto-differentiation.github.io/quantlib/#benchmarks > > Cheers, > Jorg > > Benchmark configuration: > - QuantLib version: 1.30 > - XAD version: 1.2.0 > - OS: Windows Server 2022 Datacenter > - Compiler: Visual Studio 2022, 17.6.1 > - RAM: 64GB > - CPU: Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz > > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users |