Skip to content

LLM inference in C/C++

C++ ggml

common : skip device_info loop if it's not going to be printed (#26692)

Bartosz Taudulba8e0eddfb8e
diff --git a/common/common.cpp b/common/common.cpp
index d84d57ac91..3d54bd6002 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -402,10 +402,11 @@ void common_params_print_info(const common_params & params, bool print_devices)
#endif
COM_TRC("%s: build %d (%s) with %s for %s%s\n", __func__, llama_build_number(), llama_commit(), llama_compiler(), llama_build_target(), build_type);
- COM_INF("%s: verbosity = %d (adjust with the `-lv N` CLI arg)\n", __func__, common_log_get_verbosity_thold());
+ const int verbosity = common_log_get_verbosity_thold();
+ COM_INF("%s: verbosity = %d (adjust with the `-lv N` CLI arg)\n", __func__, verbosity);
// device enumeration creates a primary context on CUDA backends, skip it when the caller does not own any device
- if (print_devices) {
+ if (print_devices && verbosity >= LOG_LEVEL_TRACE) {
COM_TRC("%s", "device_info:\n");
for (size_t i = 0; i < ggml_backend_dev_count(); ++i) {
auto * dev = ggml_backend_dev_get(i);