Build Wheels (ROCm) (Linux) #22
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
# 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 }} | |
# steps: | |
# - name: Define Job Output | |
# id: set-matrix | |
# run: | | |
# matrix=$(cat << 'EOL' | |
# {"os":["ubuntu-22.04"],"pyver":["3.11"],"rocm":["6.0.2"],"releasetag":["basic"]} | |
# EOL | |
# ) | |
# echo "matrix=$matrix" >> $GITHUB_OUTPUT | |
# shell: bash | |
# build_wheels: | |
# name: Build Wheel ${{ matrix.os }} ${{ matrix.pyver }} ROCm ${{ matrix.rocm }} ${{ matrix.releasetag }} | |
# needs: define_matrix | |
# runs-on: ${{ matrix.os }} | |
# container: rocm/dev-ubuntu-22.04:${{ matrix.rocm }} | |
# strategy: | |
# matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }} | |
# env: | |
# ROCMVER: ${{ matrix.rocm }} | |
# AVXVER: ${{ matrix.releasetag }} | |
# steps: | |
# - name: Install git on container | |
# run: | | |
# apt update | |
# apt install -y git\ | |
# - name: Install lsb-release | |
# run: sudo apt-get update && sudo apt-get install -y lsb-release | |
# - uses: actions/checkout@v4 | |
# with: | |
# submodules: "recursive" | |
# - name: Setup Python | |
# uses: actions/setup-python@v5 | |
# continue-on-error: true | |
# id: setup-python | |
# with: | |
# python-version: ${{ matrix.pyver }} | |
# cache: "pip" | |
# - name: Debug Python installation | |
# if: always() | |
# run: | | |
# echo "Python setup exit code: ${{ steps.setup-python.outcome }}" | |
# echo "Python location: ${{ env.pythonLocation }}" | |
# ls -la ${{ env.pythonLocation }}/bin | |
# ${{ env.pythonLocation }}/bin/python --version | |
# ${{ env.pythonLocation }}/bin/pip --version || echo "Pip not found" | |
# echo "PATH: $PATH" | |
# - name: Examine pip file | |
# if: always() | |
# run: | | |
# cat /__t/Python/3.11.9/x64/bin/pip | |
# - name: Reinstall pip | |
# if: always() | |
# run: | | |
# /__t/Python/3.11.9/x64/bin/python -m ensurepip --upgrade | |
# /__t/Python/3.11.9/x64/bin/python -m pip --version | |
# - name: Install pip manually | |
# if: failure() | |
# run: | | |
# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
# /__t/Python/3.11.9/x64/bin/python get-pip.py | |
# /__t/Python/3.11.9/x64/bin/python -m pip --version | |
# - name: Install build module | |
# run: | | |
# python -m pip install --upgrade pip | |
# python -m pip install build | |
# - name: Install Dependencies | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev rocm-libs | |
# - name: Set up ROCm environment | |
# run: | | |
# export ROCM_PATH=/opt/rocm | |
# export HIP_PATH=$ROCM_PATH/hip | |
# export PATH=$ROCM_PATH/bin:$PATH | |
# export LD_LIBRARY_PATH=$ROCM_PATH/lib:$LD_LIBRARY_PATH | |
# echo "ROCM_PATH=$ROCM_PATH" >> $GITHUB_ENV | |
# echo "HIP_PATH=$HIP_PATH" >> $GITHUB_ENV | |
# echo "PATH=$PATH" >> $GITHUB_ENV | |
# echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
# - name: Build Wheel with native CMake HIP support | |
# run: | | |
# export VERBOSE=1 | |
# export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) | |
# # Use command substitution to get the HIP compiler path | |
# HIP_COMPILER_PATH=$(hipconfig -l)/clang | |
# # Use the variable in CMAKE_ARGS | |
# export CMAKE_ARGS="-DGGML_HIPBLAS=ON -DCMAKE_HIP_COMPILER=${HIP_COMPILER_PATH}" | |
# export CMAKE_ARGS="$CMAKE_ARGS -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF" | |
# # Print CMAKE_ARGS for debugging | |
# echo "CMAKE_ARGS: $CMAKE_ARGS" | |
# # cmake -B build -S . $CMAKE_ARGS | |
# # cmake --build build --config Release -j $(nproc) | |
# python -m build --wheel | |
# - name: Prepare Release | |
# run: | | |
# ROCM_VERSION=$(echo $ROCMVER | tr -d '.') | |
# echo "ROCM_VERSION=$ROCM_VERSION" >> $GITHUB_ENV | |
# - uses: softprops/action-gh-release@v2 | |
# with: | |
# files: dist/* | |
# tag_name: ${{ github.ref_name }}-rocm${{ env.ROCM_VERSION }} | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Test ROCm Docker Build | |
name: Test ROCm Docker Build | |
on: workflow_dispatch | |
permissions: | |
contents: write | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
container: | |
image: rocm/dev-ubuntu-22.04:6.0.2 | |
options: --user root | |
steps: | |
- name: Install git on container | |
run: | | |
apt update | |
apt install -y git | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- name: Install dependencies | |
run: | | |
apt-get update | |
apt-get install -y python3-pip python3-venv rocm-libs | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
continue-on-error: true | |
id: setup-python | |
with: | |
python-version: ${{ matrix.pyver }} | |
cache: "pip" | |
- name: Set ROCm environment variables | |
run: | | |
echo "PATH=/opt/rocm/bin:$PATH" >> $GITHUB_ENV | |
echo "LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
- name: Install nexaai | |
run: | | |
. /opt/venv/bin/activate | |
CMAKE_ARGS="-DGGML_HIPBLAS=on" pip install nexaai | |
- name: Test nexa installation | |
run: | | |
. /opt/venv/bin/activate | |
nexa --version | |
- name: Test nexa gemma command | |
run: | | |
. /opt/venv/bin/activate | |
nexa run gemma --help |