-
-
Notifications
You must be signed in to change notification settings - Fork 20.1k
[CI] Add Buildkite #2355
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
[CI] Add Buildkite #2355
Changes from 72 commits
9885a22
4c72ed6
aa94936
78715c5
8caed4c
c758a6e
9999af4
07d9770
3dec83c
c2ab470
ccf8ef4
9035ad8
457e056
748cfe5
702d299
63c885f
e9aa19a
f81af48
7375cb0
dd45ab3
80f2741
06d21ca
3bcfd93
8d11184
59052e0
8f92995
6a5ffd0
0821757
bc8edfa
f2fff98
5497b5b
b5d6e6b
87ae7ec
7d41bbc
a0663ca
a84ae05
7549435
02e4795
211ebe2
2e7b535
6f108f6
db56161
427ba10
921de99
99617a3
12129c6
0b88055
8a578ee
de7ff02
f97588c
0ba20b4
f3b266b
cb448df
60511d4
1bfb763
7f9ec5c
01946b5
3f97d88
7c76677
d2a5b51
a697e9b
b445350
2ed9005
a984d6b
58d9ca7
c5c9bb1
e650571
8d055f5
4b5636d
2979bb0
7193779
9856edd
ac31f21
14fe8a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # This script is run by buildkite to run the benchmarks and upload the results to buildkite | ||
|
|
||
| set -ex | ||
|
|
||
| # cd into parent directory of this file | ||
| cd "$(dirname "${BASH_SOURCE[0]}")/.." | ||
|
|
||
| # run benchmarks and upload the result to buildkite | ||
| python3 benchmarks/benchmark_latency.py 2>&1 | tee benchmark_latency.txt | ||
|
|
||
| python3 benchmarks/benchmark_throughput.py --input-len 256 --output-len 256 2>&1 | tee benchmark_throughput.txt | ||
|
|
||
| # write the results into a markdown file | ||
| echo "### Latency Benchmarks" >> benchmark_results.md | ||
| sed -n '1p' benchmark_latency.txt >> benchmark_results.md | ||
| echo "" >> benchmark_results.md | ||
| sed -n '$p' benchmark_latency.txt >> benchmark_results.md | ||
| echo "### Throughput Benchmarks" >> benchmark_results.md | ||
| sed -n '1p' benchmark_throughput.txt >> benchmark_results.md | ||
| echo "" >> benchmark_results.md | ||
| sed -n '$p' benchmark_throughput.txt >> benchmark_results.md | ||
|
|
||
| # upload the results to buildkite | ||
| /workspace/buildkite-agent annotate --style "info" --context "benchmark-results" < benchmark_results.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # In this file, you can add more tests to run either by adding a new step or | ||
| # adding a new command to an existing step. See different options here for examples. | ||
| # This script will be feed into Jinja template in `test-template.j2` to generate | ||
| # the final pipeline yaml file. | ||
|
|
||
| steps: | ||
| - label: Regression Test | ||
| command: pytest -v -s test_regression.py | ||
| working_dir: "/vllm-workspace/tests" # optional | ||
|
|
||
| - label: AsyncEngine Test | ||
| command: pytest -v -s async_engine | ||
|
|
||
| - label: Distributed Test | ||
| command: pytest -v -s test_comm_ops.py | ||
| working_dir: "/vllm-workspace/tests/distributed" | ||
| num_gpus: 2 # only support 1 or 2 for now. | ||
|
|
||
| - label: Engine Test | ||
| command: pytest -v -s engine | ||
|
|
||
| - label: Kernels Test | ||
| command: pytest -v -s kernels | ||
| soft_fail: true | ||
|
|
||
| - label: Models Test | ||
| commands: | ||
| - pytest -v -s models --forked | ||
| soft_fail: true | ||
|
|
||
| - label: Samplers Test | ||
| command: pytest -v -s samplers --forked | ||
|
|
||
| - label: Worker Test | ||
| command: pytest -v -s worker | ||
|
|
||
| - label: Benchmarks | ||
| working_dir: "/vllm-workspace/.buildkite" | ||
| commands: | ||
| - pip install aiohttp | ||
| - bash run-benchmarks.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| {% set docker_image = "us-central1-docker.pkg.dev/vllm-405802/vllm-ci-test-repo/vllm-test:$BUILDKITE_COMMIT" %} | ||
| {% set default_num_gpu = 1 %} | ||
| {% set default_working_dir = "/vllm-workspace/tests" %} | ||
|
|
||
| steps: | ||
| - label: ":docker: build image" | ||
| commands: | ||
| - "docker build --tag {{ docker_image }} --target test --progress plain ." | ||
| - "docker push {{ docker_image }}" | ||
| env: | ||
| DOCKER_BUILDKIT: "1" | ||
| - wait | ||
|
|
||
| {% for step in steps %} | ||
| - label: "{{ step.label }}" | ||
| agents: | ||
| queue: kubernetes | ||
| soft_fail: {{ step.soft_fail or false }} | ||
| plugins: | ||
| - kubernetes: | ||
| podSpec: | ||
| volumes: | ||
| - name: dshm | ||
| emptyDir: | ||
| medium: Memory | ||
| containers: | ||
| - image: "{{ docker_image }}" | ||
| command: ["bash"] | ||
| args: | ||
| - "-c" | ||
| - "'cd {{ (step.working_dir or default_working_dir) | safe }} && {{ step.command or (step.commands | join(' && ')) | safe }}'" | ||
| resources: | ||
| requests: | ||
| nvidia.com/gpu: "{{ step.num_gpus or default_num_gpu }}" | ||
| limits: | ||
| nvidia.com/gpu: "{{ step.num_gpus or default_num_gpu }}" | ||
| env: | ||
| - name: HF_TOKEN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: hf-token-secret | ||
| key: token | ||
| volumeMounts: | ||
| - mountPath: /dev/shm | ||
| name: dshm | ||
| {% endfor %} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,9 @@ | |
|
|
||
| Run `pytest tests/distributed/test_comm_ops.py --forked`. | ||
| """ | ||
| from multiprocessing import Process, set_start_method | ||
|
|
||
| import pytest | ||
| import torch | ||
| import ray | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, why change to ray?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in the code below, i added a comment saying ray gives way better log for debugging purpose (i couldn't figure the failures from multiprocessing)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gotcha! makes a lot of sense. |
||
|
|
||
| from vllm.config import ParallelConfig | ||
| from vllm.utils import get_open_port | ||
|
|
@@ -23,11 +22,11 @@ def init_test_distributed_environment(pipeline_parallel_size: int, | |
| tensor_parallel_size, | ||
| worker_use_ray=True) | ||
| distributed_init_method = f"tcp://localhost:{distributed_init_port}" | ||
| torch.cuda.set_device(rank) | ||
| _init_distributed_environment(parallel_config, rank, | ||
| distributed_init_method) | ||
|
|
||
|
|
||
| @ray.remote(num_gpus=1, max_calls=1) | ||
| def all_reduce_test_worker(tensor_parallel_size: int, rank: int, | ||
| distributed_init_port: str): | ||
| init_test_distributed_environment(1, tensor_parallel_size, rank, | ||
|
|
@@ -43,6 +42,7 @@ def all_reduce_test_worker(tensor_parallel_size: int, rank: int, | |
| assert torch.allclose(t, expected) | ||
|
|
||
|
|
||
| @ray.remote(num_gpus=1, max_calls=1) | ||
| def all_gather_test_worker(tensor_parallel_size: int, rank: int, | ||
| distributed_init_port: str): | ||
| init_test_distributed_environment(1, tensor_parallel_size, rank, | ||
|
|
@@ -70,14 +70,16 @@ def all_gather_test_worker(tensor_parallel_size: int, rank: int, | |
| @pytest.mark.parametrize("test_target", | ||
| [all_reduce_test_worker, all_gather_test_worker]) | ||
| def test_multi_process_tensor_parallel(tensor_parallel_size, test_target): | ||
| set_start_method("spawn", force=True) | ||
| # Using ray helps debugging the error when it failed | ||
| # as compared to multiprocessing. | ||
| ray.init() | ||
|
|
||
| distributed_init_port = get_open_port() | ||
| processes = [] | ||
| refs = [] | ||
| for rank in range(tensor_parallel_size): | ||
| p = Process(target=test_target, | ||
| args=(tensor_parallel_size, rank, distributed_init_port)) | ||
| p.start() | ||
| processes.append(p) | ||
| for p in processes: | ||
| p.join() | ||
| assert all(p.exitcode == 0 for p in processes) | ||
| refs.append( | ||
| test_target.remote(tensor_parallel_size, rank, | ||
| distributed_init_port)) | ||
| ray.get(refs) | ||
|
|
||
| ray.shutdown() | ||
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.