Skip to content

Enable CUDA in colgrep Linux release builds#48

Merged
raphaelsty merged 1 commit intomainfrom
feat/colgrep-cuda-linux
Mar 17, 2026
Merged

Enable CUDA in colgrep Linux release builds#48
raphaelsty merged 1 commit intomainfrom
feat/colgrep-cuda-linux

Conversation

@raphaelsty
Copy link
Collaborator

Summary

  • Add cuda feature to Linux x86_64 colgrep release builds (alongside existing mkl)
  • Install CUDA toolkit 12.4 on CI runner for compile-time headers
  • No user-facing change needed — same curl | sh install, CUDA just works if GPU is present

How it works

cudarc uses dynamic-linking — the binary calls dlopen("libcuda.so") at runtime:

  • GPU machine: CUDA loads successfully, indexing uses GPU acceleration (2-15x faster)
  • CPU machine: dlopen fails in microseconds, result cached in OnceLock, all subsequent calls return None instantly — zero overhead

Single binary, works everywhere

Machine Encoding Indexing Search
NVIDIA GPU + CUDA toolkit GPU GPU CPU (MKL)
CPU-only server CPU CPU CPU (MKL)
Laptop without GPU CPU CPU CPU (MKL)

Test plan

  • Verify Linux release build compiles with cuda,mkl features
  • Verify binary runs on CPU-only machine (no crash, no slowdown)
  • Verify binary uses CUDA on GPU machine

🤖 Generated with Claude Code

Add cuda feature to the Linux x86_64 release build alongside mkl.
Since cudarc uses dynamic-linking, the binary loads CUDA libs at
runtime via dlopen. On machines without CUDA, init fails once
(microseconds) and all subsequent calls return cached None — zero
overhead. This means a single binary works everywhere:

- With NVIDIA GPU + CUDA toolkit: full GPU acceleration
- Without GPU: silent CPU fallback, no performance penalty

Also installs CUDA toolkit on the Linux CI runner since cudarc's
build script needs headers at compile time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@raphaelsty raphaelsty merged commit 901b189 into main Mar 17, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant