Skip to content

Commit

Permalink
ci-wheel-1
Browse files Browse the repository at this point in the history
  • Loading branch information
abcdabcd987 committed Dec 22, 2023
1 parent aa07682 commit 066d50e
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Wheel
on:
push:
branches:
- ci-wheel
tags:
- "v[0-9]+*"

env:
TORCH_CUDA_ARCH_LIST: "8.0 8.6 8.9 9.0+PTX"
PUNICA_CI_TORCH_VERSION: "2.1.0"

jobs:
build:
strategy:
fail-fast: false
matrix:
python: ["3.10"]
cuda: ["11.8", "12.1"]
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Build wheel
run: |
chown -R $CI_UID:$CI_GID "$GITHUB_WORKSPACE"
version="$(cat /app/version.txt)"
docker run --rm -t \
-v "$CI_RUNNER_CACHE_DIR":/ci-cache \
-v "$GITHUB_WORKSPACE":/app \
-e PUNICA_CI_PYTHON_VERSION=${{ matrix.python }} \
-e PUNICA_CI_CUDA_VERSION=${{ matrix.cuda }} \
-e PUNICA_CI_TORCH_VERSION=$PUNICA_CI_TORCH_VERSION \
-e PUNICA_BUILD_VERSION=$version \
-e TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST" \
--user $CI_UID:$CI_GID \
pytorch/manylinux-builder:cuda${{ matrix.cuda }} \
bash /app/ci/run-ci-build-wheel.bash
- run: |
cd /app
du -h dist/*
- uses: actions/upload-artifact@v4
with:
name: wheel-python${{ matrix.python }}-cuda${{ matrix.cuda }}
path: /app/dist/*
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include version.txt
recursive-include csrc *
recursive-include third_party/cutlass/include *
recursive-include third_party/flashinfer/include *
Expand Down
38 changes: 38 additions & 0 deletions ci/run-ci-build-wheel.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
set -e

assert_env() {
local var_name="$1"
if [ -z "${!var_name}" ]; then
echo "Error: Environment variable '$var_name' is not set."
exit 1
fi
}

assert_env PUNICA_CI_PYTHON_VERSION
assert_env PUNICA_CI_TORCH_VERSION
assert_env PUNICA_CI_CUDA_VERSION
assert_env PUNICA_BUILD_VERSION
assert_env TORCH_CUDA_ARCH_LIST
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
export CONDA_pkgs_dirs=/ci-cache/conda-pkgs
export XDG_CACHE_HOME=/ci-cache/xdg-cache
mkdir -p "$CONDA_pkgs_dirs" "$XDG_CACHE_HOME"
export HOME=/tmp/home
mkdir -p $HOME
CUDA_MAJOR="${PUNICA_CI_CUDA_VERSION%.*}"
CUDA_MINOR="${PUNICA_CI_CUDA_VERSION#*.}"
PYVER="${PUNICA_CI_PYTHON_VERSION//./}"
export PATH="/opt/python/cp${PYVER}-cp${PYVER}/bin:$PATH"


echo "::group::Install PyTorch"
pip install torch==$PUNICA_CI_TORCH_VERSION --index-url "https://download.pytorch.org/whl/cu${CUDA_MAJOR}${CUDA_MINOR}"
echo "::endgroup::"


echo "::group::Build wheel for Punica"
cd "$PROJECT_ROOT"
pip install ninja numpy build
python -m build --no-isolation
echo "::endgroup::"

0 comments on commit 066d50e

Please sign in to comment.