Repository navigation
Faster AD and builds by default - #54
Merged
Merged
Conversation
QuantLibAAD now comes before xad in QL_EXTERNAL_SUBDIRECTORIES and sets XAD's option defaults; with the old order it warns.
QLAAD_ALLOW_XAD_FIRST=ON keeps the old order, with XAD's own settings and a warning.
Contributor
Author
|
CI against QuantLib master plus lballabio/QuantLib#3068 (which fixes master's test suite with AD types): all jobs pass. https://github.com/auto-differentiation/QuantLibAAD/actions/runs/43245396216 The red checks on this PR come from QuantLib master's test suite not compiling with AD until #3068 is merged. |
This was referenced Nov 12, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
QuantLibAAD's defaults now give fast AD code and fast builds. QuantLibAAD sets XAD's fastest tape options before XAD is configured, builds QuantLib as a static library, with link-time optimisation when built with GCC, and speeds up QuantLib's build with precompiled headers, unity builds and ccache. Each setting can be switched off on the command line. QuantLibAAD now has to be listed before XAD in
QL_EXTERNAL_SUBDIRECTORIES. The old order is now a configure error: pass-DQL_EXTERNAL_SUBDIRECTORIES="<path>/QuantLibAAD;<path>/xad"and reconfigure in a fresh build directory, or pass-DQLAAD_ALLOW_XAD_FIRST=ONto keep XAD's own settings, with a warning that QuantLibAAD's defaults don't reach XAD. An installed XAD package (find_package(XAD)) is not affected.The default library type changes from shared to static on Linux and macOS, also when an existing build directory is reconfigured. Pass
-DBUILD_SHARED_LIBS=ONto keep a shared QuantLib. When QuantLib is built inside another project, that project'sBUILD_SHARED_LIBSdecides. Users linking a static QuantLib throughpkg-configorquantlib-configneed-lxadtoo, and an older shared QuantLib should be removed from the install prefix.Changes
-C) are replaced by the defaults (forXAD_NO_THREADLOCAL, XAD's own default, OFF), with a warning naming each entry that changes; that includes-Doptions given in the old order, so pass them again. With an installed XAD package, XAD's own settings apply and CMake says so.QLAAD_LTO_FAT_OBJECTS=ONadds machine code to the installed libraries, for use by other toolchains.QLAAD_FAST_BUILD), ccache when installed (QLAAD_USE_CCACHE), and one CTest test per QuantLib suite soctest -jruns them in parallel (QLAAD_CTEST_PER_SUITE).-ffp-contract=offfor QuantLib and its users with GCC, Clang and AppleClang, so AD values matchdoubleexactly.XAD_NO_THREADLOCAL; the README describes the defaults and how to switch them off. CI now builds the new defaults, so it no longer builds the old default combination (shared QuantLib, no LTO), XAD with its own tape defaults, or QuantLib without precompiled headers and unity builds; thexad-ci-triggerdispatch now tests XAD changes only with the new options.Testing
tools/check-build-defaults.cmake,tools/check-ctest-per-suite.cmake,tools/check-pch-select.cmake); CI runs the first two after the Linux configure step. All configure variants also pass with the check scripts run by CMake 3.25 (the configures themselves used CMake 4.2).QuantLib master at cf74c9f65 with a fix for lambdas returning temporaries, XAD 2.2.0, AMD EPYC (Zen 5), GCC 15, one core per run, AD relative to
doublewith the same build settings:With a compiler that contracts to FMA by default (e.g. GCC targeting x86-64-v3, as here), the "Before" AD build also fails one test,
PiecewiseYieldCurveTests/testGlobalBootstrapInitialGuessFn; with the new defaults (-ffp-contract=off) it passes.