install_vllm.sh 4.93 KB
Newer Older
1
2
3
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
4

5
6
7
8
# This script installs vLLM and its dependencies from PyPI (release versions only).
# Installation order:
# 1. LMCache (installed first so vLLM's dependencies take precedence)
# 2. vLLM
9
10
# 3. DeepGEMM
# 4. EP kernels
11
12
13

set -euo pipefail

14
VLLM_REF="v0.12.0"
15
16
17

# Basic Configurations
ARCH=$(uname -m)
18
19
MAX_JOBS=16
INSTALLATION_DIR=/tmp
20
21
22
23

# VLLM and Dependency Configurations
TORCH_CUDA_ARCH_LIST="9.0;10.0" # For EP Kernels
DEEPGEMM_REF=""
24
CUDA_VERSION="12.9"
25
FLASHINF_REF="v0.5.3"
26
# LMCache version - 0.3.9+ required for vLLM 0.11.2 compatibility
27
LMCACHE_REF="0.3.10"
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

while [[ $# -gt 0 ]]; do
    case $1 in
        --vllm-ref)
            VLLM_REF="$2"
            shift 2
            ;;
        --max-jobs)
            MAX_JOBS="$2"
            shift 2
            ;;
        --arch)
            ARCH="$2"
            shift 2
            ;;
        --installation-dir)
            INSTALLATION_DIR="$2"
            shift 2
            ;;
        --deepgemm-ref)
            DEEPGEMM_REF="$2"
            shift 2
            ;;
        --flashinf-ref)
            FLASHINF_REF="$2"
            shift 2
            ;;
55
56
        --lmcache-ref)
            LMCACHE_REF="$2"
57
58
            shift 2
            ;;
59
60
61
62
63
64
65
66
        --torch-cuda-arch-list)
            TORCH_CUDA_ARCH_LIST="$2"
            shift 2
            ;;
        --cuda-version)
            CUDA_VERSION="$2"
            shift 2
            ;;
67
        -h|--help)
68
            echo "Usage: $0 [--vllm-ref REF] [--max-jobs NUM] [--arch ARCH] [--deepgemm-ref REF] [--flashinf-ref REF] [--lmcache-ref REF] [--torch-cuda-arch-list LIST] [--cuda-version VERSION]"
69
            echo "Options:"
70
71
72
73
74
75
76
77
78
            echo "  --vllm-ref REF      vLLM release version (default: ${VLLM_REF})"
            echo "  --max-jobs NUM      Maximum parallel jobs (default: ${MAX_JOBS})"
            echo "  --arch ARCH         Architecture amd64|arm64 (default: auto-detect)"
            echo "  --installation-dir DIR  Install directory (default: ${INSTALLATION_DIR})"
            echo "  --deepgemm-ref REF  DeepGEMM git ref (default: ${DEEPGEMM_REF})"
            echo "  --flashinf-ref REF  FlashInfer version (default: ${FLASHINF_REF})"
            echo "  --lmcache-ref REF   LMCache version (default: ${LMCACHE_REF})"
            echo "  --torch-cuda-arch-list LIST  CUDA architectures (default: ${TORCH_CUDA_ARCH_LIST})"
            echo "  --cuda-version VERSION  CUDA version (default: ${CUDA_VERSION})"
79
80
81
82
83
84
85
86
87
            exit 0
            ;;
        *)
            echo "Unknown option: $1"
            exit 1
            ;;
    esac
done

88
89
90
91
92
93
94
# Convert x86_64 to amd64 for consistency with Docker ARG
if [ "$ARCH" = "x86_64" ]; then
    ARCH="amd64"
elif [ "$ARCH" = "aarch64" ]; then
    ARCH="arm64"
fi

95
96
97
export MAX_JOBS=$MAX_JOBS
export CUDA_HOME=/usr/local/cuda

98
99
100
# Derive torch backend from CUDA version (e.g., "12.9" -> "cu129")
TORCH_BACKEND="cu$(echo $CUDA_VERSION | tr -d '.')"

101
echo "=== Installing prerequisites ==="
102
103
uv pip install pip cuda-python

104
echo "\n=== Configuration Summary ==="
105
106
107
108
109
110
111
112
113
114
115
116
117
echo "  VLLM_REF=$VLLM_REF | ARCH=$ARCH | CUDA_VERSION=$CUDA_VERSION | TORCH_BACKEND=$TORCH_BACKEND"
echo "  FLASHINF_REF=$FLASHINF_REF | LMCACHE_REF=$LMCACHE_REF | DEEPGEMM_REF=$DEEPGEMM_REF"
echo "  TORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST | INSTALLATION_DIR=$INSTALLATION_DIR"

echo "\n=== Installing LMCache ==="
if [ "$ARCH" = "amd64" ]; then
    # LMCache installation currently fails on arm64 due to CUDA dependency issues
    # Install LMCache BEFORE vLLM so vLLM's dependencies take precedence
    uv pip install lmcache==${LMCACHE_REF} --torch-backend=${TORCH_BACKEND}
    echo "✓ LMCache ${LMCACHE_REF} installed"
else
    echo "⚠ Skipping LMCache on ARM64 (compatibility issues)"
fi
118

119
echo "\n=== Cloning vLLM repository ==="
120
# Clone needed for DeepGEMM and EP kernels install scripts
121
cd $INSTALLATION_DIR
122
git clone https://github.com/vllm-project/vllm.git vllm
123
124
125
cd vllm
git checkout $VLLM_REF

126
echo "\n=== Installing vLLM & FlashInfer ==="
127
echo "Installing vLLM $VLLM_REF from PyPI..."
128

129
130
131
uv pip install vllm[flashinfer]==$VLLM_REF --torch-backend=${TORCH_BACKEND}
uv pip install flashinfer-cubin==$FLASHINF_REF
uv pip install flashinfer-jit-cache==$FLASHINF_REF --extra-index-url https://flashinfer.ai/whl/${TORCH_BACKEND}
132

133
echo "✓ vLLM installation completed"
134

135
136
echo "\n=== Installing DeepGEMM ==="
cd $INSTALLATION_DIR/vllm/tools
137

138
139
if [ -n "$DEEPGEMM_REF" ]; then
    bash install_deepgemm.sh --cuda-version "${CUDA_VERSION}" --ref "$DEEPGEMM_REF"
140
else
141
    bash install_deepgemm.sh --cuda-version "${CUDA_VERSION}"
142
fi
143
144
145
146
echo "✓ DeepGEMM installation completed"

echo "\n=== Installing EP Kernels (PPLX and DeepEP) ==="
cd ep_kernels/
147
# TODO we will be able to specify which pplx and deepep commit we want in future
148
TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST" bash install_python_libraries.sh
149

Alec's avatar
Alec committed
150
echo "\n✅ All installations completed successfully!"