Skip to content

Commit

Permalink
update cuda config, add window release setting
Browse files Browse the repository at this point in the history
  • Loading branch information
darknight committed Dec 10, 2023
1 parent 2a9d6dc commit bbe59a4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
container: ${{ matrix.container }}
strategy:
matrix:
binary: [aarch64-apple-darwin, x86_64-manylinux2014, x86_64-manylinux2014-cuda117]
binary: [aarch64-apple-darwin, x86_64-manylinux2014, x86_64-manylinux2014-cuda117, x86_64-pc-windows-msvc]
include:
- os: macos-latest
target: aarch64-apple-darwin
Expand All @@ -41,6 +41,10 @@ jobs:
binary: x86_64-manylinux2014-cuda117
container: sameli/manylinux2014_x86_64_cuda_11.7
build_args: --features cuda
- os: windows-latest
target: x86_64-pc-windows-msvc
binary: x86_64-pc-windows-msvc
build_args: --features cuda

env:
SCCACHE_GHA_ENABLED: true
Expand Down Expand Up @@ -78,7 +82,13 @@ jobs:
~/.cargo/registry
~/.cargo/git
- run: bash ./ci/prepare_build_environment.sh
- name: Prepare build environment for macOS & Linux
run: bash ./ci/prepare_build_environment.sh
if: runner.os != 'Windows'

- name: Prepare build environment for Windows
run: ./ci/prepare_build_environment.ps1
if: runner.os == 'Windows'

- name: Bulid release binary
run: cargo build ${{ matrix.build_args }} --release --target ${{ matrix.target }} --package tabby
Expand Down
2 changes: 2 additions & 0 deletions ci/prepare_build_environment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Echo "install protocol buffer compiler..."
choco install protoc
11 changes: 9 additions & 2 deletions crates/llama-cpp-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ fn build_llama_cpp() {
if cfg!(feature = "cuda") {
config.define("LLAMA_CUBLAS", "ON");
config.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON");
println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");
if cfg!(target_os = "windows") {
let Ok(cuda_path) = env::var("CUDA_PATH") else {
panic!("CUDA_PATH is not set");
};
println!(r"cargo:rustc-link-search=native={}\lib\x64", cuda_path);
} else {
println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");
}
println!("cargo:rustc-link-lib=cudart");
println!("cargo:rustc-link-lib=culibos");
println!("cargo:rustc-link-lib=cublas");
Expand Down Expand Up @@ -82,7 +89,7 @@ fn build_llama_cpp() {
let dst = config.build();
if cfg!(target_os = "windows") {
println!(
"cargo:rustc-link-search=native={}\\build\\{}",
r"cargo:rustc-link-search=native={}\build\{}",
dst.display(),
config.get_profile()
);
Expand Down

0 comments on commit bbe59a4

Please sign in to comment.