Skip to content

Fix Linux /sys cpu path to guess number of cores#7064

Merged
slaren merged 1 commit intoggml-org:masterfrom
viric:fix_cpu_path
May 4, 2024
Merged

Fix Linux /sys cpu path to guess number of cores#7064
slaren merged 1 commit intoggml-org:masterfrom
viric:fix_cpu_path

Conversation

@viric
Copy link
Copy Markdown
Contributor

@viric viric commented May 3, 2024

The path was wrong on linux so it always went to the fallback case.

@teleprint-me
Copy link
Copy Markdown
Contributor

teleprint-me commented May 4, 2024

Are you sure about that?

20:16:51 | ~
  λ file /sys/devices/system/cpu    
/sys/devices/system/cpu: directory
20:16:55 | ~
  λ file /sys/devices/system/cpu/cpu 
/sys/devices/system/cpu/cpu: cannot open `/sys/devices/system/cpu/cpu' (No such file or directory)
20:16:58 | ~
  λ ls /sys/devices/system/cpu
amd_pstate  cpu12  cpu3  cpu8           hotplug     nohz_full  present
cpu0        cpu13  cpu4  cpu9           isolated    offline    smt
cpu1        cpu14  cpu5  cpufreq        kernel_max  online     uevent
cpu10       cpu15  cpu6  cpuidle        microcode   possible   vulnerabilities
cpu11       cpu2   cpu7  crash_hotplug  modalias    power

Source: https://www.kernel.org/doc/html/latest/admin-guide/abi-stable.html#file-stable-sysfs-devices-system-cpu

@viric
Copy link
Copy Markdown
Contributor Author

viric commented May 4, 2024

Yes, I'm sure. The code uses an integer to compose these paths:
/sys/devices/system/cpu/cpu0/topology/thread_siblings
/sys/devices/system/cpu/cpu1/topology/thread_siblings
/sys/devices/system/cpu/cpu2/topology/thread_siblings
....

I wrote the change because my computer has 6 cores and llama.cpp used only 3 of them.

@slaren slaren merged commit fcd84a0 into ggml-org:master May 4, 2024
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants