@@ -9,8 +9,48 @@ The fastest way to setup test environment is to use the main branch container im
99:::::{tab-set}
1010:sync-group: e2e
1111
12- ::::{tab-item} Single card
12+ ::::{tab-item} Local (CPU)
1313:selected:
14+ :sync: cpu
15+
16+ You can run the unit tests on CPU with the following steps:
17+
18+ ``` {code-block} bash
19+ :substitutions:
20+
21+ cd ~/vllm-project/
22+ # ls
23+ # vllm vllm-ascend
24+
25+ # Use mirror to speedup download
26+ # docker pull quay.nju.edu.cn/ascend/cann:|cann_image_tag|
27+ export IMAGE=quay.io/ascend/cann:|cann_image_tag|
28+ docker run --rm --name vllm-ascend-ut \
29+ -v $(pwd):/vllm-project \
30+ -v ~/.cache:/root/.cache \
31+ -ti $IMAGE bash
32+
33+ # (Optional) Configure mirror to speedup download
34+ pip config set global.index-url https://mirrors.huaweicloud.com/repository/pypi/simple/
35+
36+ apt-get update -y
37+ apt-get install -y python3-pip git vim wget net-tools gcc g++ cmake libnuma-dev curl gnupg2
38+
39+ # Install vllm
40+ cd /vllm-project/vllm
41+ VLLM_TARGET_DEVICE=empty python3 -m pip -v install .
42+
43+ # Install vllm-ascend
44+ cd /vllm-project/vllm-ascend
45+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/$(uname -m)-linux/devlib
46+ python3 -m pip install -r requirements-dev.txt
47+ export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi
48+ python3 -m pip install -v .
49+ ```
50+
51+ ::::
52+
53+ ::::{tab-item} Single card
1454:sync: single
1555
1656``` {code-block} bash
@@ -36,6 +76,16 @@ docker run --rm \
3676 -it $IMAGE bash
3777```
3878
79+ After starting the container, you should install the required packages:
80+
81+ ``` bash
82+ # Prepare
83+ pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
84+
85+ # Install required packages
86+ pip install -r requirements-dev.txt
87+ ```
88+
3989::::
4090
4191::::{tab-item} Multi cards
@@ -63,9 +113,6 @@ docker run --rm \
63113 -p 8000:8000 \
64114 -it $IMAGE bash
65115```
66- ::::
67-
68- :::::
69116
70117After starting the container, you should install the required packages:
71118
@@ -77,6 +124,10 @@ pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/si
77124pip install -r requirements-dev.txt
78125```
79126
127+ ::::
128+
129+ :::::
130+
80131## Running tests
81132
82133### Unit test
@@ -89,14 +140,48 @@ There are several principles to follow when writing unit tests:
89140- Example: [ tests/ut/test_ascend_config.py] ( https://github.com/vllm-project/vllm-ascend/blob/main/tests/ut/test_ascend_config.py ) .
90141- You can run the unit tests using ` pytest ` :
91142
92- ``` bash
93- cd /vllm-workspace/vllm-ascend/
94- # Run all single card the tests
95- pytest -sv tests/ut
143+ :::::{tab-set}
144+ :sync-group: e2e
96145
97- # Run
98- pytest -sv tests/ut/test_ascend_config.py
99- ```
146+ ::::{tab-item} Local (CPU)
147+ :sync: cpu
148+
149+ ``` bash
150+ # Run unit tests
151+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH :/usr/local/Ascend/ascend-toolkit/latest/$( uname -m) -linux/devlib
152+ VLLM_USE_V1=1 TORCH_DEVICE_BACKEND_AUTOLOAD=0 pytest -sv tests/ut
153+ ```
154+
155+ ::::
156+
157+ ::::{tab-item} Single card
158+ :selected:
159+ :sync: single
160+
161+ ``` bash
162+ cd /vllm-workspace/vllm-ascend/
163+ # Run all single card the tests
164+ pytest -sv tests/ut
165+
166+ # Run single test
167+ pytest -sv tests/ut/test_ascend_config.py
168+ ```
169+ ::::
170+
171+ ::::{tab-item} Multi cards test
172+ :sync: multi
173+
174+ ``` bash
175+ cd /vllm-workspace/vllm-ascend/
176+ # Run all single card the tests
177+ pytest -sv tests/ut
178+
179+ # Run single test
180+ pytest -sv tests/ut/test_ascend_config.py
181+ ```
182+ ::::
183+
184+ :::::
100185
101186### E2E test
102187
@@ -106,6 +191,12 @@ locally.
106191:::::{tab-set}
107192:sync-group: e2e
108193
194+ ::::{tab-item} Local (CPU)
195+ :sync: cpu
196+
197+ You can't run e2e test on CPU.
198+ ::::
199+
109200::::{tab-item} Single card
110201:selected:
111202:sync: single
0 commit comments