Reputation: 5061
On Windows, how can I:
Upvotes: 3
Views: 843
Reputation: 61
To get the index of the highest node:
auto highestnode = 0UL;
GetNumaHighestNodeNumber(&highestnode);
To get the affinity of all logical cores on a node for up to 64 total logical cores:
auto mask = 0ULL;
GetNumaNodeProcessorMask(nodeindex, &mask);
To set thread affinity:
SetThreadAffinityMask(GetCurrentThread(), mask);
Or for greater than 64 total logical cores:
auto node = static_cast<PGROUP_AFFINITY>(malloc(sizeof(PGROUP_AFFINITY)));;
GetNumaNodeProcessorMaskEx(nodeindex, node);
Where the mask for the node is nodes->Mask.
Large nodes with more than 64 logical cores will be split up into groups specified by nodes->Group.
Upvotes: 2