From: Kyle Liang Date: Sun, 11 Jun 2023 13:20:52 +0000 (+0800) Subject: Fixed WSL cuda's OOM error (#1594) X-Git-Tag: gguf-v0.4.0~646 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=12b063f0ecf280e98028e444fc492ee6222cdcdc;p=pkg%2Fggml%2Fsources%2Fllama.cpp Fixed WSL cuda's OOM error (#1594) * In the function , add the cuda error bypass. * remove excessive codes and prints --------- Co-authored-by: liang --- diff --git a/ggml-cuda.cu b/ggml-cuda.cu index a62f26e1..4f2195f7 100644 --- a/ggml-cuda.cu +++ b/ggml-cuda.cu @@ -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;