forked from primesearch/mfaktc
-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (217 loc) · 11.3 KB
/
build.yml
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Build mfaktc software
on:
push:
pull_request:
workflow_dispatch:
jobs:
# Begin job "build-linux"
build-linux:
runs-on: ubuntu-latest
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: true
matrix:
sys:
# Specified version combination must exist as CUDA container image from NVidia: nvcr.io/nvidia/cuda:${{ matrix.sys.cuda_version }}-devel-${{ matrix.sys.ct_os }}
# Available versions can be found here: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags (note that only Ubuntus are supported by this action)
- { cuda_version: '12.8.0', ct_os: 'ubuntu24.04' }
- { cuda_version: '12.6.3', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.6.2', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.6.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.6.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.5.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.5.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.4.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.4.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.3.2', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.3.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.3.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.2.2', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.2.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.1.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.1.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.0.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.0.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.8.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.7.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.6.2', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.6.1', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.5.2', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.4.3', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.3.1', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.2.2', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.1.1', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.0.3', ct_os: 'ubuntu20.04' }
- { cuda_version: '10.2', ct_os: 'ubuntu18.04' }
- { cuda_version: '9.2', ct_os: 'ubuntu18.04' }
- { cuda_version: '8.0', ct_os: 'ubuntu16.04' }
env:
# We can't use GitHub direct container support on old Ubuntu versions, because actions will fail running from these due to old glibc.cancel-timeout-minutes.cancel-timeout-minutes.
# As a workaround, Docker containers will be launched separately, running build related actions inside the container via 'docker exec', while generic actions will run on the
# host runner VM itself.
CONTAINER: "nvcr.io/nvidia/cuda:${{ matrix.sys.cuda_version }}-devel-${{ matrix.sys.ct_os }}"
base_name: mfaktc-${{ github.ref_name }}-linux64-cuda${{ matrix.sys.cuda_version }}
steps:
- name: Start Docker Container
run: |
docker pull $CONTAINER
docker run --name build-container -d -v ${{ github.workspace }}:/workspace $CONTAINER tail -f /dev/null
- name: Fix GPG keys for NVidia repo on Ubuntu 16.04
if: matrix.sys.ct_os == 'ubuntu16.04'
env:
SCRIPT: apt-key add /workspace/3bf863cc.pub
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub
docker exec build-container bash -c "$SCRIPT"
- name: Update & install required packages inside the container
id: packages
env:
SCRIPT: |
apt update
apt -y full-upgrade
apt install -y build-essential curl git make python3 sudo unzip wget zip
run: docker exec build-container bash -c "$SCRIPT"
- name: Checkout repo
uses: actions/checkout@v4
- name: Prepare sources and gather info
id: prepare
shell: bash
env:
SCRIPT: |
cd /workspace
bash .github/workflows/scripts/build_helper.sh ${{ matrix.sys.cuda_version }}
run: |
docker exec build-container bash -c "$SCRIPT"
cat .github/workflows/scripts/build_helper.sh.out >> $GITHUB_OUTPUT
- name: Build from sources
env:
SCRIPT: cd /workspace/src && make -j$(nproc)
run: docker exec build-container bash -c "$SCRIPT"
- name: Prepare zip archive with the description
env:
SCRIPT: |
cd /workspace
zip -9 -j ${{ env.base_name }}.zip *
echo "[${{ env.base_name }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.base_name }}.zip) | \
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ steps.prepare.outputs.COMPILER_VER }} | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ env.base_name }}.txt
run: docker exec build-container bash -c "$SCRIPT"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.base_name }}
path: ${{ env.base_name }}.*
# End job "build-linux"
# Begin job "build-win"
build-win:
runs-on: ${{ matrix.sys.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: true
matrix:
# Available version can be viewed at the Jimver/cuda-toolkit action sources:
# https://github.com/Jimver/cuda-toolkit/blob/v0.2.21/src/links/windows-links.ts
sys:
- { cuda_version: '12.8.0', os: 'windows-2022' }
- { cuda_version: '12.6.3', os: 'windows-2022' }
- { cuda_version: '12.5.1', os: 'windows-2022' }
- { cuda_version: '12.4.1', os: 'windows-2022' }
- { cuda_version: '12.3.2', os: 'windows-2022' }
- { cuda_version: '12.2.2', os: 'windows-2022' }
- { cuda_version: '12.1.1', os: 'windows-2022' }
- { cuda_version: '12.0.1', os: 'windows-2022' }
- { cuda_version: '11.8.0', os: 'windows-2022' }
- { cuda_version: '11.7.0', os: 'windows-2022' }
- { cuda_version: '11.6.2', os: 'windows-2022' }
- { cuda_version: '11.5.2', os: 'windows-2022' }
- { cuda_version: '11.4.4', os: 'windows-2022' }
- { cuda_version: '11.3.1', os: 'windows-2022' }
- { cuda_version: '11.2.2', os: 'windows-2019' }
- { cuda_version: '11.1.1', os: 'windows-2019' }
- { cuda_version: '11.0.1', os: 'windows-2019' }
# - { cuda_version: '10.0.130', os: 'windows-2019' }
# - { cuda_version: '9.2.148', os: 'windows-2019' }
# - { cuda_version: '8.0.61', os: 'windows-2019' }
env:
base_name: mfaktc-${{ github.ref_name }}-win64-cuda${{ matrix.sys.cuda_version }}
steps:
- name: Installing CUDA Toolkit
id: cuda-toolkit
uses: Jimver/[email protected]
with:
cuda: ${{ matrix.sys.cuda_version }}
# sub-packages: '[ "nvcc", "visual_studio_integration", "cudart" ]'
- name: Checkout repo
uses: actions/checkout@v4
- name: Prepare sources and gather info
id: prepare
shell: bash
run: |
bash .github/workflows/scripts/build_helper.sh ${{ matrix.sys.cuda_version }}
cat .github/workflows/scripts/build_helper.sh.out >> $GITHUB_OUTPUT
# MSVC 2022 installed on Windows 2022 Github Runner has PowerShell script for a Dev Shell.
- name: Build from sources (PowerShell with MSVC 2022)
if: ${{ matrix.sys.os == 'windows-2022' }}
shell: powershell
run: |
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64 -HostArch amd64
cd "${{ github.workspace }}\src"
Copy-Item mfaktc.ini ..
make SHELL="powershell.exe" -f Makefile.win
# MSVC 2019 on Windows 2019 has similar script, but it doesn't allows setting arch & host_arch and defaults to x86 (32 bit) env.
# So we have to run bat file for the env, but Make uses PowerShell afterward because it's much better at handling long paths &
# quotes when invoked from Make.
- name: Build from sources (cmd.exe with MSVC 2019)
if: ${{ matrix.sys.os == 'windows-2019' }}
shell: cmd
run: |
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" & cd src & copy mfaktc.ini .. & make SHELL="powershell.exe" -f Makefile.win
- name: Prepare build archive with description
shell: bash
run: |
choco install -y --no-progress zip
zip -9 -j "${{ env.base_name }}.zip" *
echo "[${{ env.base_name }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.base_name }}.zip) | \
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ steps.prepare.outputs.COMPILER_VER }} | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ env.base_name }}.txt
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.base_name }}
path: ${{ env.base_name }}.*
# End job "build-win"
# Begin job "upload-release"
upload-release:
if: startsWith(github.ref, 'refs/tags/')
needs: [ build-linux, build-win ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Prepare list of release files & release notes
id: makeinfo
run: |
echo "Binary releases (automated builds) below." > RELEASE_NOTES.txt
echo "Compute Capability (CC) in the table means minimum and maximum versions supported." >> RELEASE_NOTES.txt
echo "CC versions are listed without the dot (i.e. 90 means 9.0 compute capability)." >> RELEASE_NOTES.txt
echo >> RELEASE_NOTES.txt
echo "File | CUDA version | Compute Capability | Build OS | Compiler version | NVCC version" >> RELEASE_NOTES.txt
echo "--- | --- | --- | --- | --- | ---" >> RELEASE_NOTES.txt
cat mfaktc-${{ github.ref_name }}-*-cuda*/mfaktc-${{ github.ref_name }}-*-cuda*.txt | sort -Vr >> RELEASE_NOTES.txt
echo 'RELEASE_FILES<<EOF' > $GITHUB_OUTPUT
ls -1 mfaktc-${{ github.ref_name }}-*-cuda*/mfaktc-${{ github.ref_name }}-*-cuda*.zip | sort -Vr >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Make and upload release
uses: softprops/[email protected]
with:
fail_on_unmatched_files: false
files: |
${{ steps.makeinfo.outputs.RELEASE_FILES }}
preserve_order: true
generate_release_notes: true
body_path: RELEASE_NOTES.txt
make_latest: true
# End job "upload-release"
# SPDX-License-Identifier: GPL-3.0-or-later