test: change cmake cuda architecture. #64
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 (CUDA) (Linux) | |
on: | |
workflow_dispatch: | |
push: | |
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: | | |
# 'pyver' = @("3.7", "3.8", "3.9", "3.10", "3.11", "3.12") | |
$matrix = @{ | |
'os' = @('ubuntu-20.04') | |
'pyver' = @("3.10", "3.12") | |
'cuda' = @("12.4.1") | |
'releasetag' = @("basic") | |
} | |
$matrixOut = ConvertTo-Json $matrix -Compress | |
Write-Output ('matrix=' + $matrixOut) >> $env:GITHUB_OUTPUT | |
build_wheels: | |
name: Build Wheel ${{ matrix.os }} ${{ matrix.pyver }} ${{ matrix.cuda }} ${{ matrix.releasetag == 'wheels' && 'AVX2' || matrix.releasetag }} | |
needs: define_matrix | |
runs-on: sdk-linux-8-core | |
strategy: | |
matrix: ${{ fromJSON(needs.define_matrix.outputs.matrix) }} | |
defaults: | |
run: | |
shell: pwsh | |
env: | |
CUDAVER: ${{ matrix.cuda }} | |
AVXVER: ${{ matrix.releasetag }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "recursive" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.pyver }} | |
cache: "pip" | |
- name: Setup Mamba | |
uses: conda-incubator/setup-miniconda@v3.0.4 | |
with: | |
activate-environment: "build" | |
python-version: ${{ matrix.pyver }} | |
channels: conda-forge,defaults | |
channel-priority: true | |
mamba-version: "*" | |
add-pip-as-python-dependency: true | |
auto-activate-base: false | |
- name: Install Dependencies | |
env: | |
MAMBA_DOWNLOAD_FAILFAST: "0" | |
MAMBA_NO_LOW_SPEED_LIMIT: "1" | |
run: | | |
$cudaVersion = $env:CUDAVER | |
mamba install -y 'cuda' -c nvidia/label/cuda-$cudaVersion | |
python -m pip install build wheel | |
- name: Output CUDA Environment | |
run: | | |
echo "CUDA Environment Info:" | |
echo "----------------------" | |
which nvcc || echo "nvcc not found" | |
nvcc --version || echo "nvcc command failed" | |
# nvidia-smi || echo "nvidia-smi command failed" | |
echo "CUDA Home: $env:CUDA_HOME" | |
echo "LD_LIBRARY_PATH: $env:LD_LIBRARY_PATH" | |
- name: Build Wheel | |
run: | | |
$cudaVersion = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','') | |
$env:CUDA_PATH = $env:CONDA_PREFIX | |
$env:CUDA_HOME = $env:CONDA_PREFIX | |
$env:CUDA_TOOLKIT_ROOT_DIR = $env:CONDA_PREFIX | |
$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH | |
$env:VERBOSE = '1' | |
$env:CMAKE_BUILD_PARALLEL_LEVEL = $(nproc) | |
$env:CMAKE_ARGS = '-DSD_CUDA=ON -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=native' | |
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_CUDA_FORCE_MMQ=ON -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF' | |
python -m build --wheel | |
# write the build tag to the output | |
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV | |
- uses: softprops/action-gh-release@v2 | |
with: | |
files: dist/* | |
# Set tag_name to <tag>-cu<cuda_version> | |
tag_name: ${{ github.ref_name }}-cu${{ env.CUDA_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |