-
Notifications
You must be signed in to change notification settings - Fork 788
196 lines (160 loc) · 5.76 KB
/
build-wheels-rocm-linux.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# 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