runpod: engines image on the light core — 2.4 GB instead of 9.1

The engines are C binaries and coderai only drives them; the full core's
torch was dead weight. All they link is the CUDA runtime and cuBLAS,
which NVIDIA ships as wheels at the 12.8 they were compiled against.
Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0182DhR1eFNPQyGmDrpHbedY
parent 643b78fe
......@@ -192,6 +192,9 @@ and the local colibri has no GPU backend at all — neither would run on an A100
The image builds them in a CUDA 12.8 toolchain stage for every generation RunPod
rents (sm_80 A100, sm_86, sm_89 L40S/4090, sm_90 H100, sm_120a RTX 50 / RTX PRO
Blackwell) and a portable x86-64-v3 CPU baseline, then keeps only the binaries.
The runtime side is the light core plus NVIDIA's cuda-runtime and cuBLAS 12.8
wheels — the engines are C, coderai only drives them, so there is no torch in
it: 2.4 GB, the smallest capability image.
```bash
./packaging/runpod/build_capability_image.sh engines ghcr.io/nextime/coderai-engines:0.2.18
......
......@@ -9,13 +9,14 @@
# Blackwell) and for a portable x86-64-v3 CPU baseline — then keeps only the
# binaries and the scripts beside them. The toolchain never reaches the image.
#
# The runtime side is the ordinary full core: torch's cu128 wheels carry the
# libcudart.so.12 / libcublas.so.12 the engines link, so nothing else is added.
# The runtime side is the LIGHT core (no torch — coderai only drives these
# binaries) plus NVIDIA's cuda-runtime and cublas 12.8 wheels, the only
# libraries the engines link. About 2 GB instead of 9.
#
# Built by build_capability_image.sh engines, which first stages the engine
# source trees into packaging/runpod/engines-src/ (they live outside the repo).
ARG CORE_BASE=coderai-capability-base:latest
ARG CORE_BASE=coderai-capability-base-light:latest
ARG CUDA_DEVEL=nvidia/cuda:12.8.1-devel-ubuntu24.04
# ---------------------------------------------------------------- build stage
......@@ -81,7 +82,9 @@ WORKDIR /opt/coderai/app
COPY packaging/runpod/profiles/ /tmp/profiles/
RUN --mount=type=cache,target=/root/.cache/pip set -eux; \
python -m pip install --extra-index-url ${TORCH_INDEX} -r /tmp/profiles/${PROFILE}.txt; \
python -c "import torch; print('torch', torch.__version__, 'cuda', torch.version.cuda)"; \
if python -c "import torch" 2>/dev/null; then \
echo "ERROR: engines is a light-core image but torch reached its main venv" >&2; exit 1; \
fi; echo "main venv: no torch (light core, as intended)"; \
rm -rf /tmp/profiles
COPY --from=engines /out/ds4/ /opt/coderai/ds4/
......@@ -89,7 +92,7 @@ COPY --from=engines /out/colibri/ /opt/coderai/colibri/
COPY --from=engines /out/kimi-k3-in-c/ /opt/coderai/kimi-k3-in-c/
# Where the workers look (codai/api/{ds4,colibri,k3}_worker.default_install_dir),
# and the CUDA runtime the engines link, from torch's own wheels.
# and the CUDA runtime the engines link, from NVIDIA's wheels.
ENV CODERAI_DS4_DIR=/opt/coderai/ds4 \
CODERAI_COLIBRI_DIR=/opt/coderai/colibri \
CODERAI_K3_DIR=/opt/coderai/kimi-k3-in-c \
......
......@@ -4,9 +4,15 @@
#
# The engines are not pip packages: they are compiled in a CUDA 12.8 toolchain
# stage of Dockerfile.capability-engines (see the `engines.dockerfile` marker)
# for EVERY pod GPU generation (sm_80/86/89/90/120), not the one card this
# machine has, and copied in beside their download scripts. The Python side
# needs nothing beyond the core: the engines bring their own tokenizers.
# for EVERY pod GPU generation (sm_80/86/89/90/120a), not the one card this
# machine has, and copied in beside their download scripts.
#
# LIGHT core: the engines are C binaries and coderai only drives them, so the
# 5 GB of torch in the full core would be dead weight. All they link is the
# CUDA runtime and cuBLAS, which NVIDIA ships as wheels — 12.8 to match the
# toolchain they were compiled with. The engines bring their own tokenizers.
nvidia-cuda-runtime-cu12==12.8.90
nvidia-cublas-cu12==12.8.4.1
#
# THE WEIGHTS ARE THE COST. DeepSeek-V4 is ~154 GB, Kimi-K3 is measured in
# terabytes. Put them on a network volume (docs/runpod.md, "Engine pods") —
......
......@@ -980,6 +980,7 @@ def test_the_engines_image_is_built_from_source_for_every_pod_gpu():
for arch in ("sm_80", "sm_86", "sm_89", "sm_90", "sm_120"):
assert arch in df
assert "CUDA_ARCH=portable" in df and "x86-64-v3" in df
assert "base-light" in df, "the engines are C: no torch needed"
assert "patch-k3.py" in df and "not found" in df
for var in ("CODERAI_DS4_DIR", "CODERAI_COLIBRI_DIR", "CODERAI_K3_DIR"):
assert var in df
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment