From e3a0d0007a173f937491429d69c37d1e4ff9a3d1 Mon Sep 17 00:00:00 2001 From: Lizonghang <870644199@qq.com> Date: Sun, 23 Feb 2025 21:56:59 +0400 Subject: [PATCH] add gpu check in set calibration --- common/common.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/common.cpp b/common/common.cpp index deaffc71..8a38f160 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1362,22 +1362,23 @@ static bool assign_layers_to_device( } // check the solution - bool has_free_gpu_memory = false, has_overload = false; + bool has_free_gpu_memory = false, has_gpu_overload = false; for (uint32_t m = 0; m < n_world; ++m) { + if (!dev_gpu[m]) continue; uint32_t w_m = best_solution[m], n_m = best_solution[m + n_world]; // if there is still free GPU memory if (n_m < static_cast(std::round(W * vec_z_gpu[m]))) { has_free_gpu_memory = true; } - - // if there is device overloaded + + // if there is GPU device overloaded if (w_m > n_m) { - has_overload = true; + has_gpu_overload = true; } } - if (has_free_gpu_memory && has_overload) { + if (has_free_gpu_memory && has_gpu_overload) { int worst_device = -1; float worst_speed = std::numeric_limits::max();