|
1 | 1 | #!/bin/bash
|
2 | 2 | set -ex
|
| 3 | + |
3 | 4 | PYTHON_VERSION=$1
|
4 | 5 | CUDA_VERSION=$2
|
5 | 6 | PYTHON_ROOT_PATH=/opt/python/cp${PYTHON_VERSION//.}-cp${PYTHON_VERSION//.}
|
| 7 | +ENABLE_SM90A=$(( ${CUDA_VERSION%.*} >= 12 ? ON : OFF )) |
6 | 8 |
|
7 |
| -if (( ${CUDA_VERSION%.*} < 12 )); then |
8 |
| - ENABLE_SM90A=0 |
| 9 | +if [ ${CUDA_VERSION} = "12.8" ]; then |
| 10 | + DOCKER_IMAGE="pytorch/manylinux2_28-builder:cuda${CUDA_VERSION}" |
| 11 | + TORCH_INSTALL="pip install --no-cache-dir --pre torch --index-url https://download.pytorch.org/whl/nightly/cu${CUDA_VERSION//.}" |
9 | 12 | else
|
10 |
| - ENABLE_SM90A=1 |
| 13 | + DOCKER_IMAGE="pytorch/manylinux-builder:cuda${CUDA_VERSION}" |
| 14 | + TORCH_INSTALL="pip install --no-cache-dir torch==2.5.1 --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION//.}" |
11 | 15 | fi
|
12 | 16 |
|
13 | 17 | docker run --rm \
|
14 |
| - -v $(pwd):/sgl-kernel \ |
15 |
| - pytorch/manylinux-builder:cuda${CUDA_VERSION} \ |
16 |
| - bash -c " |
17 |
| - ${PYTHON_ROOT_PATH}/bin/pip install --no-cache-dir torch==2.5.1 --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION//.} && \ |
18 |
| - ${PYTHON_ROOT_PATH}/bin/pip install --no-cache-dir ninja setuptools==75.0.0 wheel==0.41.0 numpy uv && \ |
19 |
| - export TORCH_CUDA_ARCH_LIST='7.5 8.0 8.9 9.0+PTX' && \ |
20 |
| - export CUDA_VERSION=${CUDA_VERSION} && \ |
21 |
| - export SGL_KERNEL_ENABLE_BF16=1 && \ |
22 |
| - export SGL_KERNEL_ENABLE_FP8=1 && \ |
23 |
| - export SGL_KERNEL_ENABLE_SM90A=${ENABLE_SM90A} && \ |
24 |
| - mkdir -p /usr/lib/x86_64-linux-gnu/ && \ |
25 |
| - ln -s /usr/local/cuda-${CUDA_VERSION}/targets/x86_64-linux/lib/stubs/libcuda.so /usr/lib/x86_64-linux-gnu/libcuda.so && \ |
26 |
| - cd /sgl-kernel && \ |
27 |
| - ls -la ${PYTHON_ROOT_PATH}/lib/python${PYTHON_VERSION}/site-packages/wheel/ && \ |
28 |
| - PYTHONPATH=${PYTHON_ROOT_PATH}/lib/python${PYTHON_VERSION}/site-packages ${PYTHON_ROOT_PATH}/bin/python -m uv build --wheel -Cbuild-dir=build . --color=always && \ |
29 |
| - ./rename_wheels.sh |
30 |
| - " |
| 18 | + -v $(pwd):/sgl-kernel \ |
| 19 | + ${DOCKER_IMAGE} \ |
| 20 | + bash -c " |
| 21 | + ${PYTHON_ROOT_PATH}/bin/${TORCH_INSTALL} && \ |
| 22 | + ${PYTHON_ROOT_PATH}/bin/pip install --no-cache-dir ninja setuptools==75.0.0 wheel==0.41.0 numpy uv && \ |
| 23 | + export TORCH_CUDA_ARCH_LIST='7.5 8.0 8.9 9.0+PTX' && \ |
| 24 | + export CUDA_VERSION=${CUDA_VERSION} && \ |
| 25 | + mkdir -p /usr/lib/x86_64-linux-gnu/ && \ |
| 26 | + ln -s /usr/local/cuda-${CUDA_VERSION}/targets/x86_64-linux/lib/stubs/libcuda.so /usr/lib/x86_64-linux-gnu/libcuda.so && \ |
| 27 | + cd /sgl-kernel && \ |
| 28 | + ls -la ${PYTHON_ROOT_PATH}/lib/python${PYTHON_VERSION}/site-packages/wheel/ && \ |
| 29 | + PYTHONPATH=${PYTHON_ROOT_PATH}/lib/python${PYTHON_VERSION}/site-packages ${PYTHON_ROOT_PATH}/bin/python -m uv build --wheel -Cbuild-dir=build . --color=always && \ |
| 30 | + ./rename_wheels.sh |
| 31 | + " |
0 commit comments