srdatalog.runtime

Bundled C++ runtime headers + vendored deps.

The Python codegen emits jit_batch_<rule>.cpp files that #include srdatalog.h (the bundled SRDatalog runtime). The runtime in turn includes boost / highway / RMM / spdlog (also bundled, under vendor/) plus CUDA SDK headers (NOT bundled — must come from a system NVIDIA install; auto-detected via find_cuda_root()).

runtime_include_paths() returns every -I path needed to compile batch files, EXCEPT the CUDA toolkit. Combine with cuda_include_paths() and cuda_compile_flags() for a full CompilerConfig:

from srdatalog import CompilerConfig
from srdatalog.runtime import (
  runtime_include_paths, cuda_include_paths,
  cuda_compile_flags, runtime_defines, runtime_undefines,
)

cfg = CompilerConfig(
  cxx="acpp",
  include_paths=runtime_include_paths() + cuda_include_paths(),
  defines=runtime_defines(),
  cxx_flags=cuda_compile_flags(),
)

Package Contents

Functions

cuda_compile_flags

CUDA-specific clang flags (-x cuda, --cuda-gpu-arch=, --cuda-path=). Combine with runtime_include_paths() + cuda_include_paths() for a full CompilerConfig.

cuda_include_paths

All -I paths a CUDA-enabled compile needs. Auto-detects via find_cuda_root() when cuda_root is None; raises RuntimeError if no toolkit is found.

cuda_libs

-l<libname> entries needed to satisfy the runtime’s CUDA symbol references (cudaMemcpyAsync, cuLaunchKernel, …) and the vendored boost libs whose ABI must match the vendored boost headers.

cuda_link_flags

-L paths the link step needs. Pair with cuda_libs().

find_cuda_root

Locate a usable CUDA toolkit. Tries (in order):

has_vendored_deps

True if boost/highway/rmm/spdlog headers are present under runtime/vendor/. False on a fresh clone — call srdatalog populate-vendor (or use the install hook) to fetch them.

runtime_defines

Preprocessor -D flags the runtime expects. Append to CompilerConfig.defines.

runtime_include_path

Absolute path to the bundled generalized_datalog/ headers. Kept for back-compat — prefer runtime_include_paths() (plural).

runtime_include_paths

All bundled C++ -I paths (runtime + vendored deps). CUDA paths are NOT included here — see cuda_include_paths().

runtime_undefines

Preprocessor -U undefines (paired with defines).

API

srdatalog.runtime.cuda_compile_flags(cuda_root: str | None = None, gpu_arch: str = 'sm_89') list[str][source]

CUDA-specific clang flags (-x cuda, --cuda-gpu-arch=, --cuda-path=). Combine with runtime_include_paths() + cuda_include_paths() for a full CompilerConfig.

srdatalog.runtime.cuda_include_paths(cuda_root: str | None = None) list[str][source]

All -I paths a CUDA-enabled compile needs. Auto-detects via find_cuda_root() when cuda_root is None; raises RuntimeError if no toolkit is found.

srdatalog.runtime.cuda_libs() list[str][source]

-l<libname> entries needed to satisfy the runtime’s CUDA symbol references (cudaMemcpyAsync, cuLaunchKernel, …) and the vendored boost libs whose ABI must match the vendored boost headers.

Boost is listed BEFORE cudart so that the static .a in the vendor dir wins over any system libboost_*.so on the -L search path.

-L paths the link step needs. Pair with cuda_libs().

srdatalog.runtime.find_cuda_root() str | None[source]

Locate a usable CUDA toolkit. Tries (in order):

  • $CUDA_HOME / $CUDA_PATH

  • NVIDIA HPC SDK: /opt/nvidia/hpc_sdk/.../cuda/<version>

  • Standard install: /usr/local/cuda, /opt/cuda

Among multiple HPC SDK CUDA versions, prefer one where thrust/optional.h exists — that header was removed in CUDA 13.0+ but RMM (bundled in vendor/) still needs it. So 12.9 is preferred over 13.0+ on machines that have both.

srdatalog.runtime.has_vendored_deps() bool[source]

True if boost/highway/rmm/spdlog headers are present under runtime/vendor/. False on a fresh clone — call srdatalog populate-vendor (or use the install hook) to fetch them.

srdatalog.runtime.runtime_defines() list[str][source]

Preprocessor -D flags the runtime expects. Append to CompilerConfig.defines.

ENABLE_LOGGING is intentionally NOT here — it pulls in boost::log and its phoenix/proto/spirit transitive deps (~50 MB of headers we don’t ship in the wheel). Opt in by appending "ENABLE_LOGGING" to your own defines AND supplying system boost::log headers via an additional -I path, e.g.::

cfg.defines.append("ENABLE_LOGGING")
cfg.include_paths.append("/usr/include")  # system boost
srdatalog.runtime.runtime_include_path() str[source]

Absolute path to the bundled generalized_datalog/ headers. Kept for back-compat — prefer runtime_include_paths() (plural).

srdatalog.runtime.runtime_include_paths() list[str][source]

All bundled C++ -I paths (runtime + vendored deps). CUDA paths are NOT included here — see cuda_include_paths().

Order matters: more-specific subdirs first so #include "../mir.h" resolves correctly via path arithmetic (e.g. build/../mir.h = mir.h).

srdatalog.runtime.runtime_undefines() list[str][source]

Preprocessor -U undefines (paired with defines).