<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 20, 2016 at 4:31 PM, <span dir="ltr"><<a href="mailto:praveen@multicorewareinc.com" target="_blank">praveen@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Praveen Tiwari <<a href="mailto:praveen@multicorewareinc.com">praveen@multicorewareinc.com</a>><br>
# Date 1463738737 -19800<br>
# Fri May 20 15:35:37 2016 +0530<br>
# Node ID e988eee2f0dc962b9b94c8cef6f739522bce9afb<br>
# Parent 9a6ab28b736e1167ac26977d7da8ab2d23cc296f<br>
threadpool.cpp: nicely populate detected NUMA node along with logical cores per node -> windows system fix<br>
<br>
diff -r 9a6ab28b736e -r e988eee2f0dc source/common/threadpool.cpp<br>
--- a/source/common/threadpool.cpp Thu May 19 16:27:58 2016 +0530<br>
+++ b/source/common/threadpool.cpp Fri May 20 15:35:37 2016 +0530<br>
@@ -251,7 +251,6 @@<br>
memset(nodeMaskPerPool, 0, sizeof(nodeMaskPerPool));<br>
<br>
int numNumaNodes = X265_MIN(getNumaNodeCount(), MAX_NODE_NUM);<br>
- int cpuCount = getCpuCount();<br>
bool bNumaSupport = false;<br>
<br>
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_WIN7<br>
@@ -261,20 +260,24 @@<br>
#endif<br>
<br>
<br>
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_WIN7<br>
+ PGROUP_AFFINITY groupAffinityPointer = new GROUP_AFFINITY;<br>
+ for (int i = 0; i < numNumaNodes; i++)<br>
+ {<br>
+ GetNumaNodeProcessorMaskEx((UCHAR)i, groupAffinityPointer);<br>
+ cpusPerNode[i] = popCount(groupAffinityPointer->Mask);<br>
+ }<br>
+ delete groupAffinityPointer;<br>
+#elif HAVE_LIBNUMA<br>
+ int cpuCount = getCpuCount();<br>
for (int i = 0; i < cpuCount; i++)<br>
{<br>
-#if defined(_WIN32_WINNT) && _WIN32_WINNT >= _WIN32_WINNT_WIN7<br>
- UCHAR node;<br>
- if (GetNumaProcessorNode((UCHAR)i, &node))<br>
- cpusPerNode[X265_MIN(node, (UCHAR)MAX_NODE_NUM)]++;<br>
- else<br>
-#elif HAVE_LIBNUMA<br>
if (bNumaSupport >= 0)<br>
cpusPerNode[X265_MIN(numa_node_of_cpu(i), MAX_NODE_NUM)]++;<br>
- else<br>
+ }<br></blockquote><div><br></div><div>Looks like linux is still counting cpusPerNode[] by first asking for # CPUs and then asking which NUMA node each CPU belongs to.</div><div>Can we move linux to also work similar to how windows is doing it - ask for how many CPUs are there in each NUMA node? I think that is cleaner.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+#elif<br>
+ cpusPerNode[0] = getCpuCount();<br>
#endif<br>
- cpusPerNode[0]++;<br>
- }<br>
<br>
if (bNumaSupport && p->logLevel >= X265_LOG_DEBUG)<br>
for (int i = 0; i < numNumaNodes; i++)<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div></div>