Skip to content

Commit

Permalink
Update build script to remove cudarc
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasMarvin committed Jun 5, 2024
1 parent 6b0f923 commit 09c7b61
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
29 changes: 21 additions & 8 deletions llama-cpp-sys-2/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,6 @@ fn compile_hipblas(cx: &mut Build, cxx: &mut Build, mut hip: Build) -> &'static
fn compile_cuda(cx: &mut Build, cxx: &mut Build, featless_cxx: Build) -> &'static str {
println!("Compiling CUDA GGML..");

// CUDA gets linked through the cudarc crate.

cx.define("GGML_USE_CUDA", None);
cxx.define("GGML_USE_CUDA", None);

Expand All @@ -425,12 +423,27 @@ fn compile_cuda(cx: &mut Build, cxx: &mut Build, featless_cxx: Build) -> &'stati
.define("K_QUANTS_PER_ITERATION", Some("2"))
.define("GGML_CUDA_PEER_MAX_BATCH_SIZE", Some("128"));

if cfg!(target_os = "linux") {
nvcc.flag("-Wno-pedantic");
// TODO Are these links needed?
println!("cargo:rustc-link-lib=pthread");
println!("cargo:rustc-link-lib=dl");
println!("cargo:rustc-link-lib=rt");
// if cfg!(target_os = "linux") {
// nvcc.flag("-Wno-pedantic");
// }

for lib in [
"cuda", "cublas", "culibos", "cudart", "cublasLt", "pthread", "dl", "rt",
] {
println!("cargo:rustc-link-lib={}", lib);
}
if !nvcc.get_compiler().is_like_msvc() {
for lib in ["culibos", "pthread", "dl", "rt"] {
println!("cargo:rustc-link-lib={}", lib);
}
}

println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");

if nvcc.get_compiler().is_like_msvc() {
nvcc.std("c++14");
} else {
nvcc.flag("-std=c++11").std("c++11");
}

if cfg!(feature = "cuda_dmmv") {
Expand Down
10 changes: 0 additions & 10 deletions llama-cpp-sys-2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,4 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

// [`ash`] is only included to link to the Vulkan SDK.
#[allow(unused)]
#[cfg(feature = "vulkan")]
use ash;

// [`cudarc`] is only included to link to CUDA.
#[allow(unused)]
#[cfg(feature = "cuda")]
use cudarc;

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

0 comments on commit 09c7b61

Please sign in to comment.