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>2016-06-04 02:29:13 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-06-06 10:14:37 +0300
commitb62faa54de70fd8a4125c98cce2d12f3291139fc (patch)
tree64cae6f76c23212ff2dc93b26eef9647386aea1a /intern/cycles/util/util_task.cpp
parent9d090ed1cde2ae75c36548ed31daae10f121317a (diff)
Cycles: Add support of processor groups
Currently for windows only, this is an initial commit towards native support of NUMA. Current commit makes it so Cycles will use all logical processors on Windows running on system with more than 64 threads. Reviewers: juicyfruit, dingto, lukasstockner97, maiself, brecht Subscribers: LazyDodo Differential Revision: https://developer.blender.org/D2049
Diffstat (limited to 'intern/cycles/util/util_task.cpp')
-rw-r--r--intern/cycles/util/util_task.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index d86aa8a4a46..352ba81c95a 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -16,6 +16,7 @@
#include "util_debug.h"
#include "util_foreach.h"
+#include "util_logging.h"
#include "util_system.h"
#include "util_task.h"
#include "util_time.h"
@@ -198,12 +199,30 @@ void TaskScheduler::init(int num_threads)
/* automatic number of threads */
num_threads = system_cpu_thread_count();
}
+ VLOG(1) << "Creating pool of " << num_threads << " threads.";
/* launch threads that will be waiting for work */
threads.resize(num_threads);
- for(size_t i = 0; i < threads.size(); i++)
- threads[i] = new thread(function_bind(&TaskScheduler::thread_run, i + 1));
+ int num_groups = system_cpu_group_count();
+ int thread_index = 0;
+ for(int group = 0; group < num_groups; ++group) {
+ /* NOTE: That's not really efficient from threading point of view,
+ * but it is simple to read and it doesn't make sense to use more
+ * user-specified threads than logical threads anyway.
+ */
+ int num_group_threads = (group == num_groups - 1)
+ ? (threads.size() - thread_index)
+ : system_cpu_group_thread_count(group);
+ for(int group_thread = 0;
+ group_thread < num_group_threads && thread_index < threads.size();
+ ++group_thread, ++thread_index)
+ {
+ threads[thread_index] = new thread(function_bind(&TaskScheduler::thread_run,
+ thread_index + 1),
+ group);
+ }
+ }
}
users++;