Skip to content

Commit 12b063f

Browse files
JoelSeniorLiangliang
and
liang
authored
Fixed WSL cuda's OOM error (#1594)
* In the function , add the cuda error bypass. * remove excessive codes and prints --------- Co-authored-by: liang <[email protected]>
1 parent 31d2b5f commit 12b063f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ggml-cuda.cu

+3
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,9 @@ void * ggml_cuda_host_malloc(size_t size) {
11051105
void * ptr = nullptr;
11061106
cudaError_t err = cudaMallocHost((void **) &ptr, size);
11071107
if (err != cudaSuccess) {
1108+
// The allocation error can be bypassed. A null ptr will assigned out of this function.
1109+
// This can fixed the OOM error in WSL.
1110+
cudaGetLastError();
11081111
fprintf(stderr, "WARNING: failed to allocate %.2f MB of pinned memory: %s\n",
11091112
size/1024.0/1024.0, cudaGetErrorString(err));
11101113
return nullptr;

0 commit comments

Comments
 (0)