Skip to content

Commit

Permalink
cuda : disable host register by default (ggml-org#6206)
Browse files Browse the repository at this point in the history
  • Loading branch information
slaren authored Mar 21, 2024
1 parent f372c49 commit d0a7123
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ggml-cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -11646,7 +11646,7 @@ GGML_CALL void ggml_backend_cuda_get_device_memory(int device, size_t * free, si
}

GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size) {
if (getenv("GGML_CUDA_NO_PINNED") != nullptr) {
if (getenv("GGML_CUDA_REGISTER_HOST") == nullptr) {
return false;
}

Expand All @@ -11663,6 +11663,10 @@ GGML_CALL bool ggml_backend_cuda_register_host_buffer(void * buffer, size_t size
}

GGML_CALL void ggml_backend_cuda_unregister_host_buffer(void * buffer) {
if (getenv("GGML_CUDA_REGISTER_HOST") == nullptr) {
return;
}

cudaError_t err = cudaHostUnregister(buffer);
if (err != cudaSuccess) {
// clear the error
Expand Down

0 comments on commit d0a7123

Please sign in to comment.