Skip to content

Commit 51c38a2

Browse files
committed
ggml : allow setting the backend name with env variable
ref: ggml-org#1058
1 parent 6a7a034 commit 51c38a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/ggml-backend-reg.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -549,4 +549,9 @@ void ggml_backend_load_all_from_path(const char * dir_path) {
549549
ggml_backend_load_best("opencl", silent, dir_path);
550550
ggml_backend_load_best("musa", silent, dir_path);
551551
ggml_backend_load_best("cpu", silent, dir_path);
552+
// check the environment variable GGML_BACKEND_NAME to load an out-of-tree backend
553+
const char * backend_name = std::getenv("GGML_BACKEND_NAME");
554+
if (backend_name) {
555+
ggml_backend_load_best(backend_name, silent, dir_path);
556+
}
552557
}

0 commit comments

Comments
 (0)