@@ -413,8 +413,6 @@ fn compile_hipblas(cx: &mut Build, cxx: &mut Build, mut hip: Build) -> &'static
413
413
fn compile_cuda ( cx : & mut Build , cxx : & mut Build , featless_cxx : Build ) -> & ' static str {
414
414
println ! ( "Compiling CUDA GGML.." ) ;
415
415
416
- // CUDA gets linked through the cudarc crate.
417
-
418
416
cx. define ( "GGML_USE_CUDA" , None ) ;
419
417
cxx. define ( "GGML_USE_CUDA" , None ) ;
420
418
@@ -425,12 +423,27 @@ fn compile_cuda(cx: &mut Build, cxx: &mut Build, featless_cxx: Build) -> &'stati
425
423
. define ( "K_QUANTS_PER_ITERATION" , Some ( "2" ) )
426
424
. define ( "GGML_CUDA_PEER_MAX_BATCH_SIZE" , Some ( "128" ) ) ;
427
425
428
- if cfg ! ( target_os = "linux" ) {
429
- nvcc. flag ( "-Wno-pedantic" ) ;
430
- // TODO Are these links needed?
431
- println ! ( "cargo:rustc-link-lib=pthread" ) ;
432
- println ! ( "cargo:rustc-link-lib=dl" ) ;
433
- println ! ( "cargo:rustc-link-lib=rt" ) ;
426
+ // if cfg!(target_os = "linux") {
427
+ // nvcc.flag("-Wno-pedantic");
428
+ // }
429
+
430
+ for lib in [
431
+ "cuda" , "cublas" , "culibos" , "cudart" , "cublasLt" , "pthread" , "dl" , "rt" ,
432
+ ] {
433
+ println ! ( "cargo:rustc-link-lib={}" , lib) ;
434
+ }
435
+ if !nvcc. get_compiler ( ) . is_like_msvc ( ) {
436
+ for lib in [ "culibos" , "pthread" , "dl" , "rt" ] {
437
+ println ! ( "cargo:rustc-link-lib={}" , lib) ;
438
+ }
439
+ }
440
+
441
+ println ! ( "cargo:rustc-link-search=native=/usr/local/cuda/lib64" ) ;
442
+
443
+ if nvcc. get_compiler ( ) . is_like_msvc ( ) {
444
+ nvcc. std ( "c++14" ) ;
445
+ } else {
446
+ nvcc. flag ( "-std=c++11" ) . std ( "c++11" ) ;
434
447
}
435
448
436
449
if cfg ! ( feature = "cuda_dmmv" ) {
0 commit comments