|
CDT++
Causal Dynamical Triangulations in C++
|
Quantize spacetime on your laptop.
For an introduction to Causal Dynamical Triangulations, including the foundations and recent results, please see the wiki.
Causal Dynamical Triangulations in C++ uses the Computational Geometry Algorithms Library, Boost, TBB, and Eigen. Arbitrary-precision numbers and functions are by MPFR and GMP. Melissa E. O'Neill's Permuted Congruential Generators library provides high-quality RNGs that pass L'Ecuyer's TestU01 statistical tests. doctest provides BDD/TDD. vcpkg provides library management and building. Doxygen provides automated document generation. {fmt} provides a safe and fast alternative to iostream. spdlog provides fast, multithreaded logging. PVS-Studio and CodeQL provide commercial-grade static analysis and security checks. CometML provides machine learning for model building.
iostream)This project uses CMake+Ninja to build and vcpkg to manage C++ libraries. Using C++20 features, it successfully builds with AppleClang-14, gcc-12, clang-15, and Visual Studio 2019.
If you use [Docker]:
Binaries will be in /CDT-plusplus/build/src. Proceed to Use.
On macOS or Linux, you will first need to install some prerequisites using your favorite package manager (e.g. homebrew or apt):
Next, install [vcpkg]:
vcpkg is then invoked by CMake in vcpkg manifest mode and install the project dependencies listed in vcpkg.json into a local vcpkg_installed directory.
Proceed to Build.
You'll need a reasonably modern compiler that supports C++20 features.
Clone the repo:
To get CMake and the build scripts to run correctly, you'll need to set $VCPKG_ROOT to wherever you cloned vcpkg, e.g.
This will set the CMAKE_TOOLCHAIN_FILE option for CMake.
You may also need to set VCPKG_DEFAULT_TRIPLET to your platform triplet, e.g.
You can optionally pre-build the project dependencies (100+ packages) by running at the top level of the project:
At this point, you can build via the scripts in scripts, which will build the project and install the dependencies into vcpkg_installed.
The project is similar to PitchFork Layout, as follows:
Run one of the following in scripts, depending on your operating system and environment:
Release mode - fast-build.sh or fast-build.batRelWithDebInfo mode - build.sh or build.batslurm.shdebug.sh (this will take some time, ~280 seconds on my current laptop)This should result in the main program executable, cdt in build/src or build\Debug, along with several others.
cdt-opt is a simplified version with hard-coded inputs, mainly useful for debugging and scriptingcdt-viewer (macOS only) is a simple Qt-based viewer for the output of cdtinitialize is used by CometML to run parameter optimizationCDT-plusplus uses program_options to parse options from the help message, and so understands long or short argument formats, provided the short argument given is an unambiguous match to a longer one. The help message should be instructive:
The dimensionality of the spacetime is such that each slice of spacetime is d-1-dimensional, so setting d=3 generates 2 spacelike dimensions and one timelike dimension, with a defined global time foliation. A d-dimensional simplex will have some d-1 sub-simplices that are purely spacelike (all on the same timeslice) as well as some that are timelike (span two timeslices). In CDT we actually care more about the timelike links (in 2+1 spacetime), and the timelike faces (in 3+1 spacetime).
Online documentation is at https://adamgetchell.org/CDT-plusplus/.
If you have Doxygen installed you can generate the same information locally using the configuration file in docs\Doxyfile by simply typing at the top level directory (Doxygen will recursively search):
This will generate a docs/html/ directory containing documentation generated from CDT++ source files. USE_MATHJAX has been enabled in Doxyfile so that the LaTeX formulae can be rendered in the html documentation using MathJax. HAVE_DOT is set to YES which allows various graphs to be autogenerated by Doxygen using GraphViz. If you do not have GraphViz installed, set this option to NO (along with UML_LOOK).
In the scripts directory, run build.sh or build.bat depending on your operating system.
Unit tests run (in build/tests or build\tests\Debug) via CDT_unit_tests, the doctest executable:
or (Windows):
You can also run both CTest integration and doctest unit tests in the build directory with:
or (Windows):
In addition to the command line output, you can see detailed results in the build/Testing directory which is generated thereby.
Deactivate Unit tests with -D ENABLE_TESTING:BOOL=FALSE, e.g. scripts/fast-build.sh.
This project follows the CppCore Guidelines as enforced by ClangTidy, which you can install and then run using the clang-tidy.sh script:
(Or use your favorite linter plugin for your editor/IDE.)
The cppcheck.sh script runs a quick static analysis using cppcheck.
Clang comes with scan-build which can run a much more thorough, but slower static analysis integrated with CMake and Ninja.
PVS-Studio - static analyzer for C, C++, C#, and Java code.
AddressSanitizer + UndefinedBehaviorSanitizer, LeakSanitizer, MemorySanitizer, and ThreadSanitizer are run with scripts/asan.sh, scripts/lsan.sh, scripts/msan.sh, and scripts/tsan.sh. They are also checked by Travis-CI during commits.
CometML is used to record Experiments which conduct Model Optimization. The script to do this is optimize-initialize.py. In order for this to work, you must install the following into your Python virtual environment.
You can then run experiments and look at results on https://www.comet.ml!
Qt is used to visualize 3D triangulations via cdt-viewer.
Please see CONTRIBUTING.md and our CODE_OF_CONDUCT.md.
Your code should pass Continuous Integration:
git diff --check HEAD^)Optional: