[x265] [PATCH 2 of 2] CLI: new logic for '--pools <int>' option [Credit to Mateusz <mateuszb at poczta.onet.pl>]

praveen at multicorewareinc.com praveen at multicorewareinc.com
Mon May 23 12:19:50 CEST 2016


# HG changeset patch
# User Praveen Tiwari <praveen at multicorewareinc.com>
# Date 1463998658 -19800
#      Mon May 23 15:47:38 2016 +0530
# Node ID 5af929bc0ed0827ae0be018c1c8edc10d8650406
# Parent  2f8a373347649f29953ca9f434eec329e1339aca
CLI: new logic for '--pools <int>' option [Credit to Mateusz <mateuszb at poczta.onet.pl>]

For '--pools N' option we create exactly N threads.
For old logic please add a comma, for example '--pools 24,'

diff -r 2f8a37334764 -r 5af929bc0ed0 source/common/threadpool.cpp
--- a/source/common/threadpool.cpp	Mon May 23 15:26:45 2016 +0530
+++ b/source/common/threadpool.cpp	Mon May 23 15:47:38 2016 +0530
@@ -273,7 +273,7 @@
     }
     delete groupAffinityPointer;
 #elif HAVE_LIBNUMA
-    if (bNumaSupport >= 0)
+    if (bNumaSupport)
     {
         for (int i = 0; i < numNumaNodes; i++)
         {
@@ -341,8 +341,16 @@
             else
             {
                 int count = atoi(nodeStr);
-                threadsPerPool[i] = X265_MIN(count, cpusPerNode[i]);
-                nodeMaskPerPool[i] = ((uint64_t)1 << i);
+                if (i > 0 || strchr(nodeStr, ','))   // it is comma -> old logic
+                {
+                    threadsPerPool[i] = X265_MIN(count, cpusPerNode[i]);
+                    nodeMaskPerPool[i] = ((uint64_t)1 << i);
+                }
+                else                                 // new logic: exactly 'count' threads on all NUMAs
+                {
+                    threadsPerPool[numNumaNodes] = X265_MIN(count, numNumaNodes * MAX_POOL_THREADS);
+                    nodeMaskPerPool[numNumaNodes] = ((uint64_t)-1 >> (64 - numNumaNodes));
+                }
             }
 
             /* consume current node string, comma, and white-space */


More information about the x265-devel mailing list