diff --git a/common/arg.cpp b/common/arg.cpp index ede118d19dcaa..31e9b94bdede6 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -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; @@ -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); diff --git a/common/common.cpp b/common/common.cpp index 96ada860377ca..09ec9f2388afb 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -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) {