Skip to content

Commit 260e192

Browse files
committed
fix build
1 parent e672602 commit 260e192

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

ggml/src/ggml-cuda/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ if (CUDAToolkit_FOUND)
107107
target_link_libraries(ggml-cuda PRIVATE CUDA::cudart_static CUDA::cublas_static CUDA::cublasLt_static CUDA::cuFile_static)
108108
endif()
109109
else()
110-
target_link_libraries(ggml-cuda PRIVATE CUDA::cudart CUDA::cublas CUDA::cublasLt CUDA::cuFile)
110+
if (WIN32)
111+
target_link_libraries(ggml-cuda PRIVATE CUDA::cudart CUDA::cublas CUDA::cublasLt)
112+
else()
113+
target_link_libraries(ggml-cuda PRIVATE CUDA::cudart CUDA::cublas CUDA::cublasLt CUDA::cuFile)
114+
endif()
111115
endif()
112116

113117
if (GGML_CUDA_NO_VMM)

ggml/src/ggml-cuda/ggml-cuda.cu

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@
6060
#include <stdlib.h>
6161
#include <string>
6262
#include <vector>
63-
#include <cufile.h>
63+
#if !defined(GGML_USE_HIP) && !defined(GGML_USE_MUSA) && !defined(_WIN32)
64+
# include <cufile.h>
65+
#endif
6466
#ifdef _WIN32
6567
#else
6668
#include <fcntl.h>
@@ -3417,15 +3419,7 @@ static ggml_backend_feature * ggml_backend_cuda_get_features(ggml_backend_reg_t
34173419
}
34183420

34193421
static bool ggml_backend_cuda_buffer_load_tensor(ggml_backend_buffer_t buffer, ggml_tensor * tensor, const char * path, size_t file_offset, size_t tensor_offset, size_t size) {
3420-
#ifdef _WIN32
3421-
GGML_UNUSED(buffer);
3422-
GGML_UNUSED(tensor);
3423-
GGML_UNUSED(path);
3424-
GGML_UNUSED(file_offset);
3425-
GGML_UNUSED(tensor_offset);
3426-
GGML_UNUSED(size);
3427-
return false;
3428-
#else
3422+
#if !defined(GGML_USE_HIP) && !defined(GGML_USE_MUSA) && !defined(_WIN32)
34293423
static bool initialized = false;
34303424
static bool use_cufile = false;
34313425
if (!initialized) {
@@ -3475,6 +3469,14 @@ static bool ggml_backend_cuda_buffer_load_tensor(ggml_backend_buffer_t buffer, g
34753469
cuFileHandleDeregister(cf_handle);
34763470
close(fd);
34773471
return true;
3472+
#else
3473+
GGML_UNUSED(buffer);
3474+
GGML_UNUSED(tensor);
3475+
GGML_UNUSED(path);
3476+
GGML_UNUSED(file_offset);
3477+
GGML_UNUSED(tensor_offset);
3478+
GGML_UNUSED(size);
3479+
return false;
34783480
#endif
34793481
}
34803482

0 commit comments

Comments
 (0)