Skip to content

Commit

Permalink
fix dev list with dl backends
Browse files Browse the repository at this point in the history
  • Loading branch information
slaren committed Nov 25, 2024
1 parent d1dc8fb commit d6cf918
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion common/arg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ bool common_params_parse(int argc, char ** argv, common_params & params, llama_e
}

common_params_context common_params_parser_init(common_params & params, llama_example ex, void(*print_usage)(int, char **)) {
// load dynamic backends
ggml_backend_load_all();

common_params_context ctx_arg(params);
ctx_arg.print_usage = print_usage;
ctx_arg.ex = ex;
Expand Down Expand Up @@ -1345,12 +1348,13 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
{"--list-devices"},
"print list of available devices and exit",
[](common_params &) {
printf("Available devices:\n");
for (size_t i = 0; i < ggml_backend_dev_count(); ++i) {
auto * dev = ggml_backend_dev_get(i);
if (ggml_backend_dev_type(dev) == GGML_BACKEND_DEVICE_TYPE_GPU) {
size_t free, total;
ggml_backend_dev_memory(dev, &free, &total);
printf("%s: %s (%zu MiB, %zu MiB free)\n", ggml_backend_dev_name(dev), ggml_backend_dev_description(dev), total / 1024 / 1024, free / 1024 / 1024);
printf(" %s: %s (%zu MiB, %zu MiB free)\n", ggml_backend_dev_name(dev), ggml_backend_dev_description(dev), total / 1024 / 1024, free / 1024 / 1024);
}
}
exit(0);
Expand Down
3 changes: 0 additions & 3 deletions common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,6 @@ void common_init() {
#endif

LOG_INF("build: %d (%s) with %s for %s%s\n", LLAMA_BUILD_NUMBER, LLAMA_COMMIT, LLAMA_COMPILER, LLAMA_BUILD_TARGET, build_type);

// load dynamic backends
ggml_backend_load_all();
}

std::string common_params_get_system_info(const common_params & params) {
Expand Down

0 comments on commit d6cf918

Please sign in to comment.