build.sh 867 Bytes
Newer Older
1
2
#!/bin/bash
set -ex
3
4
5
PYTHON_VERSION=$1
CUDA_VERSION=$2
PYTHON_ROOT_PATH=/opt/python/cp${PYTHON_VERSION//.}-cp${PYTHON_VERSION//.}
6

7
docker run --rm \
8
    -v "$(pwd)":/sgl-kernel \
9
    pytorch/manylinux-builder:cuda${CUDA_VERSION} \
10
    bash -c "
11
    ${PYTHON_ROOT_PATH}/bin/pip install --no-cache-dir torch==2.5.1 --index-url https://download.pytorch.org/whl/cu${CUDA_VERSION//.} && \
12
    export TORCH_CUDA_ARCH_LIST='7.5 8.0 8.9 9.0+PTX' && \
13
    export CUDA_VERSION=${CUDA_VERSION} && \
14
15
16
    export SGL_KERNEL_ENABLE_BF16=1 && \
    export SGL_KERNEL_ENABLE_FP8=1 && \
    export SGL_KERNEL_ENABLE_SM90A=1 && \
17
18
    mkdir -p /usr/lib/x86_64-linux-gnu/ && \
    ln -s /usr/local/cuda-${CUDA_VERSION}/targets/x86_64-linux/lib/stubs/libcuda.so /usr/lib/x86_64-linux-gnu/libcuda.so && \
19
    cd /sgl-kernel && \
20
    ${PYTHON_ROOT_PATH}/bin/python setup.py bdist_wheel
21
    "