Skip to content

Commit

Permalink
Merge pull request #85 from jkawamoto/openblas-windows
Browse files Browse the repository at this point in the history
OpenBLAS test on Windows
  • Loading branch information
jkawamoto authored Oct 14, 2024
2 parents eb7af30 + cbac53a commit 8c1bb5c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
- main
pull_request:

concurrency:
group: check-build-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

Expand Down Expand Up @@ -90,11 +86,21 @@ jobs:
strategy:
fail-fast: false
matrix:
backend: [ruy]
backend: [openblas, ruy]
feature: ["", "flash-attention"]
runs-on: windows-latest

steps:
- uses: actions/cache@v4
with:
path: C:/vcpkg/installed
key: cache-vcpkg-packages
- name: Install OpenBLAS
if: ${{ matrix.backend == 'openblas' }}
run: |
vcpkg install openblas:x64-windows-static
Remove-Item -Recurse -Force "$env:VCPKG_INSTALLATION_ROOT/downloads"
echo "CMAKE_INCLUDE_PATH=$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows-static/include/openblas;$env:CMAKE_INCLUDE_PATH" >> $env:GITHUB_ENV
echo "CMAKE_LIBRARY_PATH=$env:VCPKG_INSTALLATION_ROOT/installed/x64-windows-static/lib;$env:CMAKE_LIBRARY_PATH" >> $env:GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: recursive
Expand All @@ -103,4 +109,4 @@ jobs:
- name: Build
run: cargo build -vv --no-default-features -F "whisper,hub,${{ matrix.backend }},${{ matrix.feature }}"
- name: Run tests
run: cargo test -vv --no-default-features -F "whisper,hub,${{ matrix.backend }},${{ matrix.feature }}" -- --include-ignored
run: cargo test -vv --no-default-features -F "whisper,hub,${{ matrix.backend }},${{ matrix.feature }}" -- --include-ignored --test-threads=1
27 changes: 19 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,31 @@ use std::path::{Path, PathBuf};
use cmake::Config;
use walkdir::WalkDir;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/sys");
println!("cargo:rerun-if-changed=include");
println!("cargo:rerun-if-changed=CTranslate2");
println!("cargo:rerun-if-env-changed=LIBRARY_PATH");
if let Ok(library_path) = env::var("LIBRARY_PATH") {
#[cfg(not(target_os = "windows"))]
const PATH_SEPARATOR: char = ':';

#[cfg(target_os = "windows")]
const PATH_SEPARATOR: char = ';';

fn add_search_paths(key: &str) {
println!("cargo:rerun-if-env-changed={}", key);
if let Ok(library_path) = env::var(key) {
library_path
.split(':')
.split(PATH_SEPARATOR)
.filter(|v| !v.is_empty())
.for_each(|v| {
println!("cargo:rustc-link-search={}", v);
});
}
}

fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/sys");
println!("cargo:rerun-if-changed=include");
println!("cargo:rerun-if-changed=CTranslate2");
add_search_paths("LIBRARY_PATH");
add_search_paths("CMAKE_LIBRARY_PATH");

let mut cmake = Config::new("CTranslate2");
cmake
Expand Down

0 comments on commit 8c1bb5c

Please sign in to comment.