Skip to content

Commit 43bf95c

Browse files
committed
add unittest following build
1 parent ff96843 commit 43bf95c

7 files changed

+114
-6
lines changed

.github/workflows/nightly-release.yml

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,69 @@ jobs:
277277
done
278278
done
279279
280+
test-nightly-build:
281+
needs: [setup, build-flashinfer-python, build-flashinfer-cubin, build-flashinfer-jit-cache]
282+
strategy:
283+
fail-fast: false
284+
matrix:
285+
cuda: ["12.9", "13.0"]
286+
test-shard: [1, 2, 3, 4, 5]
287+
runs-on: [self-hosted, G5, X64]
288+
289+
steps:
290+
- name: Display Machine Information
291+
run: |
292+
echo "CPU: $(nproc) cores, $(lscpu | grep 'Model name' | cut -d':' -f2 | xargs)"
293+
echo "RAM: $(free -h | awk '/^Mem:/ {print $7 " available out of " $2}')"
294+
echo "Disk: $(df -h / | awk 'NR==2 {print $4 " available out of " $2}')"
295+
echo "Architecture: $(uname -m)"
296+
nvidia-smi
297+
298+
- name: Checkout code
299+
uses: actions/checkout@v4
300+
with:
301+
submodules: true
302+
303+
- name: Set up Python
304+
uses: actions/setup-python@v5
305+
with:
306+
python-version: '3.10'
307+
308+
- name: Download flashinfer-python artifact
309+
uses: actions/download-artifact@v4
310+
with:
311+
name: flashinfer-python-sdist
312+
path: dist-python/
313+
314+
- name: Download flashinfer-cubin artifact
315+
uses: actions/download-artifact@v4
316+
with:
317+
name: flashinfer-cubin-wheel
318+
path: dist-cubin/
319+
320+
- name: Download flashinfer-jit-cache artifact
321+
uses: actions/download-artifact@v4
322+
with:
323+
name: jit-cache-cu${{ matrix.cuda == '12.9' && '129' || '130' }}-x86_64
324+
path: dist-jit-cache/
325+
326+
- name: Get Docker image tag
327+
id: docker-tag
328+
run: |
329+
CUDA_VERSION="cu${{ matrix.cuda == '12.9' && '129' || '130' }}"
330+
DOCKER_TAG=$(grep "flashinfer/flashinfer-ci-${CUDA_VERSION}" ci/docker-tags.yml | cut -d':' -f2 | tr -d ' ')
331+
echo "cuda_version=${CUDA_VERSION}" >> $GITHUB_OUTPUT
332+
echo "tag=${DOCKER_TAG}" >> $GITHUB_OUTPUT
333+
334+
- name: Run nightly build tests in Docker (shard ${{ matrix.test-shard }})
335+
env:
336+
CUDA_VISIBLE_DEVICES: 0
337+
run: |
338+
DOCKER_IMAGE="flashinfer/flashinfer-ci-${{ steps.docker-tag.outputs.cuda_version }}:${{ steps.docker-tag.outputs.tag }}"
339+
bash ci/bash.sh ${DOCKER_IMAGE} -e TEST_SHARD ${{ matrix.test-shard }} ./scripts/task_test_nightly_build.sh
340+
280341
update-wheel-index:
281-
needs: [setup, create-release]
342+
needs: [setup, create-release, test-nightly-build]
282343
runs-on: ubuntu-latest
283344
steps:
284345
- name: Checkout flashinfer repo

scripts/task_jit_run_tests_part1.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ set -eo pipefail
44
set -x
55
: ${MAX_JOBS:=$(nproc)}
66
: ${CUDA_VISIBLE_DEVICES:=0}
7+
: ${SKIP_INSTALL:=0}
78

8-
pip install -e . -v
9+
if [ "$SKIP_INSTALL" = "0" ]; then
10+
pip install -e . -v
11+
fi
912

1013
# pytest -s tests/gemm/test_group_gemm.py
1114
pytest -s tests/attention/test_logits_cap.py

scripts/task_jit_run_tests_part2.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ set -eo pipefail
44
set -x
55
: ${MAX_JOBS:=$(nproc)}
66
: ${CUDA_VISIBLE_DEVICES:=0}
7+
: ${SKIP_INSTALL:=0}
78

8-
pip install -e . -v
9+
if [ "$SKIP_INSTALL" = "0" ]; then
10+
pip install -e . -v
11+
fi
912

1013
pytest -s tests/utils/test_block_sparse.py
1114
pytest -s tests/utils/test_jit_example.py

scripts/task_jit_run_tests_part3.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ set -eo pipefail
44
set -x
55
: ${MAX_JOBS:=$(nproc)}
66
: ${CUDA_VISIBLE_DEVICES:=0}
7+
: ${SKIP_INSTALL:=0}
78

8-
pip install -e . -v
9+
if [ "$SKIP_INSTALL" = "0" ]; then
10+
pip install -e . -v
11+
fi
912

1013
pytest -s tests/utils/test_sampling.py

scripts/task_jit_run_tests_part4.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ set -eo pipefail
44
set -x
55
: ${MAX_JOBS:=$(nproc)}
66
: ${CUDA_VISIBLE_DEVICES:=0}
7+
: ${SKIP_INSTALL:=0}
78

8-
pip install -e . -v
9+
if [ "$SKIP_INSTALL" = "0" ]; then
10+
pip install -e . -v
11+
fi
912

1013
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True # avoid memory fragmentation
1114
pytest -s tests/attention/test_deepseek_mla.py

scripts/task_jit_run_tests_part5.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ set -eo pipefail
44
set -x
55
: ${MAX_JOBS:=$(nproc)}
66
: ${CUDA_VISIBLE_DEVICES:=0}
7+
: ${SKIP_INSTALL:=0}
78

8-
pip install -e . -v
9+
if [ "$SKIP_INSTALL" = "0" ]; then
10+
pip install -e . -v
11+
fi
912

1013
pytest -s tests/utils/test_logits_processor.py

scripts/task_test_nightly_build.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
set -x
5+
6+
# This script installs nightly build packages and runs tests
7+
# Expected dist directories to be in current directory or specified via env vars
8+
9+
: ${TEST_SHARD:=1}
10+
: ${CUDA_VISIBLE_DEVICES:=0}
11+
: ${DIST_CUBIN_DIR:=dist-cubin}
12+
: ${DIST_JIT_CACHE_DIR:=dist-jit-cache}
13+
: ${DIST_PYTHON_DIR:=dist-python}
14+
15+
# Install flashinfer packages
16+
echo "Installing flashinfer-cubin from ${DIST_CUBIN_DIR}..."
17+
pip install ${DIST_CUBIN_DIR}/*.whl
18+
19+
echo "Installing flashinfer-jit-cache from ${DIST_JIT_CACHE_DIR}..."
20+
pip install ${DIST_JIT_CACHE_DIR}/*.whl
21+
22+
echo "Installing flashinfer-python from ${DIST_PYTHON_DIR}..."
23+
pip install ${DIST_PYTHON_DIR}/*.tar.gz
24+
25+
# Verify installation
26+
echo "Verifying installation..."
27+
python -m flashinfer show-config
28+
29+
# Run test shard
30+
echo "Running test shard ${TEST_SHARD}..."
31+
export SKIP_INSTALL=1
32+
bash scripts/task_jit_run_tests_part${TEST_SHARD}.sh

0 commit comments

Comments
 (0)