Research CommonsResearch Commons
cpptensor/Build options

Build options

The full set of cpptensor CMake toggles — build profiles, feature flags, sanitizers, and warning policy.

cpptensor exposes its configuration through CMake options. Pass them as -D<OPTION>=<VALUE> at configure time.

Build profiles

  • Profiles: Debug, Release, RelWithDebInfo.
  • Single-config generators default to RelWithDebInfo if CMAKE_BUILD_TYPE is omitted.

Target toggles

OptionDefaultDescription
CPPTENSOR_BUILD_TESTSOFFBuild the Catch2 test suite.
CPPTENSOR_BUILD_EXAMPLESOFFBuild example binaries.
CPPTENSOR_BUILD_BENCHMARKSOFFBuild Google Benchmark targets.

Backend feature flags

OptionDefaultDescription
USE_OPENBLASONBLAS-backed matmul/dot; required for svd/eig.
BUILD_AVX2autoAVX2-specialized kernels (fails if forced on unsupported targets).
BUILD_AVX512autoAVX-512-specialized kernels (same guardrail).
BUILD_CUDAOFFEarly CUDA support; forced OFF on Apple platforms.
USE_STD_SIMDDeclared in CMake but not currently wired as an active backend toggle.

Developer toggles

OptionDescription
CPPTENSOR_ENABLE_PROFILINGProfiling-friendly frame-pointer settings.
CPPTENSOR_ENABLE_LTOInterprocedural optimization for Release/RelWithDebInfo when supported.
CPPTENSOR_ENABLE_GPERFTOOLSLink example binaries with libprofiler when available.

Safety: warnings & sanitizers

OptionDescription
CPPTENSOR_ENABLE_STRICT_WARNINGSStricter warning profile on cpptensor-owned targets.
CPPTENSOR_WARNINGS_AS_ERRORSPromote warnings to errors.
CPPTENSOR_ENABLE_ASANAddressSanitizer.
CPPTENSOR_ENABLE_UBSANUndefinedBehaviorSanitizer.
CPPTENSOR_ENABLE_TSANThreadSanitizer.
Sanitizer constraints

Sanitizers support GCC/Clang-style toolchains. ASAN and TSAN are mutually exclusive, and sanitizer mode currently requires BUILD_CUDA=OFF.

Warning policy is compiler-specific and scoped to cpptensor-owned targets only:

  • GCC/Clang/AppleClang: -Wall -Wextra -Wpedantic -Wformat=2 -Wnull-dereference -Wnon-virtual-dtor
  • MSVC: /W4 /permissive-
  • With CPPTENSOR_WARNINGS_AS_ERRORS=ON, -Werror / /WX is added for the same scoped targets.

Example: sanitizer build

conda run -n cpptensor cmake -S . -B build-sanitize -G Ninja \
  -DCMAKE_BUILD_TYPE=Debug \
  -DCPPTENSOR_BUILD_TESTS=ON \
  -DBUILD_CUDA=OFF \
  -DUSE_OPENBLAS=OFF \
  -DCPPTENSOR_ENABLE_ASAN=ON \
  -DCPPTENSOR_ENABLE_UBSAN=ON
 
conda run -n cpptensor cmake --build build-sanitize -j
conda run -n cpptensor ctest --test-dir build-sanitize --output-on-failure

CI runs a sanitizer-warning-gate job that combines ASAN + UBSAN + strict warnings-as-errors and then runs the full CTest suite.