Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-08-05 16:30:12 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-08-05 16:33:47 +0300
commit8f1a55831c893b664f8648eac029b9d9d5aa746d (patch)
tree3a1f3eef8c281d1002f9e7971517d5580057913a
parentafff94f09f6a1d59ef2ea75384a1e527e4e9415a (diff)
Cycles: Fix wrong number of threads on multi-socket machines
The issue was caused by a limitation of GetNumaNodeProcessorMask(): on systems with more than 64 processors, this parameter is set to the processor mask for the node only if the node is in the same processor group as the calling thread. Otherwise, the parameter is set to zero. Patch from Max Dmitrichenko, thanks!
-rw-r--r--intern/numaapi/source/numaapi_win32.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/intern/numaapi/source/numaapi_win32.c b/intern/numaapi/source/numaapi_win32.c
index bd370707656..f205968b6b4 100644
--- a/intern/numaapi/source/numaapi_win32.c
+++ b/intern/numaapi/source/numaapi_win32.c
@@ -193,22 +193,22 @@ bool numaAPI_IsNodeAvailable(int node) {
//
// This is needed because numaApiGetNumNodes() is not guaranteed to
// give total amount of nodes and some nodes might be unavailable.
- ULONGLONG processor_mask;
- if (!_GetNumaNodeProcessorMask(node, &processor_mask)) {
+ GROUP_AFFINITY processor_mask = { 0 };
+ if (!_GetNumaNodeProcessorMaskEx(node, &processor_mask)) {
return false;
}
- if (processor_mask == 0) {
+ if (processor_mask.Mask == 0) {
return false;
}
return true;
}
int numaAPI_GetNumNodeProcessors(int node) {
- ULONGLONG processor_mask;
- if (!_GetNumaNodeProcessorMask(node, &processor_mask)) {
+ GROUP_AFFINITY processor_mask = { 0 };
+ if (!_GetNumaNodeProcessorMaskEx(node, &processor_mask)) {
return 0;
}
- return countNumSetBits(processor_mask);
+ return countNumSetBits(processor_mask.Mask);
}
////////////////////////////////////////////////////////////////////////////////
@@ -239,11 +239,12 @@ bool numaAPI_RunProcessOnNode(int node) {
// TODO(sergey): Make sure requested node is within active CPU group.
// Change affinity of the proces to make it to run on a given node.
HANDLE process_handle = GetCurrentProcess();
- ULONGLONG processor_mask;
- if (_GetNumaNodeProcessorMask(node, &processor_mask) == 0) {
+ GROUP_AFFINITY processor_mask = { 0 };
+ if (_GetNumaNodeProcessorMaskEx(node, &processor_mask) == 0) {
return false;
}
- if (_SetProcessAffinityMask(process_handle, processor_mask) == 0) {
+ // TODO: Affinity should respect processor group.
+ if (_SetProcessAffinityMask(process_handle, processor_mask.Mask) == 0) {
return false;
}
return true;