Skip to content

Commit fc86bc4

Browse files
wlejonclaude
andcommitted
cuda: static-link the CUDA runtime (cudart_static)
Link CUDA::cudart_static instead of the dynamic cudart. The whole AI tower links into a single executable, so there is exactly one cudart instance and no per-module context split. The shipped binary then carries no cudart DLL dependency and launches on machines with no CUDA toolkit installed: the driver stub is loaded lazily, reports no device, and inference falls back to CPU. One build runs everywhere — GPU when present, CPU otherwise. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 576efff commit fc86bc4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,12 @@ if(BROTENSOR_WITH_CUDA)
300300
src/cuda/filtered_lrelu.cu
301301
src/cuda/register.cu
302302
)
303-
target_link_libraries(brotensor_cuda PUBLIC brotensor_core CUDA::cudart)
303+
# Static CUDA runtime: keeps the shipped binary self-contained. The tower
304+
# links into a single executable, so there is exactly one cudart instance —
305+
# no multi-module context split. On a machine with no NVIDIA driver the
306+
# lazily-loaded driver stub simply reports no device and init.cpp falls back
307+
# to CPU, so one build runs everywhere (GPU when present, CPU otherwise).
308+
target_link_libraries(brotensor_cuda PUBLIC brotensor_core CUDA::cudart_static)
304309
target_compile_definitions(brotensor_cuda PUBLIC
305310
BROTENSOR_HAS_CUDA=1 BROTENSOR_HAS_GPU=1)
306311
# brotensor_core's init.cpp must know whether to probe + register CUDA.

0 commit comments

Comments
 (0)