-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[#4766] Win32: Added support NUMA configuration with multiple count CPU sockets #4896
Conversation
3df26f8
to
1951eb8
Compare
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.
Thank you for contributing this PR! While NUMA is probably still rather uncommon, it'll be good to have the support (once the code compiles, that is).
typedef BOOL (*WINAPI glpie_t)( | ||
LOGICAL_PROCESSOR_RELATIONSHIP, | ||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, | ||
PDWORD); |
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.
Please move this code to compat/win32/
and use lazyload.h
(imitate existing code that declares and initializes the function pointer).
@@ -18,6 +18,67 @@ | |||
# endif | |||
#endif | |||
|
|||
#ifdef GIT_WINDOWS_NATIVE | |||
/// defines the GetLogicalProcessorInformationEx function |
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.
Please avoid C++-style comments. The existing code does not use them.
PDWORD); | ||
|
||
// Classic way to get number of cores in windows. | ||
static size_t get_windows_compatible_n_cores() { |
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.
Let's not add an extra function here. Instead, let's declare a single win32_online_cpus(void)
function in a header file in compat/win32/
and implement it in a .c
file. Or put them into compat/mingw.h
/compat/mingw.c
.
return 0; | ||
} | ||
|
||
GetLogicalProcessorInformationEx(RelationAll, NULL, &length); |
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.
Let's not forget to check the return value.
@dscho, I will not be able to fix this branch without testing, I have completely switched to Linux and FreeBSD. Is there anyone who can test this branch with NUMA nodes on any motherboard with two or more processors? |
@dscho When I did the fix in this PR, it accurately detected count threads correctly. |
@dscho which is very good on Linux there are no such problems and it has been originally laid down by POSIX library, Microsoft provides many methods in Winapi to get count threads, obviously software developers use the most common in tutorials and on stackoverflow, although this is wrong. Because of this on any Windows, only 50% CPU util is used with two NUMA nodes, 25% with 4 nodes, with 6 numa nodes 16.66% |
That's unfortunate, I have no such system to test, either. Let's just close this PR until the time when (if?) someone with such a system can test and work on it. |
Fixed this issue: #4766