Guest User

Untitled

a guest
Sep 15th, 2026
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.40 KB | None | 0 0
  1. # Pennyroyal (jpezzulli/sglang-rtxpro6000): patched SGLang for Qwen3.8
  2. # Flash-Next + 27B/DFlash2 on a single RTX PRO 6000 Blackwell (SM120, TP=1).
  3. #
  4. # There is no prebuilt Pennyroyal image -- the repo's docker/ dir is
  5. # upstream SGLang's generic material, which the README explicitly says is
  6. # NOT a qualified Pennyroyal recipe. So this containerizes the native
  7. # BUILD.md source build: SGLang (editable, -e python) + NIXL POSIX plugin
  8. # (for HiCache/NIXL KV persistence), both compiled from source against a
  9. # consistent CUDA 13.3 toolchain.
  10. #
  11. # Heavy build: compiles sglang-kernel, FlashInfer and NIXL from source
  12. # (tens of minutes). Base is 13.3 to match BUILD.md's qualified CUDA.
  13. FROM nvidia/cuda:13.3.1-devel-ubuntu24.04
  14.  
  15. ENV DEBIAN_FRONTEND=noninteractive
  16.  
  17. # gcc-15 / g++-15 are the qualified host compilers (BUILD.md). Ubuntu 24.04
  18. # ships gcc-13, so pull 15 from the ubuntu-toolchain-r test PPA. Also the
  19. # NIXL build deps (cmake/meson/ninja/pkg-config/libaio-dev) and Rust.
  20. RUN apt-get update && apt-get install -y --no-install-recommends \
  21. software-properties-common ca-certificates curl git \
  22. && add-apt-repository -y ppa:ubuntu-toolchain-r/test \
  23. && apt-get update && apt-get install -y --no-install-recommends \
  24. gcc-15 g++-15 \
  25. python3.12 python3.12-venv python3.12-dev \
  26. cmake meson ninja-build pkg-config libaio-dev \
  27. && rm -rf /var/lib/apt/lists/*
  28.  
  29. # Rust via rustup, NOT apt. Pennyroyal's rust/Cargo.toml is `edition =
  30. # "2024"` (needs Rust >= 1.85); Ubuntu 24.04's apt rustc is 1.75 and fails
  31. # with "failed to parse manifest". Qualified table lists Rust 1.97.1.
  32. RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
  33. | sh -s -- -y --default-toolchain 1.97.1 --profile minimal
  34. ENV PATH=/root/.cargo/bin:$PATH
  35.  
  36. # uv (BUILD.md uses it for the pinned python + editable install).
  37. RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh
  38.  
  39. ENV CUDA_HOME=/usr/local/cuda \
  40. CUDACXX=/usr/local/cuda/bin/nvcc \
  41. CC=/usr/bin/gcc-15 CXX=/usr/bin/g++-15 CUDAHOSTCXX=/usr/bin/g++-15 \
  42. TORCH_CUDA_ARCH_LIST=12.0 \
  43. PENNY_BUILD_JOBS=4
  44.  
  45. WORKDIR /opt
  46.  
  47. # --- SGLang (Pennyroyal branch) --------------------------------------------
  48. ARG PENNY_TAG=pennyroyal-v2.5.0
  49. RUN git clone --branch ${PENNY_TAG} --single-branch \
  50. https://github.com/jpezzulli/sglang-rtxpro6000.git pennyroyal
  51. WORKDIR /opt/pennyroyal
  52. RUN uv python install 3.12.13 \
  53. && uv venv --python 3.12.13 .venv
  54. ENV VIRTUAL_ENV=/opt/pennyroyal/.venv PATH=/opt/pennyroyal/.venv/bin:$PATH
  55. # --no-build-isolation means every build-time dep must already be present.
  56. # wheel_stub: NVIDIA cuda-tile/cuda-* wheels' build backend.
  57. # pybind11 / patchelf / meson-python / pyyaml: NIXL's meson build resolves
  58. # `dependency('pybind11')` and the meta-wheel packaging against the venv.
  59. RUN uv pip install pip "setuptools>=80.9.0" "setuptools-rust>=1.10" \
  60. "setuptools-scm>=8.0" wheel build tomlkit wheel_stub \
  61. pybind11 patchelf meson-python pyyaml pytest
  62. # --- NIXL POSIX plugin (for HiCache/NIXL) ----------------------------------
  63. # Built BEFORE the SGLang editable install: NIXL's meson build spawns an
  64. # isolated `uv build --wheel` for its python bindings, and if SGLang's
  65. # editable `__editable__.sglang*.pth` is already on the venv, that
  66. # sitecustomize hook runs in the sub-build with a broken sys.path and dies
  67. # with a bogus `ModuleNotFoundError: No module named 'traceback'`. Building
  68. # NIXL first (clean venv) sidesteps it. asio's meson wrap has a GitHub
  69. # fallback URL, so the retry loop rides out the sourceforge flake.
  70. ARG NIXL_COMMIT=aecbc3846d92c34c7507a58d776e1fda50ff4fba
  71. ENV NIXL_PREFIX=/opt/nvidia/nvda_nixl
  72. RUN git clone https://github.com/ai-dynamo/nixl.git /opt/nixl \
  73. && cd /opt/nixl && git checkout ${NIXL_COMMIT} \
  74. && python -m pip install . \
  75. && ./contrib/tomlutil.py --wheel-name nixl-cu13 pyproject.toml \
  76. && for i in 1 2 3 4 5; do \
  77. meson setup build-posix --buildtype=release \
  78. --prefix="$NIXL_PREFIX" --libdir=lib64 \
  79. -Denable_plugins=POSIX -Dnixl_cuda_arch_list=120 \
  80. && ninja -C build-posix -j ${PENNY_BUILD_JOBS} install && break; \
  81. echo "nixl attempt $i failed, retrying in 15s"; rm -rf build-posix; sleep 15; \
  82. done \
  83. && python -m pip install build-posix/src/bindings/python/nixl-meta/nixl-*-py3-none-any.whl
  84. ENV LD_LIBRARY_PATH=$NIXL_PREFIX/lib64
  85.  
  86. # --- SGLang editable install (LAST, so its .pth can't break NIXL's build) --
  87. # UV_HTTP_TIMEOUT: the default 30 s times out on the big wheels (triton,
  88. # nccl ~200 MB) on a slow link. Retry loop rides out transient network
  89. # drops -- uv's cache makes each retry resume, not restart.
  90. RUN export MAX_JOBS=$PENNY_BUILD_JOBS \
  91. CMAKE_BUILD_PARALLEL_LEVEL=$PENNY_BUILD_JOBS \
  92. CARGO_BUILD_JOBS=$PENNY_BUILD_JOBS \
  93. FLASHINFER_NINJA_JOBS=$PENNY_BUILD_JOBS \
  94. FLASHINFER_NVCC_THREADS=1 \
  95. TORCHINDUCTOR_COMPILE_THREADS=$PENNY_BUILD_JOBS \
  96. UV_HTTP_TIMEOUT=600 \
  97. && for i in 1 2 3 4 5; do \
  98. uv pip install --prerelease=allow --index-strategy unsafe-best-match \
  99. --extra-index-url https://docs.sglang.ai/whl/cu130/ \
  100. --no-build-isolation -e python && break; \
  101. echo "attempt $i failed, retrying in 15s"; sleep 15; \
  102. done
  103.  
  104. # libssl-dev: HiCache JIT-compiles a C++ hash extension (hicache_hash_cpp)
  105. # at first cached-request time, which #include's <openssl/sha.h>. Runtime
  106. # openssl is present but not its headers. Added as a LATE layer so the
  107. # expensive NIXL + SGLang compile layers above stay cached.
  108. RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev \
  109. && rm -rf /var/lib/apt/lists/*
  110.  
  111. # Optional NVMe-PLE reader (ssd_stream, a Rust package). Streams the 47.7
  112. # GiB PLE table from a prepared on-disk overlay instead of holding it in
  113. # host shmem, which frees ~50 GiB of host RAM. Built into .ple-nvme;
  114. # activated at launch with PENNY_PLE_BACKEND=nvme + PENNY_PLE_NVME_MODEL.
  115. # Late layer so it does not invalidate the big compile layers.
  116. RUN PYTHON=/opt/pennyroyal/.venv/bin/python \
  117. bash /opt/pennyroyal/tools/ple_nvme/install.sh
  118.  
  119. WORKDIR /opt/pennyroyal
  120. # Launchers read TARGET_MODEL / CACHE_BASE / NIXL_STORAGE_BASE from env and
  121. # run sglang; invoke the FR-Spec Flash-Next launcher as the entrypoint.
  122. ENTRYPOINT ["bash", "configs/pennyroyal/serve-flash-next-frspec.sh"]
  123.  
Advertisement
Add Comment
Please, Sign In to add comment