Skip to content

Commit 733f79a

Browse files
authored
Creating ROCm whl upon release (#259)
* Creating ROCm whl upon release
1 parent 353cfeb commit 733f79a

File tree

2 files changed

+35
-49
lines changed

2 files changed

+35
-49
lines changed

.github/workflows/publish.yml

+26-40
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ jobs:
1616
release:
1717
# Retrieve tag and create release
1818
name: Create Release
19-
runs-on: ubuntu-latest
19+
runs-on: self-hosted
20+
container:
21+
image: rocm/pytorch:rocm6.2_ubuntu20.04_py3.9_pytorch_release_2.3.0
2022
outputs:
2123
upload_url: ${{ steps.create_release.outputs.upload_url }}
2224
steps:
@@ -41,57 +43,39 @@ jobs:
4143
4244
wheel:
4345
name: Build Wheel
44-
runs-on: ${{ matrix.os }}
46+
runs-on: self-hosted
47+
container:
48+
image: rocm/pytorch:rocm6.2_ubuntu20.04_py3.9_pytorch_release_2.3.0
4549
needs: release
4650

4751
strategy:
4852
fail-fast: false
49-
matrix:
50-
os: ['ubuntu-20.04']
51-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
52-
pytorch-version: ['2.4.0'] # Must be the most recent version that meets requirements-cuda.txt.
53-
cuda-version: ['11.8', '12.1']
5453

5554
steps:
56-
- name: Checkout
57-
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
58-
59-
- name: Setup ccache
60-
uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
61-
with:
62-
create-symlink: true
63-
key: ${{ github.job }}-${{ matrix.python-version }}-${{ matrix.cuda-version }}
64-
65-
- name: Set up Linux Env
66-
if: ${{ runner.os == 'Linux' }}
67-
run: |
68-
bash -x .github/workflows/scripts/env.sh
69-
70-
- name: Set up Python
71-
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
72-
with:
73-
python-version: ${{ matrix.python-version }}
74-
75-
- name: Install CUDA ${{ matrix.cuda-version }}
55+
- name: Prepare
7656
run: |
77-
bash -x .github/workflows/scripts/cuda-install.sh ${{ matrix.cuda-version }} ${{ matrix.os }}
57+
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2
58+
pip3 install -U triton
7859
79-
- name: Install PyTorch ${{ matrix.pytorch-version }} with CUDA ${{ matrix.cuda-version }}
80-
run: |
81-
bash -x .github/workflows/scripts/pytorch-install.sh ${{ matrix.python-version }} ${{ matrix.pytorch-version }} ${{ matrix.cuda-version }}
60+
- name: Checkout
61+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
8262

8363
- name: Build wheel
8464
shell: bash
8565
env:
8666
CMAKE_BUILD_TYPE: Release # do not compile with debug symbol to reduce wheel size
8767
run: |
88-
bash -x .github/workflows/scripts/build.sh ${{ matrix.python-version }} ${{ matrix.cuda-version }}
68+
bash -x .github/workflows/scripts/build.sh
8969
wheel_name=$(find dist -name "*whl" -print0 | xargs -0 -n 1 basename)
9070
asset_name=${wheel_name//"linux"/"manylinux1"}
71+
gradlib_wheel_name=$(find gradlib/dist -name "*whl" -print0 | xargs -0 -n 1 basename)
72+
gradlib_asset_name=${gradlib_wheel_name//"linux"/"manylinux1"}
9173
echo "wheel_name=${wheel_name}" >> "$GITHUB_ENV"
9274
echo "asset_name=${asset_name}" >> "$GITHUB_ENV"
75+
echo "gradlib_wheel_name=${gradlib_wheel_name}" >> "$GITHUB_ENV"
76+
echo "gradlib_asset_name=${gradlib_asset_name}" >> "$GITHUB_ENV"
9377
94-
- name: Upload Release Asset
78+
- name: Upload vllm Release Asset
9579
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
9680
env:
9781
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -100,11 +84,13 @@ jobs:
10084
asset_path: ./dist/${{ env.wheel_name }}
10185
asset_name: ${{ env.asset_name }}
10286
asset_content_type: application/*
87+
- name: Upload gradlib Release Asset
88+
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
upload_url: ${{ needs.release.outputs.upload_url }}
93+
asset_path: ./gradlib/dist/${{ env.gradlib_wheel_name }}
94+
asset_name: ${{ env.gradlib_asset_name }}
95+
asset_content_type: application/*
10396

104-
# (Danielkinz): This last step will publish the .whl to pypi. Warning: untested
105-
# - name: Publish package
106-
# uses: pypa/gh-action-pypi-publish@release/v1.8
107-
# with:
108-
# repository-url: https://test.pypi.org/legacy/
109-
# password: ${{ secrets.PYPI_API_TOKEN }}
110-
# skip-existing: true

.github/workflows/scripts/build.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
#!/bin/bash
22
set -eux
33

4-
python_executable=python$1
5-
cuda_home=/usr/local/cuda-$2
4+
python_executable=python3
65

76
# Update paths
8-
PATH=${cuda_home}/bin:$PATH
9-
LD_LIBRARY_PATH=${cuda_home}/lib64:$LD_LIBRARY_PATH
10-
117
# Install requirements
12-
$python_executable -m pip install -r requirements-build.txt -r requirements-cuda.txt
8+
$python_executable -m pip install -r requirements-rocm.txt
139

1410
# Limit the number of parallel jobs to avoid OOM
1511
export MAX_JOBS=1
1612
# Make sure release wheels are built for the following architectures
17-
export TORCH_CUDA_ARCH_LIST="7.0 7.5 8.0 8.6 8.9 9.0+PTX"
18-
export VLLM_FA_CMAKE_GPU_ARCHES="80-real;90-real"
13+
export PYTORCH_ROCM_ARCH="gfx90a;gfx942"
14+
15+
rm -f $(which sccache)
1916

20-
bash tools/check_repo.sh
17+
export MAX_JOBS=32
2118

2219
# Build
2320
$python_executable setup.py bdist_wheel --dist-dir=dist
21+
cd gradlib
22+
$python_executable setup.py bdist_wheel --dist-dir=dist
23+
cd ..

0 commit comments

Comments
 (0)