Skip to content

Commit b79d0ec

Browse files
committed
[Iluvatar GPU] Add CI scripts
1 parent 52aca23 commit b79d0ec

File tree

4 files changed

+144
-1
lines changed

4 files changed

+144
-1
lines changed

.github/workflows/ci_iluvatar.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI_ILUVATAR
2+
3+
on:
4+
pull_request:
5+
branches: [ develop ]
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.event.pull_request.number }}-iluvatar-ci
10+
cancel-in-progress: true
11+
12+
jobs:
13+
CI_ILUVATAR:
14+
runs-on: [self-hosted, IXUCA]
15+
steps:
16+
- name: Print current runner name
17+
run: |
18+
echo "Current runner name: ${{ runner.name }}"
19+
# Because the system version is lower than 2.23, the checkout cannot be used.
20+
# - name: Checkout code
21+
# uses: actions/checkout@v4
22+
23+
- name: Code Checkout
24+
env:
25+
docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-ixuca:latest
26+
run: |
27+
REPO="https://github.com/${{ github.repository }}.git"
28+
FULL_REPO="${{ github.repository }}"
29+
REPO_NAME="${FULL_REPO##*/}"
30+
# Clean the repository directory before starting
31+
docker run --rm --net=host -v $(pwd):/workspace -w /workspace \
32+
-e "REPO_NAME=${REPO_NAME}" \
33+
${docker_image} /bin/bash -c '
34+
if [ -d ${REPO_NAME} ]; then
35+
echo "Directory ${REPO_NAME} exists, removing it..."
36+
rm -rf ${REPO_NAME}
37+
fi
38+
'
39+
git config --global user.name "FastDeployCI"
40+
git config --global user.email "fastdeploy_ci@example.com"
41+
git clone ${REPO} ${REPO_NAME}
42+
cd FastDeploy
43+
if [ "${{ github.event_name }}" = "pull_request" ]; then
44+
git fetch origin pull/${{ github.event.pull_request.number }}/head:pr/${{ github.event.pull_request.number }}
45+
git merge pr/${{ github.event.pull_request.number }}
46+
git log -n 3 --oneline
47+
else
48+
git checkout ${{ github.sha }}
49+
git log -n 3 --oneline
50+
fi
51+
52+
- name: Run CI unittest
53+
env:
54+
docker_image: ccr-2vdh3abv-pub.cnc.bj.baidubce.com/device/paddle-ixuca:latest
55+
run: |
56+
runner_name="${{ runner.name }}"
57+
last_char="${runner_name: -1}"
58+
59+
if [[ "$last_char" =~ [0-3] ]]; then
60+
gpu_id="$last_char"
61+
else
62+
gpu_id="0"
63+
fi
64+
FD_API_PORT=$((9180 + gpu_id * 100))
65+
FD_ENGINE_QUEUE_PORT=$((9150 + gpu_id * 100))
66+
FD_METRICS_PORT=$((9170 + gpu_id * 100))
67+
68+
PARENT_DIR=$(dirname "$WORKSPACE")
69+
echo "PARENT_DIR:$PARENT_DIR"
70+
docker run --rm --net=host --pid=host --cap-add=ALL --privileged --shm-size=64G \
71+
-v /usr/src:/usr/src -v /lib/modules:/lib/modules -v /dev:/dev \
72+
-v $(pwd):/workspace -w /workspace \
73+
-v "/data1/fastdeploy:/data1/fastdeploy" \
74+
-e "MODEL_PATH=/ssd3/model" \
75+
-e "http_proxy=$(git config --global --get http.proxy)" \
76+
-e "https_proxy=$(git config --global --get https.proxy)" \
77+
-e "FD_API_PORT=${FD_API_PORT}" \
78+
-e "FD_ENGINE_QUEUE_PORT=${FD_ENGINE_QUEUE_PORT}" \
79+
-e "FD_METRICS_PORT=${FD_METRICS_PORT}" \
80+
${docker_image} /bin/bash -c "
81+
git config --global --add safe.directory /workspace/FastDeploy
82+
cd FastDeploy
83+
bash scripts/run_ci_iluvatar.sh
84+
"

requirements_iluvatar.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
setuptools>=62.3.0,<80.0
1+
setuptools>=79.0.1,<80.0
22
pre-commit
33
yapf
44
flake8

scripts/run_ci_iluvatar.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
3+
echo "$DIR"
4+
5+
#先kill一遍
6+
ps -efww | grep -E 'run_ernie300B_4layer' | grep -v grep | awk '{print $2}' | xargs kill -9 || true
7+
ixsmi -r
8+
9+
export LD_PRELOAD=/usr/local/corex/lib64/libcuda.so.1
10+
ln -sf /usr/local/bin/python3 /usr/local/bin/python
11+
echo "pip requirements"
12+
python -m pip install -r requirements_iluvatar.txt
13+
echo "uninstall org"
14+
python -m pip uninstall paddlepaddle -y
15+
python -m pip uninstall paddle-iluvatar-gpu -y
16+
python -m pip install paddlepaddle==3.1.0a0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
17+
# TODO: Change to open access URL
18+
# python -m pip install --pre paddle-iluvatar-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/ixuca/
19+
python -m pip install /data1/fastdeploy/packages/paddle_iluvatar_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
20+
# Patch, remove if image updated
21+
cp /data1/fastdeploy/packages/cusolver.h /usr/local/lib/python3.10/site-packages/paddle/include/paddle/phi/backends/dynload/cusolver.h
22+
echo "build whl"
23+
bash build.sh || exit 1
24+
25+
unset http_proxy
26+
unset https_proxy
27+
unset no_proxy
28+
29+
rm -rf log/*
30+
export INFERENCE_MSG_QUEUE_ID=232132
31+
export FD_DEBUG=1
32+
export PADDLE_XCCL_BACKEND=iluvatar_gpu
33+
python test/ci_use/iluvatar_UT/run_ernie300B_4layer.py
34+
exit_code=$?
35+
echo exit_code is ${exit_code}
36+
37+
ps -efww | grep -E 'run_ernie300B_4layer' | grep -v grep | awk '{print $2}' | xargs kill -9 || true
38+
39+
if [ ${exit_code} -ne 0 ]; then
40+
echo "log/workerlog.0"
41+
cat log/workerlog.0
42+
exit 1
43+
fi
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from fastdeploy import LLM, SamplingParams
2+
3+
prompts = [
4+
"Hello, my name is",
5+
]
6+
7+
# 采样参数
8+
sampling_params = SamplingParams(temperature=0.8, top_p=0.00001, max_tokens=16)
9+
10+
# 加载模型
11+
llm = LLM(model="/data1/fastdeploy/ERNIE_300B_4L", tensor_parallel_size=16, max_model_len=8192, static_decode_blocks=0, quantization='wint8', block_size=16)
12+
13+
# 批量进行推理(llm内部基于资源情况进行请求排队、动态插入处理)
14+
outputs = llm.generate(prompts, sampling_params)
15+
16+
assert outputs[0].outputs.token_ids==[23768, 97000, 47814, 59335, 68170, 183, 49080, 94717, 82966, 99140, 31615, 51497, 94851, 60764, 10889, 2]

0 commit comments

Comments
 (0)