diff options
author | Kyle Liang <liangmanlai@gmail.com> | 2023-06-11 21:20:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-11 15:20:52 +0200 |
commit | 12b063f0ecf280e98028e444fc492ee6222cdcdc (patch) | |
tree | 5833ace805c7f035356b7b5ff7ee14d12ecadf11 | |
parent | 31d2b5f4a4bae081e59b36ab37c6ff6f5b5940ad (diff) |
Fixed WSL cuda's OOM error (#1594)
* In the function , add the cuda error bypass.
* remove excessive codes and prints
---------
Co-authored-by: liang <liangmanlai@126.com>
-rw-r--r-- | ggml-cuda.cu | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ggml-cuda.cu b/ggml-cuda.cu index a62f26e..4f2195f 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; |