Skip to content

Commit 643bca5

Browse files
author
Weichao Luo
committed
fix dp.
1 parent 2370548 commit 643bca5

9 files changed

Lines changed: 224 additions & 98 deletions

File tree

Dockerfile.nixl

Lines changed: 0 additions & 89 deletions
This file was deleted.

docker/Dockerfile.nixl

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
ARG CUDA_VERSION=12.6.1
2+
FROM nvidia/cuda:${CUDA_VERSION}-cudnn-devel-ubuntu22.04
3+
ARG PYTHON_VERSION=3.10
4+
ARG MAMBA_VERSION=24.7.1-0
5+
ARG TARGETPLATFORM
6+
ENV PATH=/opt/conda/bin:$PATH \
7+
CONDA_PREFIX=/opt/conda
8+
9+
RUN chmod 777 -R /tmp && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
10+
ca-certificates \
11+
libssl-dev \
12+
curl \
13+
g++ \
14+
make \
15+
git && \
16+
rm -rf /var/lib/apt/lists/*
17+
18+
RUN case ${TARGETPLATFORM} in \
19+
"linux/arm64") MAMBA_ARCH=aarch64 ;; \
20+
*) MAMBA_ARCH=x86_64 ;; \
21+
esac && \
22+
curl -fsSL -o ~/mambaforge.sh -v "https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-${MAMBA_ARCH}.sh" && \
23+
bash ~/mambaforge.sh -b -p /opt/conda && \
24+
rm ~/mambaforge.sh
25+
26+
RUN case ${TARGETPLATFORM} in \
27+
"linux/arm64") exit 1 ;; \
28+
*) /opt/conda/bin/conda update -y conda && \
29+
/opt/conda/bin/conda install -y "python=${PYTHON_VERSION}" ;; \
30+
esac && \
31+
/opt/conda/bin/conda clean -ya
32+
33+
34+
WORKDIR /root
35+
36+
COPY ./requirements.txt /lightllm/requirements.txt
37+
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /lightllm/requirements.txt --ignore-installed --extra-index-url https://download.pytorch.org/whl/cu124
38+
39+
RUN --mount=type=cache,target=/root/.cache/pip pip install vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
40+
RUN --mount=type=cache,target=/root/.cache/pip git clone https://github.com/ModelTC/LightKernel.git && cd LightKernel && pip install --no-deps -v .
41+
42+
RUN apt-get update && apt-get install -y libnuma-dev # for sgl_kernel
43+
44+
RUN apt-get update && apt-get install -y cmake automake autotools-dev libtool libz-dev && \
45+
DEBIAN_FRONTEND=noninteractive apt-get -y install --reinstall libibverbs-dev rdma-core ibverbs-utils libibumad-dev; \
46+
rm -rf /usr/lib/ucx && \
47+
rm -rf /opt/hpcx/ucx && \
48+
cd /usr/local/src && \
49+
git clone https://github.com/openucx/ucx.git && \
50+
cd ucx && \
51+
git checkout v1.19.x && \
52+
./autogen.sh && ./configure \
53+
--enable-shared \
54+
--disable-static \
55+
--disable-doxygen-doc \
56+
--enable-optimizations \
57+
--enable-cma \
58+
--enable-devel-headers \
59+
--with-cuda=/usr/local/cuda \
60+
--with-verbs=yes \
61+
--with-dm \
62+
--with-gdrcopy=/usr/local \
63+
--with-efa \
64+
--enable-mt && \
65+
make -j && \
66+
make -j install-strip && \
67+
ldconfig;
68+
69+
RUN apt-get update && apt-get install -y pkg-config tmux net-tools; \
70+
cd /usr/local/src; \
71+
pip install --upgrade meson pybind11 patchelf; \
72+
git clone https://github.com/ai-dynamo/nixl.git -b main && \
73+
cd nixl && \
74+
rm -rf build && \
75+
mkdir build && \
76+
meson setup build/ --prefix=/usr/local/nixl --buildtype=release && \
77+
cd build && \
78+
ninja && \
79+
ninja install && \
80+
cd .. && pip install . --no-deps;
81+
82+
COPY . /lightllm
83+
RUN pip install -e /lightllm --no-cache-dir

docker/Dockerfile.nixl.deepep

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
ARG CUDA_VERSION=12.6.1
2+
FROM nvidia/cuda:${CUDA_VERSION}-cudnn-devel-ubuntu22.04
3+
4+
ARG PYTHON_VERSION=3.10
5+
ARG MAMBA_VERSION=24.7.1-0
6+
ARG TARGETPLATFORM
7+
8+
ENV PATH=/opt/conda/bin:$PATH \
9+
CONDA_PREFIX=/opt/conda
10+
11+
RUN chmod 777 -R /tmp && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
12+
ca-certificates \
13+
libssl-dev \
14+
curl \
15+
g++ \
16+
make \
17+
git && \
18+
rm -rf /var/lib/apt/lists/*
19+
20+
RUN case ${TARGETPLATFORM} in \
21+
"linux/arm64") MAMBA_ARCH=aarch64 ;; \
22+
*) MAMBA_ARCH=x86_64 ;; \
23+
esac && \
24+
curl -fsSL -o ~/mambaforge.sh -v "https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-${MAMBA_ARCH}.sh" && \
25+
bash ~/mambaforge.sh -b -p /opt/conda && \
26+
rm ~/mambaforge.sh
27+
28+
RUN case ${TARGETPLATFORM} in \
29+
"linux/arm64") exit 1 ;; \
30+
*) /opt/conda/bin/conda update -y conda && \
31+
/opt/conda/bin/conda install -y "python=${PYTHON_VERSION}" ;; \
32+
esac && \
33+
/opt/conda/bin/conda clean -ya
34+
35+
36+
WORKDIR /root
37+
38+
COPY ./requirements.txt /lightllm/requirements.txt
39+
RUN --mount=type=cache,target=/root/.cache/pip pip install -r /lightllm/requirements.txt --ignore-installed --extra-index-url https://download.pytorch.org/whl/cu124
40+
41+
RUN --mount=type=cache,target=/root/.cache/pip pip install vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
42+
RUN --mount=type=cache,target=/root/.cache/pip git clone https://github.com/ModelTC/LightKernel.git && cd LightKernel && pip install --no-deps -v .
43+
44+
RUN apt-get update && apt-get install -y libnuma-dev wget devscripts debhelper dh-make build-essential dkms
45+
RUN apt-get install -y ibverbs-providers infiniband-diags perftest rdma-core libibverbs-dev librdmacm-dev
46+
47+
ENV CUDA_HOME=/usr/local/cuda \
48+
GDRCOPY_HOME=/usr/src/gdrdrv-2.4.4/
49+
50+
RUN mkdir -p /tmp/gdrcopy && cd /tmp \
51+
&& git clone https://github.com/NVIDIA/gdrcopy.git -b v2.4.4 \
52+
&& cd gdrcopy/packages \
53+
&& CUDA=/usr/local/cuda ./build-deb-packages.sh \
54+
&& dpkg -i gdrdrv-dkms_*.deb libgdrapi_*.deb gdrcopy-tests_*.deb gdrcopy_*.deb \
55+
&& cd / && rm -rf /tmp/gdrcopy
56+
57+
# Fix DeepEP IBGDA symlink
58+
RUN ln -sf /usr/lib/x86_64-linux-gnu/libmlx5.so.1 /usr/lib/x86_64-linux-gnu/libmlx5.so
59+
60+
RUN wget https://developer.download.nvidia.com/compute/redist/nvshmem/3.3.9/source/nvshmem_src_cuda12-all-all-3.3.9.tar.gz \
61+
&& tar -xf nvshmem_src_cuda12-all-all-3.3.9.tar.gz && mv nvshmem_src nvshmem \
62+
&& cd nvshmem \
63+
&& rm -f /root/nvshmem_src_cuda12-all-all-3.3.9.tar.gz \
64+
&& NVSHMEM_SHMEM_SUPPORT=0 \
65+
NVSHMEM_UCX_SUPPORT=0 \
66+
NVSHMEM_USE_NCCL=0 \
67+
NVSHMEM_MPI_SUPPORT=0 \
68+
NVSHMEM_IBGDA_SUPPORT=1 \
69+
NVSHMEM_PMIX_SUPPORT=0 \
70+
NVSHMEM_TIMEOUT_DEVICE_POLLING=0 \
71+
NVSHMEM_USE_GDRCOPY=1 \
72+
cmake -S . -B build/ -DCMAKE_INSTALL_PREFIX=/root/nvshmem/install -DCMAKE_CUDA_ARCHITECTURES=90 \
73+
&& cmake --build build --target install -j64
74+
75+
ARG DEEPEP_COMMIT=b6ce310bb0b75079682d09bc2ebc063a074fbd58
76+
RUN git clone https://github.com/deepseek-ai/DeepEP.git && cd DeepEP && git checkout ${DEEPEP_COMMIT} && cd ..
77+
78+
WORKDIR /root/DeepEP
79+
ENV NVSHMEM_DIR=/root/nvshmem/install
80+
RUN NVSHMEM_DIR=/root/nvshmem/install python setup.py install
81+
82+
RUN apt-get update && apt-get install -y cmake automake autotools-dev libtool libz-dev && \
83+
DEBIAN_FRONTEND=noninteractive apt-get -y install --reinstall libibverbs-dev rdma-core ibverbs-utils libibumad-dev; \
84+
rm -rf /usr/lib/ucx && \
85+
rm -rf /opt/hpcx/ucx && \
86+
cd /usr/local/src && \
87+
git clone https://github.com/openucx/ucx.git && \
88+
cd ucx && \
89+
git checkout v1.19.x && \
90+
./autogen.sh && ./configure \
91+
--enable-shared \
92+
--disable-static \
93+
--disable-doxygen-doc \
94+
--enable-optimizations \
95+
--enable-cma \
96+
--enable-devel-headers \
97+
--with-cuda=/usr/local/cuda \
98+
--with-verbs=yes \
99+
--with-dm \
100+
--with-gdrcopy=/usr/local \
101+
--with-efa \
102+
--enable-mt && \
103+
make -j && \
104+
make -j install-strip && \
105+
ldconfig;
106+
107+
RUN apt-get update && apt-get install -y pkg-config tmux net-tools ; \
108+
cd /usr/local/src; \
109+
pip install --upgrade meson pybind11 patchelf; \
110+
git clone https://github.com/ai-dynamo/nixl.git -b main && \
111+
cd nixl && \
112+
rm -rf build && \
113+
mkdir build && \
114+
meson setup build/ --prefix=/usr/local/nixl --buildtype=release && \
115+
cd build && \
116+
ninja && \
117+
ninja install && \
118+
cd .. && pip install . --no-deps;
119+
120+
COPY . /lightllm
121+
RUN pip install -e /lightllm --no-cache-dir

lightllm/server/router/model_infer/mode_backend/chunked_prefill/impl.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ def decode_normal(
185185
next_token_ids=next_token_ids_cpu,
186186
next_token_logprobs=next_token_logprobs_cpu,
187187
run_reqs_update_packs=update_packs,
188-
extra_post_req_handle_func=self.extra_post_req_handle_func,
189-
call_post_handle_for_chunk=self.call_post_handle_for_chunk
188+
extra_post_req_handle_func=self.extra_post_req_handle_func
190189
)
191190

192191
# 第四阶段
@@ -352,8 +351,7 @@ def decode_mtp(
352351
next_token_ids=next_token_ids_cpu[select_mask],
353352
next_token_logprobs=next_token_logprobs_cpu[select_mask],
354353
run_reqs_update_packs=update_packs,
355-
extra_post_req_handle_func=self.extra_post_req_handle_func,
356-
call_post_handle_for_chunk=self.call_post_handle_for_chunk
354+
extra_post_req_handle_func=self.extra_post_req_handle_func
357355
)
358356
if len(need_free_mem_indexes) > 0:
359357
g_infer_state_lock.acquire()

lightllm/server/router/model_infer/mode_backend/dp_backend/impl.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def prefill_normal(
160160
next_token_logprobs=next_token_logprobs_cpu,
161161
run_reqs_update_packs=update_packs,
162162
extra_post_req_handle_func=self.extra_post_req_handle_func,
163+
call_post_handle_for_chunk=self.call_post_handle_for_chunk
163164
)
164165
# 第四阶段
165166
event_pack.notify_pre_post_handle()
@@ -290,6 +291,7 @@ def prefill_overlap(self, event_pack: OverlapEventPack, prefill_reqs: List[Infer
290291
next_token_logprobs=next_token_logprobs_cpu,
291292
run_reqs_update_packs=update_packs,
292293
extra_post_req_handle_func=self.extra_post_req_handle_func,
294+
call_post_handle_for_chunk=self.call_post_handle_for_chunk
293295
)
294296
# 第四阶段
295297
event_pack.notify_pre_post_handle()
@@ -437,6 +439,7 @@ def prefill_mtp(self, event_pack: OverlapEventPack, prefill_reqs: List[InferReq]
437439
next_token_logprobs=next_token_logprobs_cpu,
438440
run_reqs_update_packs=update_packs,
439441
extra_post_req_handle_func=self.extra_post_req_handle_func,
442+
call_post_handle_for_chunk=self.call_post_handle_for_chunk,
440443
)
441444

442445
# 第四阶段
@@ -661,6 +664,7 @@ def prefill_overlap_mtp(self, event_pack: OverlapEventPack, prefill_reqs: List[I
661664
next_token_logprobs=next_token_logprobs_cpu,
662665
run_reqs_update_packs=update_packs,
663666
extra_post_req_handle_func=self.extra_post_req_handle_func,
667+
call_post_handle_for_chunk=self.call_post_handle_for_chunk
664668
)
665669
event_pack.notify_pre_post_handle()
666670
else:

lightllm/server/router/model_infer/mode_backend/pd_nixl/impl_for_pd_decode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, prefill_task_queue: mp.Queue, prefill_done_queue: mp.Queue, n
2828
self.support_overlap = True
2929

3030
def init_custom(self):
31-
super().init_custom()
31+
super(type(self), self).init_custom()
3232
self.wait_prefill_thread = threading.Thread(
3333
target=self._start_async_loop, args=(self._prefill_wait_loop_async,), daemon=True
3434
)
@@ -81,7 +81,7 @@ def _get_classed_reqs(
8181
strict_prefill: bool = False,
8282
recover_paused: bool = False,
8383
):
84-
prefill_reqs, decode_reqs = super()._get_classed_reqs(req_ids, no_decode, strict_prefill, recover_paused)
84+
prefill_reqs, decode_reqs = super(type(self), self)._get_classed_reqs(req_ids, no_decode, strict_prefill, recover_paused)
8585
prefill_reqs, decode_reqs, failed_reqs, _ = self._decode_filter_reqs(prefill_reqs, decode_reqs)
8686

8787
if failed_reqs:

lightllm/server/router/model_infer/mode_backend/pd_nixl/impl_for_pd_decode_dp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111

1212
class PDNIXLDPBackendForDecodeNode(PDNIXLBackendBaseDPChunked):
1313
def __init__(self, prefill_task_queue: mp.Queue, prefill_done_queue: mp.Queue, nix_meta_queue: mp.Queue) -> None:
14-
super().__init__(prefill_task_queue, prefill_done_queue, nix_meta_queue)
1514
self.init_custom = MethodType(PDNIXLBackendForDecodeNode.init_custom, self)
15+
super().__init__(prefill_task_queue, prefill_done_queue, nix_meta_queue)
16+
self.classed_req_strict_prefill = False
17+
self.support_overlap = True
18+
1619
self._build_remote_prefill_task = MethodType(PDNIXLBackendForDecodeNode._build_remote_prefill_task, self)
1720
self._trigger_remote_prefill = MethodType(PDNIXLBackendForDecodeNode._trigger_remote_prefill, self)
1821
self._pre_handle_finished_reqs = MethodType(PDNIXLBackendForDecodeNode._pre_handle_finished_reqs, self)

lightllm/server/router/model_infer/mode_backend/pd_nixl/impl_for_pd_prefill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, transfer_task_queue: mp.Queue, transfer_done_queue: mp.Queue,
2020
self.call_post_handle_for_chunk = True
2121

2222
def init_custom(self):
23-
super().init_custom()
23+
super(type(self), self).init_custom()
2424
self.handle_prefill_loop_thread = threading.Thread(
2525
target=self._start_async_loop, args=(self._handle_prefill_loop,), daemon=True
2626
)

0 commit comments

Comments
 (0)