Skip to content

Build Wheels (ROCm) (Linux) #37

Build Wheels (ROCm) (Linux)

Build Wheels (ROCm) (Linux) #37

name: Build Wheels (ROCm) (Linux)
on:
workflow_dispatch:
permissions:
contents: write
jobs:
define_matrix:
name: Define Build Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
defaults:
run:
shell: pwsh
steps:
- name: Define Job Output
id: set-matrix
run: |
$matrix = @{
'os' = @('ubuntu-22.04')
'pyver' = @("3.7", "3.8", "3.9", "3.10", "3.11", "3.12")
'rocm' = @("6.2.1")
'releasetag' = @("basic")
}
$matrixOut = ConvertTo-Json $matrix -Compress
Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT
build_wheels:
name: Build Wheel ${{ matrix.os }} ${{ matrix.pyver }} ROCm ${{ matrix.rocm }} ${{ matrix.releasetag }}
needs: define_matrix
runs-on: linux-ubuntu-22.04
strategy:
matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }}
defaults:
run:
shell: bash
env:
ROCMVER: ${{ matrix.rocm }}
AVXVER: ${{ matrix.releasetag }}
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyver }}
cache: "pip"
- name: Install ROCm Toolkit
run: |
sudo apt update
sudo apt install "linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)"
sudo usermod -a -G render,video $LOGNAME # Add the current user to the render and video groups
wget https://repo.radeon.com/amdgpu-install/6.2.1/ubuntu/jammy/amdgpu-install_6.2.60201-1_all.deb
sudo apt install ./amdgpu-install_6.2.60201-1_all.deb
sudo apt update
sudo apt install amdgpu-dkms rocm
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential git cmake
python -m pip install build wheel
- name: Build Wheel
run: |
export CMAKE_ARGS='-DGGML_HIPBLAS=ON'
python -m build --wheel
# Extract ROCm version without dots
ROCM_VERSION=$(echo $ROCMVER | tr -d '.')
echo "ROCM_VERSION=$ROCM_VERSION" >> $GITHUB_ENV
- uses: softprops/action-gh-release@v2
with:
files: dist/*
# Set tag_name to <tag>-rocm<rocm_version>
tag_name: ${{ github.ref_name }}-rocm${{ env.ROCM_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}