Skip to content

fix(llamacpp): make the default CUDA image build (slim toolkit + nvcc on PATH) - #1531

Open
mhotan wants to merge 1 commit into
mike/prefetch-hf-model-file-selectionfrom
mike/llamacpp-cuda-image-fixes
Open

fix(llamacpp): make the default CUDA image build (slim toolkit + nvcc on PATH)#1531
mhotan wants to merge 1 commit into
mike/prefetch-hf-model-file-selectionfrom
mike/llamacpp-cuda-image-fixes

Conversation

@mhotan

@mhotan mhotan commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Intent

flyteplugins.llamacpp's default build_llama_cpp_image() (CUDA mode) does not build on resource-constrained image builders. Both failures were found while driving a real GGUF GPU serve end-to-end on a live control plane; with these two fixes the default image compiles llama-server and the app serves an OpenAI-compatible /v1 on a GPU node.

What changed

  • Slim the CUDA install (_constants.py). cuda-toolkit-12-8 is a metapackage that drags in cuda-nsight-systems — a GUI profiler pulling Java/GTK/X11 (~2 GB) that a headless build never uses. It bloats the image and OOM-kills constrained builders mid-install. Replaced with the compile-only subset: cuda-nvcc-12-8 cuda-cudart-dev-12-8 cuda-driver-dev-12-8 libcublas-dev-12-8 libcurand-dev-12-8 (~2.8 GB).
  • Put nvcc on PATH for the build (_image.py). The image's PATH env (which includes $CUDA_HOME/bin) is applied after the cmake configure/build RUN steps, so nvcc isn't on PATH during the build and cmake fails with No CMAKE_CUDA_COMPILER could be found. Set PATH=$CUDA_HOME/bin:$PATH inline on the cmake configure and build commands.

How it was tested

Built the default image via build_llama_cpp_image() on a live dataplane and deployed a LlamaCppAppEnvironment (Qwen3.8-27B GGUF, single L40S). Before: the build failed at ~4 min (OOM during CUDA install) or immediately (No CMAKE_CUDA_COMPILER). After: the image compiles and the app reaches a live /v1 endpoint on the GPU node.

Note

Separately, flyteplugins-llamacpp isn't published to PyPI yet, so build_llama_cpp_image's with_pip_packages("flyteplugins-llamacpp", pre=True) can't resolve — a release is needed for the default image to be buildable off the shelf. (Worked around locally with a source wheel.)

Stack

Linear stack, merge in order: main#1528 (prefetch allow_patterns) ← #1531 (this PR) ← #1532 (fuse delivery). Based on #1528; #1532 needs this PR's image build fix to compile the CUDA image.

@mhotan
mhotan force-pushed the mike/llamacpp-cuda-image-fixes branch from e1819a8 to 66e641d Compare September 4, 2026 03:56
… on PATH)

build_llama_cpp_image's default CUDA image failed to build on constrained image builders,
for two independent reasons found driving a real GPU serve end to end:

1. Full `cuda-toolkit-12-8` metapackage. It drags in cuda-nsight-systems (a GUI profiler:
   Java/GTK/X11, ~2 GB) that a headless build never uses, bloating the image and OOM-killing
   resource-constrained builders mid-install. Replace it with the compile-only subset
   (cuda-nvcc + cudart/driver stubs + cuBLAS/cuRAND dev, ~2.8 GB).

2. `No CMAKE_CUDA_COMPILER could be found`. The image's PATH env (which includes
   $CUDA_HOME/bin, where nvcc lives) is applied *after* the cmake configure/build RUN steps,
   so nvcc is not on PATH during the build. Set PATH inline on the cmake configure and build
   commands.

With both fixes the default `build_llama_cpp_image()` compiles llama-server and the app serves
an OpenAI-compatible /v1 endpoint on a GPU node (verified on a live control plane).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Michael Hotan <mike@union.ai>
@mhotan
mhotan force-pushed the mike/llamacpp-cuda-image-fixes branch from 66e641d to fdfa9b6 Compare September 4, 2026 11:44
@mhotan
mhotan changed the base branch from main to mike/prefetch-hf-model-file-selection September 4, 2026 11:44
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