-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[CPU] enable CI for PRs, add Dockerfile and auto build task #6458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 38 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
e04c2d9
Create Dockerfil.xeon
DiweiSun 0b05058
Rename Dockerfil.xeon to Dockerfile.xeon
DiweiSun 96b7fee
enable device auto detection for cuda/cpu/intel-gpu/rocm
DiweiSun a6328b3
Delete docker/Dockerfile.xeon
DiweiSun f405aac
lint format fix
DiweiSun 47f46e3
Merge branch 'main' into molly/cpu_ut
DiweiSun c397a5f
add Dockerfile for Xeon
ZailiWang 6db5e06
Update run_suite.py
DiweiSun 16e3f07
Merge branch 'sgl-project:main' into main
ZailiWang 9c8b3b8
add autotask yml file
ZailiWang 7bde01a
Merge branch 'main' into main
ZailiWang 0856e0c
Merge branch 'main' into main
ZailiWang 3f9c509
Merge branch 'main' into main
ZailiWang 850e128
Merge branch 'main' into main
ZailiWang e97287b
replace setup.py
ZailiWang ef631d2
Merge branch 'main' into main
ZailiWang c00ace3
fix dep. issue in test_topk
ZailiWang f083009
Merge branch 'main' into molly/cpu_ut
DiweiSun 6f3106b
Merge pull request #5 from ZailiWang/main
DiweiSun 660b9c5
install torch_cpu separately since --index-url cannot be set in toml
ZailiWang f02d1d6
Merge branch 'main' into main
ZailiWang e785e76
enable cpu ci
DiweiSun 39b907d
docker build with local hardware
DiweiSun 00ef105
docker build with local hardware
DiweiSun 2693254
bugfix for workspace
DiweiSun 996246a
bugfix for container clean
DiweiSun 3539a0d
remove test_rope.py in cpu ci
DiweiSun 6652226
remove proxy setting and lint format fix
DiweiSun e44e1c6
Merge branch 'main' into molly/cpu_ut
DiweiSun e71802e
UT TEST: raise error when server launch process dead
DiweiSun 3f77c78
enable ci on xeon
DiweiSun 0d02e79
skip CPU test if AMX not supported
ZailiWang cd7f3f7
Merge branch 'main' into main
ZailiWang 232b5c7
fix lint error
ZailiWang 2bace09
Merge branch 'main' of https://github.com/ZailiWang/sglang
ZailiWang aedeae2
Merge branch 'main' into main
zhyncs 5c79c04
Merge branch 'main' into main
zhyncs 9b0087b
Merge branch 'main' into main
zhyncs a3c804b
Merge branch 'main' into main
zhyncs fd13d4b
upd
zhyncs 9ee7a2c
upd
zhyncs 1cf96d7
upd
zhyncs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| name: PR Test (Xeon) | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: pr-test-xeon-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-test: | ||
| if: github.event_name == 'pull_request' | ||
| runs-on: spr-node | ||
zhyncs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| environment: 'prod' | ||
| strategy: | ||
| matrix: | ||
| build_type: ['all'] | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Build and Push | ||
| run: | | ||
| version=$(cat python/sglang/version.py | cut -d'"' -f2) | ||
| tag=v${version}-xeon | ||
|
|
||
| docker build . -f docker/Dockerfile.xeon -t sglang_xeon --no-cache | ||
| unit-test: | ||
| if: github.event_name == 'pull_request' | ||
| needs: [build-test] | ||
| runs-on: spr-node | ||
zhyncs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: Run container | ||
| run: | | ||
| docker run -dt \ | ||
| -v ${{ github.workspace }}:/sglang-checkout/ --ipc=host \ | ||
| --name ci_sglang_xeon \ | ||
| sglang_xeon | ||
|
|
||
| - name: Install Dependency | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec ci_sglang_xeon bash -c "python3 -m pip install --upgrade pip" | ||
| docker exec ci_sglang_xeon pip uninstall sgl-kernel -y || true | ||
| docker exec -w /sglang-checkout/sgl-kernel ci_sglang_xeon bash -c "cp pyproject_cpu.toml pyproject.toml && pip install -v ." | ||
| docker exec -w /sglang-checkout/ ci_sglang_xeon bash -c "pip install -e "python[all_cpu]"" | ||
| docker exec ci_sglang_xeon bash -c "python3 -m pip install pytest expecttest" | ||
|
|
||
| - name: Check AMX Support | ||
| id: check_amx | ||
| timeout-minutes: 5 | ||
| run: | | ||
| docker exec -w /sglang-checkout/ ci_sglang_xeon \ | ||
| bash -c "python3 -c 'import torch; import sgl_kernel; assert torch._C._cpu._is_amx_tile_supported(); assert hasattr(torch.ops.sgl_kernel, \"convert_weight_packed\"); '" | ||
| continue-on-error: true | ||
|
|
||
| - name: Run UT Cases | ||
| if: steps.check_amx.outcome == 'success' | ||
| timeout-minutes: 20 | ||
| run: | | ||
| docker exec -w /sglang-checkout/ ci_sglang_xeon \ | ||
| bash -c "cd ./test/srt && python3 run_suite.py --suite per-commit-cpu" | ||
|
|
||
| - name: Cleanup container | ||
| if: always() | ||
| run: | | ||
| docker rm -f ci_sglang_xeon || true | ||
|
|
||
| finish: | ||
| if: always() | ||
| needs: [build-test, unit-test] | ||
| runs-on: spr-node | ||
zhyncs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: Check all dependent job statuses | ||
| run: | | ||
| results=(${{ join(needs.*.result, ' ') }}) | ||
| for result in "${results[@]}"; do | ||
| if [ "$result" = "failure" ] || [ "$result" = "cancelled" ]; then | ||
| echo "Job failed with result: $result" | ||
| exit 1 | ||
| fi | ||
| done | ||
| echo "All jobs completed successfully" | ||
| exit 0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Release Docker Images | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "python/sglang/version.py" | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| publish: | ||
| if: github.repository == 'sgl-project/sglang' | ||
| runs-on: ubuntu-24.04 | ||
| environment: 'prod' | ||
| strategy: | ||
| matrix: | ||
| build_type: ['all'] | ||
| steps: | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Login to Docker Hub | ||
| uses: docker/login-action@v2 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Build and Push | ||
| run: | | ||
| version=$(cat python/sglang/version.py | cut -d'"' -f2) | ||
| tag=v${version}-xeon | ||
|
|
||
| docker build . -f docker/Dockerfile.xeon -t lmsysorg/sglang:${tag} --no-cache | ||
| docker push lmsysorg/sglang:${tag} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| FROM ubuntu:24.04 | ||
| SHELL ["/bin/bash", "-c"] | ||
|
|
||
| ARG VER_SGLANG=main | ||
| ARG VER_TORCH=2.6.0 | ||
| ARG VER_TORCHVISION=0.21.0 | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get full-upgrade -y && \ | ||
| DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | ||
| ca-certificates \ | ||
| git \ | ||
| curl \ | ||
| wget \ | ||
| vim \ | ||
| gcc \ | ||
| g++ \ | ||
| make | ||
|
|
||
| WORKDIR /sgl-workspace | ||
|
|
||
| RUN curl -fsSL -v -o miniforge.sh -O https://github.com/conda-forge/miniforge/releases/download/24.11.3-2/Miniforge3-24.11.3-2-Linux-x86_64.sh && \ | ||
| bash miniforge.sh -b -p ./miniforge3 && \ | ||
| rm -f miniforge.sh && \ | ||
| . miniforge3/bin/activate && \ | ||
| conda install -y libsqlite==3.48.0 gperftools tbb libnuma numactl | ||
|
|
||
| ENV PATH=/sgl-workspace/miniforge3/bin:/sgl-workspace/miniforge3/condabin:${PATH} | ||
| ENV PIP_ROOT_USER_ACTION=ignore | ||
|
|
||
| RUN pip install intel-openmp | ||
|
|
||
| RUN git clone https://github.com/sgl-project/sglang.git && \ | ||
| cd sglang && \ | ||
| git checkout ${VER_SGLANG} && \ | ||
| pip install -e "python[all_cpu]" && \ | ||
| pip install torch==${VER_TORCH} torchvision==${VER_TORCHVISION} --index-url https://download.pytorch.org/whl/cpu --force-reinstall && \ | ||
| cd sgl-kernel && \ | ||
| cp pyproject_cpu.toml pyproject.toml && \ | ||
| pip install -v . | ||
|
|
||
| ENV LD_PRELOAD=/sgl-workspace/miniforge3/lib/libiomp5.so:/sgl-workspace/miniforge3/lib/libtcmalloc.so:/sgl-workspace/miniforge3/lib/libtbbmalloc.so.2 | ||
|
|
||
| WORKDIR /sgl-workspace/sglang |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently this has not been set up in the sglang repo as a self-hosted runner.