|
ADOL-C: Automatic Differentiation in C/C++ 2.7.3
|
Read the ADOL-C developer guide before, and search existing issues and pull requests before starting. Discuss API changes, new dependencies, and tape-format changes in an issue first. Keep unrelated cleanup in separate pull requests.
ADOL-C requires CMake 3.19+ and a C++20 compiler: GCC 11+, Clang 13+, or MSVC 19.31+. Tests require Boost and OpenMP. Sparse builds require ColPack and OpenMP; CMake fetches ColPack unless ColPack_DIR selects an installed package.
Omit BUILD_INTERFACE and ENABLE_SPARSE during development if the change does not affect them. Check the relevant optional builds before submitting.
List Boost.Test cases or run one case or suite:
For memory checks with GCC or Clang:
The pull request test workflow also runs Valgrind.
Document public APIs in the headers with Doxygen comments. State dimensions, ownership, preconditions, and threading restrictions. Avoid comments that repeat the code.
Install Doxygen and Graphviz, then build:
The docs target compiles and runs each displayed example before generating HTML. Examples must check their results, return nonzero on failure, and print stable output. Register new examples in ADOL-C/doc/doxygen/CMakeLists.txt. Keep Doxyfile.in in Doxygen's generated layout.
Use these conventions for new or substantially rewritten code. Preserve public API names and avoid unrelated legacy rewrites.
| Entity | Convention | Example |
|---|---|---|
| types and template type parameters | UpperCamelCase | TapeEvaluationContext, BufferType |
| functions, variables, and parameters | lowerCamelCase | createNewTape(), tapeId |
| private data members | lowerCamelCase_ | innerTapeId_ |
| constants and scoped-enum values | lowerCamelCase | reverseDegree |
| macros | UPPER_SNAKE_CASE | CURRENT_LOCATION |
Use established abbreviations such as fos, hov, loc, and tay where appropriate. Otherwise, choose descriptive names. You might encounter legacy code that does not follow these instructions.
std::span for borrowed ranges. Retain pointer-plus-dimension APIs where compatibility requires them.std::unique_ptr for exclusive ownership and std::shared_ptr for shared ownership if it does not hurt the performance significantly. Manage memory, files, tape state, and locks through RAII.constexpr, concepts, templates, and static dispatch when they remove repeated work or prevent invalid states. Keep simple run-time code when it is clearer and does not hurt performance significantly. Measure changes to recording and sweep loops.if constexpr for type-dependent branches and enum class for states. Avoid boolean arguments if possible.const.noexcept only when the function cannot throw.The formatting workflow uses clang-format 19.1.3. Format changed C/C++ files:
Do not run clang-format on Markdown, CMake, or Doxygen configuration files. Review formatting changes before committing.
Enable clang-tidy for the library target with:
The codebase has existing clang-tidy warnings. Avoid new warnings in changed files and keep broader cleanup separate.
| Area | Location |
|---|---|
| Taped operators | ADOL-C/boost-test/traceOperator*.cpp |
| Tapeless operators | ADOL-C/boost-test/traceless*.cpp |
| Tape ownership, buffers, concurrency | ADOL-C/boost-test/valuetape |
| Sparse recovery | ADOL-C/boost-test/sparse |
| Higher-order reverse | ADOL-C/boost-test/ho_rev |
| Documentation examples | ADOL-C/doc/doxygen/examples |
| Package examples | ADOL-C/examples |
Add a regression test for each bug fix. Cover every supported forward and reverse mode for new active operations. Tape and buffer changes need in-memory, file-backed, ownership, and exception coverage. Use deterministic synchronization in concurrency tests. Sparse changes need pattern and numerical recovery checks.
ADOL-C treats compiler warnings as errors. Test Debug and Release when initialization, assertions, or optimization affect the result.
Describe the problem, resulting behavior, validation, and compatibility changes in the pull request.