diff --git a/Dockerfile b/Dockerfile index 2f1a17b00..2e6ef4896 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,8 +49,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake ninja-build libjpeg-dev libpng-dev ca-certificates \ libopenmpi-dev libopenblas-dev\ libnccl2=2.22.3-1+cuda12.6 \ - libnccl-dev=2.22.3-1+cuda12.6 && \ - python3 -m pip install --no-cache-dir --upgrade pip wheel setuptools + libnccl-dev=2.22.3-1+cuda12.6 \ + curl xz-utils \ + && python3 -m pip install --no-cache-dir --upgrade pip wheel setuptools # ── 安装自编 torch 轮子 ────────────────────────────────────────────────────── COPY --from=builder-torch /opt/pytorch/dist /tmp/torch_dist @@ -97,18 +98,38 @@ RUN python3 -m pip install ".[srt,openai]" --no-build-isolation && \ # # ── 🔄 下载 sgl-kernel(与 sglang 同步)─────────────────────────────────────── # RUN pip download --only-binary=:all: --no-deps sgl-kernel==0.3.9.post2 -d /tmp/sgl_kernel_wheels +ENV PATH=/usr/local/cuda/bin:${PATH} + # ── 用你本地源码编 sgl-kernel==0.3.9.post2(与自编 torch 完全 ABI 对齐) ────── WORKDIR /sgl/sglang/sgl-kernel + +# 覆盖安装 ptxas 12.8(保留 nvcc 12.6),并打印版本确认 +RUN bash -lc '\ + set -euo pipefail; \ + NVCC_ARCHIVE_VERSION=12.8.93; \ + T=cuda_nvcc-linux-x86_64-${NVCC_ARCHIVE_VERSION}-archive; \ + curl -fsSLO https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/linux-x86_64/${T}.tar.xz && \ + tar -xf ${T}.tar.xz && \ + install -m 0755 ${T}/bin/ptxas /usr/local/cuda/bin/ptxas && \ + /usr/local/cuda/bin/ptxas --version \ +' + +# 限制构建并行;避免 ptxas 多线程崩溃 +ENV CMAKE_BUILD_PARALLEL_LEVEL=8 +ENV SGL_KERNEL_COMPILE_THREADS=1 + +# 构建 sgl-kernel(保持 FA3;去掉无效的关 90a 标志) RUN python3 -m pip install --no-cache-dir "cmake>=3.27,<4.0" scikit-build-core==0.11.6 pybind11[global] packaging && \ bash -lc '\ export CMAKE_PREFIX_PATH="$(python3 -c "import torch; print(torch.utils.cmake_prefix_path)")" && \ - # 这些卡就够了:A100(80), 3090(86), 4090(89)。别碰 90a。 export TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9" && \ export CUDAARCHS="80;86;89" && \ export CMAKE_CUDA_ARCHITECTURES="$CUDAARCHS" && \ - # 同时把它塞进 CMAKE_ARGS;不认识的开关会被忽略,不会报错 - export CMAKE_ARGS="-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_CUDA_ARCHITECTURES=$CUDAARCHS -DFA3_WITH_SM90A=OFF -DSGLK_DISABLE_SM90A=ON" && \ - python3 -m pip wheel . --no-deps --no-build-isolation -w /tmp/sgl_kernel_wheels' + # 这里保留常规参数;如果项目支持,也把内核编译线程设为 1(未知项将被忽略,不会报错) + export CMAKE_ARGS="-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_CUDA_ARCHITECTURES=$CUDAARCHS -Ccmake.define.SGL_KERNEL_COMPILE_THREADS=1" && \ + python3 -m pip wheel . --no-deps --no-build-isolation -w /tmp/sgl_kernel_wheels \ + ' + # ── 收集所有 wheel 到 /wheels ──────────────────────────────────────────────