-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Add support for cpu_get_num_physical_cores() on Windows #8771
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
Conversation
@mofosyne Could you have a look at my PR? Or anyone others? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need some reports on Windows that this change works as expected
I noticed that the CI I noticed that these two CIs were added due to #7191 To solve this, I attempted to skip the ARM64 platform with the following macros:
However, despite my repeated attempts, none of these macros related to the ARM architecture were detected in this CI environment. I suspect there might be an issue with the toolchain, but unfortunately, I don't have any ARM64+Windows machine for testing. Could you kindly suggest any solutions or approaches to resolve this issue? |
I carefully reviewed the CI error and found that the issue seems to be with
to bypass the issue with the toolchain on ARM64+Windows by detecting |
@Septa2112 Once this is merged I'll take a look at why ARM64 MinGW64 is not building :-) |
@hmartinez82 That's great. Let's see when the PR will be merged. Perhaps need more test on windows. |
@Septa2112 Just as I suspected, after glancing over the PR, there's nothing there that would not work. I removed the The build was successful in both cases. |
@hmartinez82 Thanks for you testing. But if I remove this macro, the corresponding CI checks will fail. Maybe something else is causing the issue? This related CI was introduced in the issue #7191. |
Ahh ok, I thought that the issue was during build time. I'll try to replicate what the CI does. Thank you. |
…l-org#8771) * Add support for cpu_get_num_phsical_cores() on Windows * fix build bug on msys2-clang64 and ucrt64 * avoid adding new function * add new macros to avoid windows+mingw64 * Add error checking to return default value
…l-org#8771) * Add support for cpu_get_num_phsical_cores() on Windows * fix build bug on msys2-clang64 and ucrt64 * avoid adding new function * add new macros to avoid windows+mingw64 * Add error checking to return default value
…l-org#8771) * Add support for cpu_get_num_phsical_cores() on Windows * fix build bug on msys2-clang64 and ucrt64 * avoid adding new function * add new macros to avoid windows+mingw64 * Add error checking to return default value
Add a function
cpu_get_num_cores_win(bool print_physical_core_num)
to detect the physical and logical cores on Windows. Now the program will successfully detect all sockets and CPUs and set the default number of threads more accurately on Windows.Test Platform
Before
When I run
llama-cli.exe -m <my_model> -p <prompt>
, the output is like this:Intel Xeon CPU E5-2699 v4 (2 Sockets)
Intel i7-1185G7
Intel MTL Ultra5
After Modification
Intel Xeon CPU E5-2699 v4 (2 Sockets)
Intel i7-1185G7
Intel MTL Ultra5