]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Fixed WSL cuda's OOM error (#1594)
authorKyle Liang <redacted>
Sun, 11 Jun 2023 13:20:52 +0000 (21:20 +0800)
committerGitHub <redacted>
Sun, 11 Jun 2023 13:20:52 +0000 (15:20 +0200)
* In the function , add the cuda error bypass.

* remove excessive codes and prints

---------

Co-authored-by: liang <redacted>
ggml-cuda.cu

index a62f26e1e6126368d3a62253d7e34b9e5661b075..4f2195f77e9843266d1e661e66866c97745ae233 100644 (file)
@@ -1105,6 +1105,9 @@ void * ggml_cuda_host_malloc(size_t size) {
     void * ptr = nullptr;
     cudaError_t err = cudaMallocHost((void **) &ptr, size);
     if (err != cudaSuccess) {
+        // The allocation error can be bypassed. A null ptr will assigned out of this function.
+        // This can fixed the OOM error in WSL.
+        cudaGetLastError();
         fprintf(stderr, "WARNING: failed to allocate %.2f MB of pinned memory: %s\n",
             size/1024.0/1024.0, cudaGetErrorString(err));
         return nullptr;