Skip to content

Distribute and run LLMs with a single file.

Fix CUDA build on Windows

Justine Tunney72b812a7a131
diff --git a/llama.cpp/ggml-cuda.cu b/llama.cpp/ggml-cuda.cu
index 7d9701f1..da6c995e 100644
--- a/llama.cpp/ggml-cuda.cu
+++ b/llama.cpp/ggml-cuda.cu
@@ -92,6 +92,7 @@
#define cublasGemmEx tinyblasGemmEx
#define cublasGemmBatchedEx tinyblasGemmBatchedEx
#define cublasGemmStridedBatchedEx tinyblasGemmStridedBatchedEx
+#define cublasGetStatusString(x) "REDACTED!cublasGetStatusString"
#else
#include <cuda_runtime.h>
@@ -119,6 +120,10 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
////////////////////////////////////////////////////////////////////////////////
// BEGIN: COPIED FROM GGML.C
@@ -269,12 +274,11 @@ static ggml_backend_buffer_t ggml_backend_buffer_init(
size_t size) {
fprintf(stderr, "WARNING: using untested foreign malloc due to ggml backend\n");
ggml_backend_buffer_t buffer = (ggml_backend_buffer_t)malloc(sizeof(struct ggml_backend_buffer));
- (*buffer) = (struct ggml_backend_buffer) {
- /* .interface = */ iface,
- /* .buft = */ buft,
- /* .context = */ context,
- /* .size = */ size,
- };
+ memset(buffer, 0, sizeof(*buffer));
+ buffer->iface = iface;
+ buffer->buft = buft;
+ buffer->context = context;
+ buffer->size = size;
return buffer;
}
diff --git a/llamafile/cuda.sh b/llamafile/cuda.sh
index 22a3809d..4eea5065 100755
--- a/llamafile/cuda.sh
+++ b/llamafile/cuda.sh
@@ -5,6 +5,10 @@ HOST=${1:?HOST}
ssh $HOST mkdir -p lfbuild
scp llama.cpp/ggml-cuda.cu \
llama.cpp/ggml-cuda.h \
+ llama.cpp/ggml-impl.h \
+ llama.cpp/ggml-alloc.h \
+ llama.cpp/ggml-backend.h \
+ llama.cpp/ggml-backend-impl.h \
llama.cpp/tinyblas.cu \
llama.cpp/tinyblas.h \
llama.cpp/ggml.h \