Skip to content

Commit 35366e4

Browse files
committed
Separating the GitHub action cu124-126 workflows into independent cu124 and cu126 tasks
- Because a single task takes too long(5-6 hours), one of them might fail simultaneously. Recompiling would then require both tasks to run again, consuming even more time.
1 parent e1ade17 commit 35366e4

2 files changed

Lines changed: 136 additions & 2 deletions

File tree

.github/workflows/build-wheels-cu124-cu126-win.yml renamed to .github/workflows/build-wheels-cu124-win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Wheels (CU124-126) for Windows
1+
name: Build Wheels (CU124) for Windows
22

33
on:
44
workflow_dispatch:
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
os: ['windows-2022']
1616
pyver: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17-
cuda: ["12.4.1","12.6.3"]
17+
cuda: ["12.4.1"]
1818
releasetag: ["Basic"]
1919
cudaarch: ["all"]
2020
defaults:
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Build Wheels (CU126) for Windows
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
build_wheels:
11+
name: Build Wheel ${{ matrix.os }} ${{ matrix.pyver }} ${{ matrix.cuda }} ${{ matrix.releasetag }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: ['windows-2022']
16+
pyver: ["3.10", "3.11", "3.12", "3.13", "3.14"]
17+
cuda: ["12.6.3"]
18+
releasetag: ["Basic"]
19+
cudaarch: ["all"]
20+
defaults:
21+
run:
22+
shell: pwsh
23+
env:
24+
CUDAVER: ${{ matrix.cuda }}
25+
AVXVER: ${{ matrix.releasetag }}
26+
CUDAARCHVER: ${{ matrix.cudaarch }}
27+
# https://cmake.org/cmake/help/latest/prop_tgt/CUDA_ARCHITECTURES.html
28+
# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/#gpu-feature-list
29+
# e.g. "all" "89" "90" "100" "120"
30+
MAX_JOBS: 8
31+
32+
steps:
33+
- name: Add MSBuild to PATH
34+
if: runner.os == 'Windows'
35+
uses: microsoft/setup-msbuild@v2
36+
with:
37+
msbuild-architecture: x64
38+
39+
- uses: actions/checkout@v5
40+
with:
41+
submodules: "recursive"
42+
43+
# from kingbri1/flash-attention build-wheels.yml
44+
- name: Install CUDA ${{ matrix.cuda }}
45+
uses: N-Storm/cuda-toolkit@v0.2.28
46+
id: cuda-toolkit
47+
with:
48+
cuda: "${{ matrix.cuda }}"
49+
use-github-cache: false
50+
51+
# from astral-sh/setup-uv
52+
- name: Install the latest version of uv and set the python version
53+
uses: astral-sh/setup-uv@v6
54+
with:
55+
python-version: ${{ matrix.pyver }}
56+
activate-environment: true
57+
enable-cache: true
58+
59+
- name: Install Dependencies
60+
run: |
61+
git config --system core.longpaths true
62+
uv pip install --upgrade build setuptools wheel packaging
63+
64+
- name: Build Wheel
65+
run: |
66+
$cudaVersion = $env:CUDAVER.Remove($env:CUDAVER.LastIndexOf('.')).Replace('.','')
67+
$env:CUDA_HOME = $env:CUDA_PATH
68+
$env:CUDA_TOOLKIT_ROOT_DIR = $env:CUDA_PATH
69+
$env:VERBOSE = '1'
70+
$env:CMAKE_ARGS = '-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=' + $env:CUDAARCHVER + ' -DCMAKE_BUILD_PARALLEL_LEVEL=' + $env:MAX_JOBS
71+
$env:CMAKE_ARGS = "-DGGML_CUDA_FORCE_MMQ=on -DCUDA_SEPARABLE_COMPILATION=on $env:CMAKE_ARGS"
72+
$env:CMAKE_ARGS = "-DENABLE_CCACHE=on -DLLAMA_CURL=off $env:CMAKE_ARGS"
73+
74+
if ($env:AVXVER -eq 'AVX') {
75+
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX=on -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off'
76+
}
77+
if ($env:AVXVER -eq 'AVX2') {
78+
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX=on -DGGML_AVX2=on -DGGML_AVX512=off'
79+
}
80+
if ($env:AVXVER -eq 'AVXVNNI') {
81+
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX=on -DGGML_AVX2=on -DGGML_AVX_VNNI=on'
82+
}
83+
# if ($env:AVXVER -eq 'AVX512') {
84+
# $env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_AVX512=on'
85+
# }
86+
# Basic options for compiling without AVX instructions
87+
if ($env:AVXVER -eq 'Basic') {
88+
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_NATIVE=off -DGGML_AVX=off -DGGML_AVX2=off -DGGML_AVX_VNNI=off -DGGML_AVX512=off -DGGML_AVX512_VBMI=off -DGGML_AVX512_VNNI=off -DGGML_AVX512_BF16=off -DGGML_FMA=off -DGGML_F16C=off'
89+
}
90+
python -m build --wheel
91+
92+
# Check if wheel was built
93+
if (!(Test-Path '.\dist\*.whl')) {
94+
Write-Error "No wheel built in dist/ directory"
95+
exit 1
96+
}
97+
98+
$wheelFile = Get-Item '.\dist\*.whl' | Select-Object -First 1
99+
100+
# Split wheel filename: name-ver-py-abi-plat.whl
101+
$parts = $wheelFile.Name.Split('-')
102+
$distName = $parts[0]
103+
$version = $parts[1]
104+
$pyTag = $parts[2]
105+
$abiTag = $parts[3]
106+
$platTag = $parts[4]
107+
108+
$newVersion = "$version+cu$cudaVersion.$($env:AVXVER.ToLower())"
109+
110+
$newName = "$distName-$newVersion-$pyTag-$abiTag-$platTag"
111+
112+
# Rename wheel file
113+
Rename-Item -Path $wheelFile.FullName -NewName $newName
114+
Write-Output "Renamed wheel to: $newName"
115+
116+
# write the build tag to the output
117+
Write-Output "CUDA_VERSION=$cudaVersion" >> $env:GITHUB_ENV
118+
Write-Output "TAG_VERSION=$version" >> $env:GITHUB_ENV
119+
120+
- name: Get Current Date
121+
id: get-date
122+
run: |
123+
$currentDate = Get-Date -UFormat "%Y%m%d"
124+
Write-Output "BUILD_DATE=$currentDate" >> $env:GITHUB_ENV
125+
126+
- name: Create Release
127+
if: always() && env.TAG_VERSION != ''
128+
uses: softprops/action-gh-release@v2
129+
with:
130+
files: dist/*
131+
# Set tag_name to <tag>-cu<cuda_version>-<avxver>-win-<date>
132+
tag_name: v${{ env.TAG_VERSION }}-cu${{ env.CUDA_VERSION }}-${{ env.AVXVER }}-win-${{ env.BUILD_DATE }}
133+
env:
134+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)