From 4bfa3602fe9f2f8d46b3f0c4bcff1aa0cfbebd60 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:00:26 +0300 Subject: [PATCH] feat: special builds with vulkan --- .github/workflows/linux_special.yml | 32 ++++++++++----------------- .github/workflows/release.yml | 5 ++++- .github/workflows/windows_special.yml | 26 +++++++++++----------- desktop/src-tauri/src/cmd/mod.rs | 2 +- scripts/pre_build.js | 21 +++++++++--------- 5 files changed, 40 insertions(+), 46 deletions(-) diff --git a/.github/workflows/linux_special.yml b/.github/workflows/linux_special.yml index e5b6543..2c4f91c 100644 --- a/.github/workflows/linux_special.yml +++ b/.github/workflows/linux_special.yml @@ -22,21 +22,13 @@ jobs: rust-version: "stable" name: "ubuntu-22.04" - # Ubuntu 24.04 - - platform: "ubuntu-24.04" - args: '--features "vulkan"' - pre-build-args: "--vulkan" - rust-version: "stable" - name: "ubuntu-24.04" - - # Ubuntu 22.04 cuda - - platform: "ubuntu-22.04" - args: '--features "cuda"' - pre-build-args: "--cuda" - rust-version: "stable" - cuda-version: "12.4.1" - name: "ubuntu-22.04-nvidia-12" + # - platform: "ubuntu-22.04" + # args: '--features "cuda"' + # pre-build-args: "--cuda" + # rust-version: "stable" + # cuda-version: "12.4.1" + # name: "ubuntu-22.04-nvidia-12" # Ubuntu 24.04 cuda # https://github.com/Jimver/cuda-toolkit/issues/365 @@ -48,12 +40,12 @@ jobs: # name: "ubuntu-24.04-nvidia-12" # Ubuntu 22.04 rocm - - platform: "ubuntu-22.04" - args: '--features "rocm"' - rocm-version: "6.1.2" - pre-build-args: "--rocm" - rust-version: "stable" - name: "ubuntu-24.04-rocm-6.1.2" + # - platform: "ubuntu-22.04" + # args: '--features "rocm"' + # rocm-version: "6.1.2" + # pre-build-args: "--rocm" + # rust-version: "stable" + # name: "ubuntu-24.04-rocm-6.1.2" runs-on: ${{ matrix.platform }} steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 507c04d..3b0c403 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,10 @@ jobs: args: "--target aarch64-apple-darwin" - platform: "macos-latest" # for Intel based macs. args: "--target x86_64-apple-darwin" - - platform: "ubuntu-24.04" # Ubuntu x86_64 + - platform: "ubuntu-24.04" # Ubuntu 24.04 x86_64 + args: '--features "vulkan"' + pre-build-args: "--vulkan" + - platform: "ubuntu-22.04" # Ubuntu 22.04 x86_64 args: '--features "vulkan"' pre-build-args: "--vulkan" - platform: "windows-latest" # Windows x86_64 diff --git a/.github/workflows/windows_special.yml b/.github/workflows/windows_special.yml index da822fb..3b9d349 100644 --- a/.github/workflows/windows_special.yml +++ b/.github/workflows/windows_special.yml @@ -27,21 +27,21 @@ jobs: name: "older-cpu" rust-version: "stable" - # Windows cuda 12.5.0 - - platform: "windows-latest" - args: '--features="cuda"' - pre-build-args: "--cuda" - name: 'nvidia-12.5.0' - cuda-verison: '12.5.0' - rust-version: "stable" + # # Windows cuda 12.5.0 + # - platform: "windows-latest" + # args: '--features="cuda"' + # pre-build-args: "--cuda" + # name: 'nvidia-12.5.0' + # cuda-verison: '12.5.0' + # rust-version: "stable" # Windows cuda 11.8.0 - - platform: "windows-latest" - args: '--features="cuda"' - pre-build-args: "--cuda" - name: 'nvidia-11.8.0' - cuda-verison: '11.8.0' - rust-version: "stable" + # - platform: "windows-latest" + # args: '--features="cuda"' + # pre-build-args: "--cuda" + # name: 'nvidia-11.8.0' + # cuda-verison: '11.8.0' + # rust-version: "stable" # Windows portable - platform: "windows-latest" # Windows x86_64 diff --git a/desktop/src-tauri/src/cmd/mod.rs b/desktop/src-tauri/src/cmd/mod.rs index 466257e..b93cdb2 100644 --- a/desktop/src-tauri/src/cmd/mod.rs +++ b/desktop/src-tauri/src/cmd/mod.rs @@ -398,7 +398,7 @@ pub async fn load_model(app_handle: tauri::AppHandle, model_path: String, gpu_de #[tauri::command] pub fn is_portable() -> bool { - !env!("WINDOWS_PORTABLE").is_empty() + env!("WINDOWS_PORTABLE") == "1" } #[tauri::command] diff --git a/scripts/pre_build.js b/scripts/pre_build.js index 8c2aa97..b9e2a7a 100755 --- a/scripts/pre_build.js +++ b/scripts/pre_build.js @@ -237,6 +237,10 @@ if (!process.env.GITHUB_ENV) { console.log(`$env:ROCM_VERSION = "6.1.2"`) console.log(`$env:ROCM_PATH = "${rocmPath}"`) } + + if (hasFeature('portable')) { + console.log('$env:WINDOWS_PORTABLE=1') + } } if (platform == 'macos') { console.log(`export FFMPEG_DIR="${exports.ffmpeg}"`) @@ -270,23 +274,18 @@ if (process.env.GITHUB_ENV) { console.log('Adding ENV', openblas) await fs.appendFile(process.env.GITHUB_ENV, openblas) - if (hasFeature('cuda')) { - // link msvc dynamic - const knfStaticCrt = 'KNF_STATIC_CRT=0\n' - console.log('Adding ENV', knfStaticCrt) - await fs.appendFile(process.env.GITHUB_ENV, knfStaticCrt) - - const whisperStaticMsvc = 'WHISPER_USE_STATIC_MSVC=0\n' - console.log('Adding ENV', whisperStaticMsvc) - await fs.appendFile(process.env.GITHUB_ENV, whisperStaticMsvc) - } - if (hasFeature('older-cpu')) { await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_AVX=ON\n`) await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_AVX2=ON\n`) await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_FMA=ON\n`) await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_F16C=ON\n`) } + + if (hasFeature('portable')) { + const windowsPortable = 'WINDOWS_PORTABLE=1\n' + console.log('Adding ENV', windowsPortable) + await fs.appendFile(process.env.GITHUB_ENV, windowsPortable) + } } }