Skip to content

Commit 6a2fcd2

Browse files
committed
Add cuBLAS support to build and package actions
1 parent 49f71c8 commit 6a2fcd2

File tree

5 files changed

+40
-2
lines changed

5 files changed

+40
-2
lines changed

.github/actions/build-plugin/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
description: 'Build configuration'
99
required: false
1010
default: 'RelWithDebInfo'
11+
cublas:
12+
description: 'Enable cuBLAS'
13+
required: false
14+
default: 'cpu'
1115
codesign:
1216
description: 'Enable codesigning (macOS only)'
1317
required: false
@@ -78,6 +82,7 @@ runs:
7882
$BuildArgs = @{
7983
Target = '${{ inputs.target }}'
8084
Configuration = '${{ inputs.config }}'
85+
Cublas = '${{ inputs.cublas }}'
8186
}
8287
8388
.github/scripts/Build-Windows.ps1 @BuildArgs

.github/actions/package-plugin/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ inputs:
88
description: 'Build configuration'
99
required: false
1010
default: 'RelWithDebInfo'
11+
cublas:
12+
description: 'Enable cuBLAS'
13+
required: false
14+
default: 'cpu'
1115
codesign:
1216
description: 'Enable codesigning (macOS only)'
1317
required: false
@@ -108,6 +112,7 @@ runs:
108112
$PackageArgs = @{
109113
Target = '${{ inputs.target }}'
110114
Configuration = '${{ inputs.config }}'
115+
Cublas = '${{ inputs.cublas }}'
111116
}
112117
113118
if ( '${{ inputs.package }}' -eq 'true' ) {

.github/scripts/Build-Windows.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ param(
44
[string] $Target = 'x64',
55
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
66
[string] $Configuration = 'RelWithDebInfo',
7+
[ValidateSet('cpu', 'cuda12_2', 'cuda11_8')]
8+
[string] $Cublas = 'cpu',
79
[switch] $SkipAll,
810
[switch] $SkipBuild,
911
[switch] $SkipDeps,
@@ -77,6 +79,13 @@ function Build {
7779
'--preset', $Preset
7880
)
7981

82+
if ( $Cublas -ne 'cpu' ) {
83+
$CmakeArgs += @(
84+
'-DLOCALVOCAL_WITH_CUDA=ON',
85+
"-DCUDA_TOOLKIT_ROOT_DIR=$Env:CUDA_TOOLKIT_ROOT_DIR"
86+
)
87+
}
88+
8089
$CmakeBuildArgs += @(
8190
'--build'
8291
'--preset', $Preset

.github/scripts/Package-Windows.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ param(
44
[string] $Target = 'x64',
55
[ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
66
[string] $Configuration = 'RelWithDebInfo',
7+
[ValidateSet('cpu', 'cuda12_2', 'cuda11_8')]
8+
[string] $Cublas = 'cpu',
79
[switch] $BuildInstaller,
810
[switch] $SkipDeps
911
)
@@ -48,7 +50,7 @@ function Package {
4850
$ProductName = $BuildSpec.name
4951
$ProductVersion = $BuildSpec.version
5052

51-
$OutputName = "${ProductName}-${ProductVersion}-windows-${Target}"
53+
$OutputName = "${ProductName}-${ProductVersion}-windows-${Target}-${Cublas}"
5254

5355
if ( ! $SkipDeps ) {
5456
Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"

.github/workflows/build-project.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ jobs:
225225
name: Build for Windows 🪟
226226
runs-on: windows-2022
227227
needs: check-event
228+
strategy:
229+
matrix:
230+
cublas: [cpu, cuda12_2, cuda11_8]
228231
defaults:
229232
run:
230233
shell: pwsh
@@ -234,6 +237,18 @@ jobs:
234237
submodules: recursive
235238
fetch-depth: 0
236239

240+
- name: Install CUDA Toolkit
241+
if: ${{ matrix.cublas != 'cpu' }}
242+
id: cuda-toolkit
243+
uses: Jimver/cuda-toolkit@v0.2.11
244+
with:
245+
cuda: '${{ matrix.cublas }}'
246+
247+
- name: Set CUDA_TOOLKIT_ROOT_DIR if CUDA is installed
248+
if: ${{ matrix.cublas != 'cpu' }}
249+
run: |
250+
"CUDA_TOOLKIT_ROOT_DIR=${{ steps.cuda-toolkit.outputs.cudaPath }}" >> $env:GITHUB_ENV
251+
237252
- name: Set Up Environment 🔧
238253
id: setup
239254
run: |
@@ -254,16 +269,18 @@ jobs:
254269
with:
255270
target: x64
256271
config: ${{ needs.check-event.outputs.config }}
272+
cublas: ${{ matrix.cublas }}
257273

258274
- name: Package Plugin 📀
259275
uses: ./.github/actions/package-plugin
260276
with:
261277
target: x64
262278
config: ${{ needs.check-event.outputs.config }}
263279
package: ${{ fromJSON(needs.check-event.outputs.package) }}
280+
cublas: ${{ matrix.cublas }}
264281

265282
- name: Upload Artifacts 📡
266283
uses: actions/upload-artifact@v3
267284
with:
268-
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ needs.check-event.outputs.commitHash }}
285+
name: ${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64-${{ matrix.cublas }}-${{ needs.check-event.outputs.commitHash }}
269286
path: ${{ github.workspace }}/release/${{ steps.setup.outputs.pluginName }}-${{ steps.setup.outputs.pluginVersion }}-windows-x64*.*

0 commit comments

Comments
 (0)