From: Radoslav Gerganov Date: Sun, 5 Jan 2025 07:50:37 +0000 (+0200) Subject: ggml : allow loading backend with env variable (#1059) X-Git-Tag: upstream/0.0.1642~25 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=c8bd0fee71dc8328d93be301bbee06bc10d30429;p=pkg%2Fggml%2Fsources%2Fggml ggml : allow loading backend with env variable (#1059) ref: #1058 --- diff --git a/src/ggml-backend-reg.cpp b/src/ggml-backend-reg.cpp index 7ddd178b..955ed505 100644 --- a/src/ggml-backend-reg.cpp +++ b/src/ggml-backend-reg.cpp @@ -574,4 +574,9 @@ void ggml_backend_load_all_from_path(const char * dir_path) { ggml_backend_load_best("opencl", silent, dir_path); ggml_backend_load_best("musa", silent, dir_path); ggml_backend_load_best("cpu", silent, dir_path); + // check the environment variable GGML_BACKEND_PATH to load an out-of-tree backend + const char * backend_path = std::getenv("GGML_BACKEND_PATH"); + if (backend_path) { + ggml_backend_load(backend_path); + } }