build.sh 999 B

123456789101112131415161718
  1. #!/bin/bash
  2. # Fetch FlashKDA (with cutlass) and vLLM's registration shim, then build
  3. # _flashkda_C.so into /out. The base image has curl but no git.
  4. set -euo pipefail
  5. : "${FLASHKDA_REF:?}" "${CUTLASS_REF:?}" "${VLLM_REF:?}"
  6. cd /build
  7. mkdir -p flashkda/cutlass vllm-csrc/core /out
  8. curl -fsSL "https://github.com/vllm-project/FlashKDA/archive/${FLASHKDA_REF}.tar.gz" \
  9. | tar xz --strip-components=1 -C flashkda
  10. curl -fsSL "https://github.com/NVIDIA/cutlass/archive/${CUTLASS_REF}.tar.gz" \
  11. | tar xz --strip-components=1 -C flashkda/cutlass
  12. raw="https://raw.githubusercontent.com/vllm-project/vllm/${VLLM_REF}/csrc"
  13. curl -fsSL -o vllm-csrc/flashkda_registration.cpp "$raw/flashkda_registration.cpp"
  14. curl -fsSL -o vllm-csrc/core/registration.h "$raw/core/registration.h"
  15. # setup.py passes -gencode itself, which stops torch guessing arches with no GPU.
  16. MAX_JOBS="$(nproc)" python3 setup.py build_ext --inplace
  17. cp _flashkda_C*.so /out/_flashkda_C.abi3.so
  18. echo "$FLASHKDA_REF" > /out/FLASHKDA_REF