update XPU Dockerfile (#25174)
Signed-off-by: Matrix Yao <matrix.yao@intel.com> Co-authored-by: MingxuZh <109504044+MingxuZh@users.noreply.github.com> Co-authored-by: Ma Mingfei <mingfei.ma@intel.com>
This commit is contained in:
co-authored by
MingxuZh
Ma Mingfei
parent
714fdd9723
commit
9fea20a078
@@ -108,16 +108,16 @@ jobs:
|
|||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
run: |
|
run: |
|
||||||
cid="${{ steps.start_container.outputs.container_id }}"
|
cid="${{ steps.start_container.outputs.container_id }}"
|
||||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.12/bin/python3 -m pip install --upgrade pip
|
docker exec "$cid" /opt/venv/bin/python3 -m pip install --upgrade pip
|
||||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.12/bin/python3 -m pip install pytest expecttest ray huggingface_hub tabulate
|
docker exec "$cid" /opt/venv/bin/python3 -m pip install pytest expecttest ray huggingface_hub tabulate
|
||||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.12/bin/python3 -m pip uninstall -y flashinfer-python
|
docker exec "$cid" /opt/venv/bin/python3 -m pip uninstall -y flashinfer-python
|
||||||
docker exec "$cid" /bin/bash -c '/home/sdp/miniforge3/envs/py3.12/bin/hf auth login --token ${HF_TOKEN} '
|
docker exec "$cid" /bin/bash -c '/opt/venv/bin/hf auth login --token ${HF_TOKEN} '
|
||||||
|
|
||||||
- name: Run stage-a tests
|
- name: Run stage-a tests
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
run: |
|
run: |
|
||||||
cid="${{ steps.start_container.outputs.container_id }}"
|
cid="${{ steps.start_container.outputs.container_id }}"
|
||||||
docker exec "$cid" bash -c "source /home/sdp/miniforge3/bin/activate && conda activate py3.12 && cd /home/sdp/sglang/test && python3 run_suite.py --hw xpu --suite stage-a-test-1-gpu-xpu"
|
docker exec "$cid" bash -c "source /opt/venv/bin/activate && cd /sgl-workspace/sglang/test && python3 run_suite.py --hw xpu --suite stage-a-test-1-gpu-xpu"
|
||||||
|
|
||||||
- name: Cleanup container
|
- name: Cleanup container
|
||||||
if: always()
|
if: always()
|
||||||
@@ -172,16 +172,16 @@ jobs:
|
|||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
run: |
|
run: |
|
||||||
cid="${{ steps.start_container.outputs.container_id }}"
|
cid="${{ steps.start_container.outputs.container_id }}"
|
||||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.12/bin/python3 -m pip install --upgrade pip
|
docker exec "$cid" /opt/venv/bin/python3 -m pip install --upgrade pip
|
||||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.12/bin/python3 -m pip install pytest expecttest ray huggingface_hub tabulate
|
docker exec "$cid" /opt/venv/bin/python3 -m pip install pytest expecttest ray huggingface_hub tabulate
|
||||||
docker exec "$cid" /home/sdp/miniforge3/envs/py3.12/bin/python3 -m pip uninstall -y flashinfer-python
|
docker exec "$cid" /opt/venv/bin/python3 -m pip uninstall -y flashinfer-python
|
||||||
docker exec "$cid" /bin/bash -c '/home/sdp/miniforge3/envs/py3.12/bin/hf auth login --token ${HF_TOKEN} '
|
docker exec "$cid" /bin/bash -c '/opt/venv/bin/hf auth login --token ${HF_TOKEN} '
|
||||||
|
|
||||||
- name: Run stage-b tests
|
- name: Run stage-b tests
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
run: |
|
run: |
|
||||||
cid="${{ steps.start_container.outputs.container_id }}"
|
cid="${{ steps.start_container.outputs.container_id }}"
|
||||||
docker exec "$cid" bash -c "source /home/sdp/miniforge3/bin/activate && conda activate py3.12 && cd /home/sdp/sglang/test && python3 run_suite.py --hw xpu --suite stage-b-test-1-gpu-xpu"
|
docker exec "$cid" bash -c "source /opt/venv/bin/activate && cd /sgl-workspace/sglang/test && python3 run_suite.py --hw xpu --suite stage-b-test-1-gpu-xpu"
|
||||||
|
|
||||||
- name: Cleanup container
|
- name: Cleanup container
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
+20
-45
@@ -1,6 +1,4 @@
|
|||||||
# If the device is Battlemage, we need to set UBUNTU_VERSION to 24.10
|
# docker build -t sglang:xpu -f xpu.Dockerfile --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy} --no-cache .
|
||||||
|
|
||||||
# Usage: docker build --build-arg UBUNTU_VERSION=24.04 --build-arg PYTHON_VERSION=3.10 -t sglang:xpu_kernel -f xpu.Dockerfile --no-cache .
|
|
||||||
|
|
||||||
# Use Intel deep learning essentials base image with Ubuntu 24.04
|
# Use Intel deep learning essentials base image with Ubuntu 24.04
|
||||||
FROM intel/deep-learning-essentials:2025.3.2-0-devel-ubuntu24.04
|
FROM intel/deep-learning-essentials:2025.3.2-0-devel-ubuntu24.04
|
||||||
@@ -17,9 +15,6 @@ ARG SG_LANG_BRANCH=main
|
|||||||
ARG SG_LANG_KERNEL_REPO=https://github.com/sgl-project/sgl-kernel-xpu.git
|
ARG SG_LANG_KERNEL_REPO=https://github.com/sgl-project/sgl-kernel-xpu.git
|
||||||
ARG SG_LANG_KERNEL_BRANCH=main
|
ARG SG_LANG_KERNEL_BRANCH=main
|
||||||
|
|
||||||
RUN useradd -m -d /home/sdp -s /bin/bash sdp && \
|
|
||||||
chown -R sdp:sdp /home/sdp
|
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Install the latest UMD driver for SYCL-TLA
|
# Install the latest UMD driver for SYCL-TLA
|
||||||
@@ -32,50 +27,30 @@ RUN apt-get update && apt-get install -y software-properties-common && \
|
|||||||
libze-dev intel-ocloc && \
|
libze-dev intel-ocloc && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Switch to non-root user 'sdp'
|
|
||||||
USER sdp
|
|
||||||
|
|
||||||
# Set HOME and WORKDIR to user's home directory
|
RUN apt-get update && apt-get install -y \
|
||||||
ENV HOME=/home/sdp
|
python3-dev \
|
||||||
WORKDIR /home/sdp
|
build-essential \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN curl -fsSL -v -o miniforge.sh -O https://github.com/conda-forge/miniforge/releases/download/25.1.1-0/Miniforge3-Linux-x86_64.sh && \
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
bash miniforge.sh -b -p ./miniforge3 && \
|
ENV PATH="/root/.local/bin:$PATH"
|
||||||
rm miniforge.sh && \
|
ENV VIRTUAL_ENV="/opt/venv"
|
||||||
# Initialize conda environment and install pip
|
ENV UV_PYTHON_INSTALL_DIR=/opt/uv/python
|
||||||
. ./miniforge3/bin/activate && \
|
RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
|
||||||
conda create -y -n py${PYTHON_VERSION} python=${PYTHON_VERSION} && \
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
conda activate py${PYTHON_VERSION} && \
|
|
||||||
conda install pip && \
|
|
||||||
# Append environment activation to .bashrc for interactive shells
|
|
||||||
echo ". /home/sdp/miniforge3/bin/activate; conda activate py${PYTHON_VERSION}; . /opt/intel/oneapi/setvars.sh; cd /home/sdp" >> /home/sdp/.bashrc
|
|
||||||
|
|
||||||
RUN --mount=type=secret,id=github_token \
|
WORKDIR /sgl-workspace
|
||||||
cd /home/sdp && \
|
|
||||||
. /home/sdp/miniforge3/bin/activate && \
|
|
||||||
conda activate py${PYTHON_VERSION} && \
|
|
||||||
conda install libsqlite=3.48.0 -y && \
|
|
||||||
pip install msgspec blake3 py-cpuinfo compressed_tensors gguf partial_json_parser einops tabulate --root-user-action=ignore && \
|
|
||||||
pip3 install torch==2.11.0+xpu torchao torchvision torchaudio==2.11.0+xpu --index-url https://download.pytorch.org/whl/xpu
|
|
||||||
|
|
||||||
RUN --mount=type=secret,id=github_token \
|
RUN pip install --no-cache-dir msgspec blake3 py-cpuinfo compressed_tensors gguf partial_json_parser einops tabulate --root-user-action=ignore && \
|
||||||
cd /home/sdp && \
|
pip install --no-cache-dir torch==2.11.0+xpu torchao torchvision torchaudio==2.11.0+xpu --index-url https://download.pytorch.org/whl/xpu
|
||||||
. /home/sdp/miniforge3/bin/activate && \
|
|
||||||
conda activate py${PYTHON_VERSION} && \
|
RUN echo "Cloning ${SG_LANG_BRANCH} from ${SG_LANG_REPO}" && \
|
||||||
echo "Cloning ${SG_LANG_BRANCH} from ${SG_LANG_REPO}" && \
|
|
||||||
git clone --branch ${SG_LANG_BRANCH} --single-branch ${SG_LANG_REPO} sglang && \
|
git clone --branch ${SG_LANG_BRANCH} --single-branch ${SG_LANG_REPO} sglang && \
|
||||||
cd sglang && cd python && \
|
cd sglang && cd python && \
|
||||||
cp pyproject_xpu.toml pyproject.toml && \
|
cp pyproject_xpu.toml pyproject.toml && \
|
||||||
pip install . --extra-index-url https://download.pytorch.org/whl/xpu && \
|
pip install --no-cache-dir . --extra-index-url https://download.pytorch.org/whl/xpu && \
|
||||||
pip install --no-deps xgrammar==0.1.33 && \
|
pip install --no-cache-dir --no-deps xgrammar==0.1.33 && \
|
||||||
pip install apache-tvm-ffi && \
|
pip install triton-xpu==3.7.1 --index-url https://download.pytorch.org/whl/test/xpu --force-reinstall
|
||||||
pip install triton-xpu==3.7.1 --index-url https://download.pytorch.org/whl/xpu --force-reinstall && \
|
|
||||||
# Add environment setup commands to .bashrc again (in case it was overwritten)
|
|
||||||
echo ". /home/sdp/miniforge3/bin/activate; conda activate py${PYTHON_VERSION}; cd /home/sdp" >> /home/sdp/.bashrc
|
|
||||||
|
|
||||||
# Use bash as default shell with initialization from .bashrc
|
CMD ["bash", "-c", "source /opt/intel/oneapi/setvars.sh --force && exec bash"]
|
||||||
SHELL ["bash", "-c"]
|
|
||||||
|
|
||||||
# Start an interactive bash shell with all environment set up
|
|
||||||
USER sdp
|
|
||||||
CMD ["bash", "-c", "source /home/sdp/.bashrc && exec bash"]
|
|
||||||
|
|||||||
Reference in New Issue
Block a user