-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa07682
commit 69f5d4a
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build Wheel | ||
on: | ||
push: | ||
branches: | ||
- ci-wheel | ||
tags: | ||
- "v[0-9]+*" | ||
|
||
env: | ||
TORCH_CUDA_ARCH_LIST: "8.0 8.6 8.9+PTX" # Need fix for 9.0 | ||
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 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: du -h dist/* | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheel-python${{ matrix.python }}-cuda${{ matrix.cuda }} | ||
path: dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/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="$HOME/.local/bin:$PATH" | ||
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::Install build system" | ||
pip install ninja numpy | ||
pip install --upgrade setuptools wheel build | ||
echo "::endgroup::" | ||
|
||
|
||
echo "::group::Build wheel for Punica" | ||
cd "$PROJECT_ROOT" | ||
python -m build --no-isolation | ||
echo "::endgroup::" |