lmstudio-ai / lmstudio-bug-tracker

Bug tracking for the LM Studio desktop application
4 stars 3 forks source link

LM-Studio 0.3.2 "clamps" the numbers of CPU cores from 16 to 8. #130

Open gestur1976 opened 14 hours ago

gestur1976 commented 14 hours ago

In 0.2.x versions of LM-Studio, the defalt number of CPU cores is 4 but I am able to change the value to 16 cores and when doing inference, all of the cores are being used.

Since 0.3 version LM-Studio sets a default number of CPU cores of 6, which looks odd to me (looks like a 16 without the 1), but the slider only allows me to set a maximum of 8, and If I write 16 manually it shows the following message at the logs:

2024-09-21 20:15:47 [INFO] [LM STUDIO SERVER] Running chat completion on conversation with 2 messages. 2024-09-21 20:15:47 [DEBUG] Prediction config attempted to specify cpuparams.n_threads '16', which is greater than the number of threads in the threadpool '8.'. Clamping to '8'

Obviously I'm still using 0.2 version because inference speeds in partially offloaded models is much faster than in 0.3 version.

I'm using Arch Linux. Kernel version: Linux 6.10.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 x86_64 GNU/Linux

My CPU is: processor : 0 vendor_id : AuthenticAMD cpu family : 25 model : 33 model name : AMD Ryzen 7 5700X 8-Core Processor stepping : 2 microcode : 0xa201204 cpu MHz : 3719.077 cache size : 512 KB physical id : 0 siblings : 16 core id : 0 cpu cores : 8 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 16 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local user_shstk clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm debug_swap bugs : sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass srso bogomips : 6803.72 TLB size : 2560 4K pages clflush size : 64 cache_alignment : 64 address sizes : 48 bits physical, 48 bits virtual power management: ts ttp tm hwpstate cpb eff_freq_ro [13] [14]

yagil commented 14 hours ago

@gestur1976 does the app let you edit the number directly in the input box? It should allow you to go beyond the limit of the slider

gestur1976 commented 13 hours ago

Yes, I can manually enter the number, but when the client connects to the API Server the first message the log shows is: 2024-09-21 20:15:47 [INFO] [LM STUDIO SERVER] Running chat completion on conversation with 2 messages. 2024-09-21 20:15:47 [DEBUG] Prediction config attempted to specify cpuparams.n_threads '16', which is greater than the number of threads in the threadpool '8.'. Clamping to '8' And in htop I can see it's only using 8 cores.

This happens both in API server mode and in Chat section. I can enter manually the number of cores but the program caps it to the half.

My CPU has 16 virtual cores but 8 physical instead, maybe the issue comes from that? Anyway, 0.2 version is twice faster when using CPU only inference.

yagil commented 13 hours ago

I see. This is due to how we manage recent changes in llama.cpp threading. We will need to fix this to allow you to provide a number higher than the physical cores.

BTW: which model is this with and what are the rest of your settings? I'm surprised that this leads to 1/2 the speed.