Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion plugins/llamacpp/src/flyteplugins/llamacpp/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
LLAMA_SERVER_BINARY = f"{LLAMA_CPP_INSTALL_DIR}/build/bin/llama-server"

CUDA_HOME = "/usr/local/cuda-12.8"
CUDA_TOOLKIT_PACKAGE = "cuda-toolkit-12-8"
# Compile-only CUDA subset for a headless llama.cpp (GGML_CUDA=ON) build: nvcc + the
# cudart/driver stubs + cuBLAS/cuRAND dev headers. The full `cuda-toolkit-12-8`
# metapackage also pulls in a GUI profiler and its desktop toolchain (~2 GB) that a
# headless build never uses, needlessly bloating the image and its build.
CUDA_TOOLKIT_PACKAGE = "cuda-nvcc-12-8 cuda-cudart-dev-12-8 cuda-driver-dev-12-8 libcublas-dev-12-8 libcurand-dev-12-8"
# CUDA stubs let the linker resolve libcuda.so on GPU-less build machines; the real
# driver library is injected by the container runtime on the serving node.
CUDA_STUB_LIB = f"{CUDA_HOME}/lib64/stubs"
Expand Down
5 changes: 4 additions & 1 deletion plugins/llamacpp/src/flyteplugins/llamacpp/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def build_llama_cpp_image(
]
)
cmake_configure = (
# nvcc lives at $CUDA_HOME/bin; the image's PATH env is applied after these
# build RUNs, so set it inline or cmake reports "No CMAKE_CUDA_COMPILER".
f"PATH={CUDA_HOME}/bin:$PATH "
f"LIBRARY_PATH={CUDA_STUB_LIB}:$LIBRARY_PATH "
f"cmake -S {LLAMA_CPP_INSTALL_DIR} -B {LLAMA_CPP_INSTALL_DIR}/build "
"-DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON "
Expand Down Expand Up @@ -127,7 +130,7 @@ def build_llama_cpp_image(
# fatal EBADENGINE; override it so install proceeds (Node here satisfies
# the UI's real Vite requirement).
_run_script(
f"PATH={NODE_HOME}/bin:$PATH npm_config_engine_strict=false "
f"PATH={NODE_HOME}/bin:{CUDA_HOME}/bin:$PATH npm_config_engine_strict=false "
f"{cmake_build_prefix}"
f"cmake --build {LLAMA_CPP_INSTALL_DIR}/build --config Release "
"-j $(nproc) --target llama-server"
Expand Down