Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from May 4, 2024

Conversation

viric
Copy link
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
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
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 ggerganov:master May 4, 2024
58 checks passed
nopperl pushed a commit to nopperl/llama.cpp that referenced this pull request May 5, 2024
teleprint-me pushed a commit to teleprint-me/llama.cpp that referenced this pull request May 7, 2024
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.

None yet

3 participants