Skip to content

Commit

Permalink
Update build-windows.ps1 to refine CMake arguments for different acce…
Browse files Browse the repository at this point in the history
…leration options
  • Loading branch information
royshil committed Nov 25, 2024
1 parent eda15ae commit 4667e72
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions build-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,31 @@ $env:VCPKG_ROOT=""

$cmakeArgs = @()
if ($env:BUILD_WITH_ACCEL -eq "cpu") {
$cmakeArgs += ("-DWHISPERCPP_WITH_CUDA=OFF")
$cmakeArgs += (
"-DWHISPERCPP_WITH_CUDA=OFF",
"-DWHISPERCPP_WITH_HIPBLAS=OFF",
"-DWHISPERCPP_WITH_VULKAN=OFF",
"-DWHISPERCPP_WITH_MKL=OFF",
"-DCMAKE_GENERATOR=Visual Studio 17 2022"
)
$zipFileName = "whispercpp-windows-cpu-$Version.zip"
} elseif ($env:BUILD_WITH_ACCEL -eq "hipblas") {
$cmakeArgs += ("-DWHISPERCPP_WITH_CUDA=OFF",
"-DWHISPERCPP_WITH_HIPBLAS=ON",
$cmakeArgs += (
"-DWHISPERCPP_WITH_CUDA=OFF",
"-DWHISPERCPP_WITH_HIPBLAS=ON",
"-DWHISPERCPP_WITH_VULKAN=OFF",
"-DWHISPERCPP_WITH_MKL=OFF",
"-DCMAKE_GENERATOR=Unix Makefiles",
"-DCMAKE_C_COMPILER='$env:HIP_PATH\bin\clang.exe'",
"-DCMAKE_CXX_COMPILER='$env:HIP_PATH\bin\clang++.exe'")
$zipFileName = "whispercpp-windows-hipblas-$Version.zip"
$env:HIP_PLATFORM="amd"
} elseif ($env:BUILD_WITH_ACCEL -eq "vulkan") {
$cmakeArgs += (
"-DWHISPERCPP_WITH_CUDA=OFF",
"-DWHISPERCPP_WITH_HIPBLAS=OFF",
"-DWHISPERCPP_WITH_VULKAN=ON",
"-DWHISPERCPP_WITH_MKL=OFF",
"-DCMAKE_GENERATOR=Visual Studio 17 2022"
)
$zipFileName = "whispercpp-windows-vulkan-$Version.zip"
Expand All @@ -34,6 +46,9 @@ if ($env:BUILD_WITH_ACCEL -eq "cpu") {
$env:VULKAN_SDK_PATH="$vulkanSdkPath"
} elseif ($env:BUILD_WITH_ACCEL -eq "mkl") {
$cmakeArgs += (
"-DWHISPERCPP_WITH_CUDA=OFF",
"-DWHISPERCPP_WITH_HIPBLAS=OFF",
"-DWHISPERCPP_WITH_VULKAN=OFF",
"-DWHISPERCPP_WITH_MKL=ON",
"-DCMAKE_GENERATOR=Visual Studio 17 2022"
)
Expand All @@ -42,21 +57,21 @@ if ($env:BUILD_WITH_ACCEL -eq "cpu") {
$mklPath = Get-ChildItem -Path "C:\Program Files (x86)\Intel\oneAPI" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
$env:MKL_PATH="$mklPath"
} elseif ($env:BUILD_WITH_ACCEL -eq "cuda") {
$cmakeArgs += (
"-DWHISPERCPP_WITH_CUDA=ON",
"-DCMAKE_GENERATOR=Visual Studio 17 2022"
)
$zipFileName = "whispercpp-windows-cuda-$Version.zip"
# find the CUDA path in C:\Program Files\NVIDIA GPU Computing Toolkit
$cudaPath = Get-ChildItem -Path "C:\Program Files\NVIDIA GPU Computing Toolkit" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
$env:CUDA_TOOLKIT_ROOT_DIR="$cudaPath"
} else {
$cmakeArgs += (
"-DWHISPERCPP_WITH_CUDA=ON",
"-DWHISPERCPP_WITH_HIPBLAS=OFF",
"-DWHISPERCPP_WITH_VULKAN=OFF",
"-DWHISPERCPP_WITH_MKL=OFF",
"-DCMAKE_GENERATOR=Visual Studio 17 2022",
"-DCUDA_TOOLKIT_ROOT_DIR=$env:CUDA_TOOLKIT_ROOT_DIR"
)
$zipFileName = "whispercpp-windows-cuda-$Version.zip"
} else {
Write-Host "Invalid BUILD_WITH_ACCEL value. Please set it to 'cpu', 'cuda', 'vulkan', `mkl` or 'hipblas'."
exit
}

# configure
Expand Down

0 comments on commit 4667e72

Please sign in to comment.