"tools/setup_helpers/extension.py" did not exist on "0d007b7d8f5cc5e23b725f72dd991a401f050dd8"
ci_install_dependency.sh 3.68 KB
Newer Older
1
#!/bin/bash
2
# Install the dependency in CI.
3
set -euxo pipefail
Lianmin Zheng's avatar
Lianmin Zheng committed
4

5
IS_BLACKWELL=${IS_BLACKWELL:-0}
Johnny's avatar
Johnny committed
6
7
8
9
10
11
12
CU_VERSION="cu129"

if [ "$CU_VERSION" = "cu130" ]; then
    NVRTC_SPEC="nvidia-cuda-nvrtc"
else
    NVRTC_SPEC="nvidia-cuda-nvrtc-cu12"
fi
Cheng Wan's avatar
Cheng Wan committed
13

14
# Kill existing processes
15
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
16
bash "${SCRIPT_DIR}/../killall_sglang.sh"
17
echo "CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES:-}"
18

Lianmin Zheng's avatar
Lianmin Zheng committed
19
20
# Clear torch compilation cache
python3 -c 'import os, shutil, tempfile, getpass; cache_dir = os.environ.get("TORCHINDUCTOR_CACHE_DIR") or os.path.join(tempfile.gettempdir(), "torchinductor_" + getpass.getuser()); shutil.rmtree(cache_dir, ignore_errors=True)'
21
rm -rf /root/.cache/flashinfer
Lianmin Zheng's avatar
Lianmin Zheng committed
22

23
# Install apt packages
Lianmin Zheng's avatar
Lianmin Zheng committed
24
apt install -y git libnuma-dev libssl-dev pkg-config
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Install protoc for router build (gRPC protobuf compilation)
if ! command -v protoc &> /dev/null; then
    echo "Installing protoc..."
    if command -v apt-get &> /dev/null; then
        # Ubuntu/Debian
        apt-get update
        apt-get install -y wget unzip gcc g++ perl make
    elif command -v yum &> /dev/null; then
        # RHEL/CentOS
        yum update -y
        yum install -y wget unzip gcc gcc-c++ perl-core make
    fi

    cd /tmp
    wget https://github.com/protocolbuffers/protobuf/releases/download/v32.0/protoc-32.0-linux-x86_64.zip
    unzip protoc-32.0-linux-x86_64.zip -d /usr/local
    rm protoc-32.0-linux-x86_64.zip
    protoc --version
    cd -
else
    echo "protoc already installed: $(protoc --version)"
fi

49
50
51
52
53
54
# Install uv
if [ "$IS_BLACKWELL" = "1" ]; then
    # The blackwell CI runner has some issues with pip and uv,
    # so we can only use pip with `--break-system-packages`
    PIP_CMD="pip"
    PIP_INSTALL_SUFFIX="--break-system-packages"
fzyzcjy's avatar
fzyzcjy committed
55

56
    # Clean up existing installations
Lianmin Zheng's avatar
Lianmin Zheng committed
57
    $PIP_CMD uninstall -y sgl-kernel sglang $PIP_INSTALL_SUFFIX || true
58
59
else
    # In normal cases, we use uv, which is much faster than pip.
Cheng Wan's avatar
Cheng Wan committed
60
    pip install --upgrade pip
61
62
    pip install uv
    export UV_SYSTEM_PYTHON=true
63

64
    PIP_CMD="uv pip"
65
    PIP_INSTALL_SUFFIX="--index-strategy unsafe-best-match"
66
67

    # Clean up existing installations
Lianmin Zheng's avatar
Lianmin Zheng committed
68
    $PIP_CMD uninstall sgl-kernel sglang || true
69
fi
Xiaoyu Zhang's avatar
Xiaoyu Zhang committed
70

Lianmin Zheng's avatar
Lianmin Zheng committed
71
72
# Install the main package
$PIP_CMD install -e "python[dev]" --extra-index-url https://download.pytorch.org/whl/${CU_VERSION} $PIP_INSTALL_SUFFIX
73

74
# Install router for pd-disagg test
75
$PIP_CMD install -e "sgl-router" $PIP_INSTALL_SUFFIX
76

Lianmin Zheng's avatar
Lianmin Zheng committed
77
# Install sgl-kernel
78
79
80
SGL_KERNEL_VERSION_FROM_KERNEL=$(grep -Po '(?<=^version = ")[^"]*' sgl-kernel/pyproject.toml)
SGL_KERNEL_VERSION_FROM_SRT=$(grep -Po -m1 '(?<=sgl-kernel==)[0-9A-Za-z\.\-]+' python/pyproject.toml)
echo "SGL_KERNEL_VERSION_FROM_KERNEL=${SGL_KERNEL_VERSION_FROM_KERNEL} SGL_KERNEL_VERSION_FROM_SRT=${SGL_KERNEL_VERSION_FROM_SRT}"
81

82
83
if [ "${CUSTOM_BUILD_SGL_KERNEL:-}" = "true" ]; then
    ls -alh sgl-kernel/dist
84
    $PIP_CMD install sgl-kernel/dist/sgl_kernel-${SGL_KERNEL_VERSION_FROM_KERNEL}-cp310-abi3-manylinux2014_x86_64.whl --force-reinstall $PIP_INSTALL_SUFFIX
85
else
Lianmin Zheng's avatar
Lianmin Zheng committed
86
    $PIP_CMD install sgl-kernel==${SGL_KERNEL_VERSION_FROM_SRT} --force-reinstall $PIP_INSTALL_SUFFIX
87
88
fi

89
# Show current packages
90
$PIP_CMD list
91

Johnny's avatar
Johnny committed
92
$PIP_CMD install mooncake-transfer-engine==0.3.6.post1 "${NVRTC_SPEC}" py-spy scipy huggingface_hub[hf_xet] $PIP_INSTALL_SUFFIX
93

94
if [ "$IS_BLACKWELL" != "1" ]; then
fzyzcjy's avatar
fzyzcjy committed
95
    # For lmms_evals evaluating MMMU
Johnny's avatar
Johnny committed
96
    git clone --branch v0.5 --depth 1 https://github.com/EvolvingLMMs-Lab/lmms-eval.git
97
    $PIP_CMD install -e lmms-eval/ $PIP_INSTALL_SUFFIX
98

fzyzcjy's avatar
fzyzcjy committed
99
    # Install xformers
100
101
102
    $PIP_CMD install xformers --index-url https://download.pytorch.org/whl/${CU_VERSION} --no-deps $PIP_INSTALL_SUFFIX
fi

103
# Show current packages
104
$PIP_CMD list
Lianmin Zheng's avatar
Lianmin Zheng committed
105
python3 -c "import torch; print(torch.version.cuda)"