Skip to content

Commit aee20af

Browse files
committed
fixed cpu cores display issues
1 parent 0ddc03f commit aee20af

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

llamacpp-server-launcher.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ def __init__(self, root: tk.Tk):
310310
# --- Status Variables ---
311311
self.gpu_detected_status_var = tk.StringVar(value="") # Updates with GPU detection message
312312
self.gpu_availability_var = tk.StringVar(value="Detecting...") # For GPU availability status
313+
314+
# --- CPU Info Display Variables ---
315+
self.cpu_logical_cores_display_var = tk.StringVar(value=str(self.cpu_info.get("logical_cores", "N/A")))
316+
self.cpu_physical_cores_display_var = tk.StringVar(value=str(self.cpu_info.get("physical_cores", "N/A")))
313317

314318

315319
# Internal state
@@ -895,12 +899,12 @@ def _setup_advanced_tab(self, parent):
895899
if self.cpu_info and "error" not in self.cpu_info:
896900
ttk.Label(inner, text="System CPU (Logical Cores):", font=("TkSmallCaptionFont", 8, ("bold",)))\
897901
.grid(column=0, row=r, sticky="w", padx=10, pady=(5,0))
898-
ttk.Label(inner, text=f"{self.cpu_info.get('logical_cores', 'N/A')}", font="TkSmallCaptionFont")\
902+
ttk.Label(inner, textvariable=self.cpu_logical_cores_display_var, font="TkSmallCaptionFont")\
899903
.grid(column=1, row=r, sticky="w", padx=5, pady=(5,0), columnspan=3)
900904
r += 1
901905
ttk.Label(inner, text="System CPU (Physical Cores):", font=("TkSmallCaptionFont", 8, ("bold",)))\
902906
.grid(column=0, row=r, sticky="w", padx=10, pady=(0,10))
903-
ttk.Label(inner, text=f"{self.cpu_info.get('physical_cores', 'N/A')}", font="TkSmallCaptionFont")\
907+
ttk.Label(inner, textvariable=self.cpu_physical_cores_display_var, font="TkSmallCaptionFont")\
904908
.grid(column=1, row=r, sticky="w", padx=5, pady=(0,10), columnspan=3)
905909
r += 1
906910
elif self.cpu_info.get("error"):
@@ -2875,6 +2879,9 @@ def _on_system_info_detection_complete(self, error=None):
28752879
self.gpu_availability_var.set("CUDA Devices (Detection failed):")
28762880
self.recommended_threads_var.set(f"Recommended: {self.physical_cores} (detection failed)")
28772881
self.recommended_threads_batch_var.set(f"Recommended: {self.logical_cores} (detection failed)")
2882+
# Update CPU display variables to show fallback values
2883+
self.cpu_logical_cores_display_var.set(f"{self.logical_cores} (detection failed)")
2884+
self.cpu_physical_cores_display_var.set(f"{self.physical_cores} (detection failed)")
28782885
else:
28792886
print("DEBUG: System info detection completed successfully, updating UI...", file=sys.stderr)
28802887
# Update Tk vars with detected info (detected values are now in self attributes)
@@ -2883,6 +2890,13 @@ def _on_system_info_detection_complete(self, error=None):
28832890
# Update recommendation vars with actual detected info
28842891
self.recommended_threads_var.set(f"Recommended: {self.physical_cores} (Your CPU physical cores)")
28852892
self.recommended_threads_batch_var.set(f"Recommended: {self.logical_cores} (Your CPU logical cores)")
2893+
# Update the cpu_info dictionary so the UI displays the correct values
2894+
if "error" not in self.cpu_info:
2895+
self.cpu_info["logical_cores"] = self.logical_cores
2896+
self.cpu_info["physical_cores"] = self.physical_cores
2897+
# Update the display variables for the UI
2898+
self.cpu_logical_cores_display_var.set(str(self.logical_cores))
2899+
self.cpu_physical_cores_display_var.set(str(self.physical_cores))
28862900
# Update GPU detection status message
28872901
self.gpu_detected_status_var.set(self.gpu_info['message'] if not self.gpu_info['available'] and self.gpu_info.get('message') else "")
28882902

0 commit comments

Comments
 (0)