27038db3d6
Bumps [actions/cache](https://github.com/actions/cache) from 3.3.2 to 4.0.2. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3.3.2...v4.0.2) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
131 lines
4.8 KiB
YAML
131 lines
4.8 KiB
YAML
name: Build Wheels (CUDA)
|
|
|
|
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-20.04', 'windows-latest')
|
|
'pyver' = @("3.10", "3.11", "3.12")
|
|
'cuda' = @("12.1.1", "12.2.2", "12.3.2")
|
|
'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: ${{ matrix.os }}
|
|
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@v4
|
|
with:
|
|
python-version: ${{ matrix.pyver }}
|
|
|
|
- name: Setup Mamba
|
|
uses: conda-incubator/setup-miniconda@v3.0.4
|
|
with:
|
|
activate-environment: "build"
|
|
python-version: ${{ matrix.pyver }}
|
|
miniforge-variant: Mambaforge
|
|
miniforge-version: latest
|
|
use-mamba: true
|
|
add-pip-as-python-dependency: true
|
|
auto-activate-base: false
|
|
|
|
- name: VS Integration Cache
|
|
id: vs-integration-cache
|
|
if: runner.os == 'Windows'
|
|
uses: actions/cache@v4.0.2
|
|
with:
|
|
path: ./MSBuildExtensions
|
|
key: cuda-${{ matrix.cuda }}-vs-integration
|
|
|
|
- name: Get Visual Studio Integration
|
|
if: runner.os == 'Windows' && steps.vs-integration-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
if ($env:CUDAVER -eq '12.1.1') {$x = '12.1.0'} else {$x = $env:CUDAVER}
|
|
$links = (Invoke-RestMethod 'https://github.com/Jimver/cuda-toolkit/raw/dc0ca7bb29c5a92f7a963d3d5c93f8d59765136a/src/links/windows-links.ts').Trim().split().where({$_ -ne ''})
|
|
for ($i=$q=0;$i -lt $links.count -and $q -lt 2;$i++) {if ($links[$i] -eq "'$x',") {$q++}}
|
|
Invoke-RestMethod $links[$i].Trim("'") -OutFile 'cudainstaller.zip'
|
|
& 'C:\Program Files\7-Zip\7z.exe' e cudainstaller.zip -oMSBuildExtensions -r *\MSBuildExtensions\* > $null
|
|
Remove-Item 'cudainstaller.zip'
|
|
|
|
- name: Install Visual Studio Integration
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
$y = (gi '.\MSBuildExtensions').fullname + '\*'
|
|
(gi 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\*\BuildCustomizations').fullname.foreach({cp $y $_})
|
|
$cupath = 'CUDA_PATH_V' + $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','_')
|
|
echo "$cupath=$env:CONDA_PREFIX" >> $env:GITHUB_ENV
|
|
|
|
- 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: 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
|
|
if ($IsLinux) {
|
|
$env:LD_LIBRARY_PATH = $env:CONDA_PREFIX + '/lib:' + $env:LD_LIBRARY_PATH
|
|
}
|
|
$env:VERBOSE = '1'
|
|
$env:CMAKE_ARGS = '-DLLAMA_CUBLAS=on -DCMAKE_CUDA_ARCHITECTURES=all'
|
|
$env:CMAKE_ARGS = "-DLLAMA_CUDA_FORCE_MMQ=ON $env:CMAKE_ARGS"
|
|
if ($env:AVXVER -eq 'AVX') {
|
|
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DLLAMA_AVX2=off -DLLAMA_FMA=off -DLLAMA_F16C=off'
|
|
}
|
|
if ($env:AVXVER -eq 'AVX512') {
|
|
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DLLAMA_AVX512=on'
|
|
}
|
|
if ($env:AVXVER -eq 'basic') {
|
|
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_FMA=off -DLLAMA_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@v1
|
|
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 }}
|