Build from Source
This page documents reliable local build workflows for Python + native backend.
Requirements
Section titled “Requirements”- Python >= 3.12
- CMake >= 3.28 (optional)
- CUDA Toolkit (optional)
Recommended tools:
- uv for environment and packaging workflow
- Ninja or Make for faster CMake builds
Build Steps
Section titled “Build Steps”git clone https://github.com/vcholerae1/tide.gitcd tideuv buildThis builds the Python package and triggers native extension packaging.
Rebuild Native Backend Only (csrc)
Section titled “Rebuild Native Backend Only (csrc)”cmake -S src/tide/csrc -B build/csrc -DCMAKE_BUILD_TYPE=Releasecmake --build build/csrc -jIf needed, clean and rebuild:
rm -rf build/csrccmake -S src/tide/csrc -B build/csrc -DCMAKE_BUILD_TYPE=Releasecmake --build build/csrc -jNotes:
- Do not configure CMake inside
src/tide/csrcdirectly. - Backend CMake now rejects in-source builds by design.
Verify Build
Section titled “Verify Build”Use Python to verify native backend loading:
from tide import backend_utils
print(backend_utils.is_backend_available())print(backend_utils.get_library_path())Common environment variables and flags:
- CMAKE_BUILD_TYPE=Release for optimized kernels
- CMAKE_CUDA_ARCHITECTURES to pin target GPUs
- CC/CXX to select host compilers
Troubleshooting
Section titled “Troubleshooting”- Shared library not found:
- rebuild backend and confirm output path under src/tide
- CUDA symbols missing:
- verify PyTorch CUDA build and CUDA toolkit compatibility
- Compiler mismatch:
- use consistent host compiler versions for C++ and CUDA toolchains
Editable development environment
Section titled “Editable development environment”uv sync --group devuv run python -c "import tide; print(tide.__version__)"uv run pytest -q tests/test_public_api.pyThe package uses scikit-build-core and cibuildwheel. A wheel build packages
Python sources and the native library for the target platform. An editable
environment is useful for Python changes, but rebuild the native target after
changing C, C++, CUDA, CMake, or ABI declarations.
CPU-only native build
Section titled “CPU-only native build”When CUDA is not required, configure a clean build directory with the compiler toolchain visible to CMake. Inspect the configure summary to confirm that CUDA was disabled intentionally rather than missed unexpectedly.
After building, test both library loading and a small forced-native CPU
propagation. is_backend_available() alone proves only that a shared library
loaded.
CUDA architecture selection
Section titled “CUDA architecture selection”Set CMAKE_CUDA_ARCHITECTURES to the deployment GPU architectures when
building CUDA kernels:
cmake -S src/tide/csrc -B build/csrc \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CUDA_ARCHITECTURES=89cmake --build build/csrc -jA library can load successfully and still lack code for the current GPU. Record the selected architecture list with released wheels and benchmark artifacts.
Focused verification
Section titled “Focused verification”Use a staged build check:
uv run pytest -q tests/test_public_api.pyuv run pytest -q tests/test_forward_physics.pyuv run pytest -q tests/test_backend_parity_matrix.pyOn a CUDA machine, add the CUDA-marked parity cases. On CPU-only hosts, skipped CUDA tests are expected but do not verify CUDA packaging.
Diagnosing loader errors
Section titled “Diagnosing loader errors”When the library path exists but loading fails:
- Inspect the original loader exception.
- Check unresolved system dependencies for the shared library.
- Confirm Python architecture matches the compiled library.
- Confirm compiler runtime and C++ ABI compatibility.
- Confirm CUDA runtime dependencies are available for a CUDA build.
- Rebuild from a clean out-of-source directory after toolchain changes.
Do not copy a shared library from another environment unless its platform, Python package layout, compiler ABI, and CUDA targets are known to match.