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-01-11 19:55:36 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-01-11 19:55:36 +0300
commit48506a3431fb5b4396f7cf2d9c6a8a208b3c0df5 (patch)
tree4de3ac716082d7f7266c987cd8b470af339f0644 /intern/cycles/util/util_system.cpp
parentff44a9957ee553a71585e66ffea615503075313a (diff)
Fix T60145: Cycles resets manually set affinity
This change brings back old original logic which was checking whether worker threads do fit into an active CPU group. But it does it a bit smarter now and is also checking affinity within that group. This way Cycles will use all threads on a Threadripper2 CPU if it's set to automatic number of threads, but on another hand will not change affinity if user requested 16 threads and changed Blender affinity.
Diffstat (limited to 'intern/cycles/util/util_system.cpp')
-rw-r--r--intern/cycles/util/util_system.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp
index cc2d7017fd8..a22bd25ce77 100644
--- a/intern/cycles/util/util_system.cpp
+++ b/intern/cycles/util/util_system.cpp
@@ -40,7 +40,7 @@ bool system_cpu_ensure_initialized()
{
static bool is_initialized = false;
static bool result = false;
- if (is_initialized) {
+ if(is_initialized) {
return result;
}
is_initialized = true;
@@ -71,8 +71,8 @@ int system_cpu_thread_count()
{
const int num_nodes = system_cpu_num_numa_nodes();
int num_threads = 0;
- for (int node = 0; node < num_nodes; ++node) {
- if (!system_cpu_is_numa_node_available(node)) {
+ for(int node = 0; node < num_nodes; ++node) {
+ if(!system_cpu_is_numa_node_available(node)) {
continue;
}
num_threads += system_cpu_num_numa_node_processors(node);
@@ -82,7 +82,7 @@ int system_cpu_thread_count()
int system_cpu_num_numa_nodes()
{
- if (!system_cpu_ensure_initialized()) {
+ if(!system_cpu_ensure_initialized()) {
/* Fallback to a single node with all the threads. */
return 1;
}
@@ -91,7 +91,7 @@ int system_cpu_num_numa_nodes()
bool system_cpu_is_numa_node_available(int node)
{
- if (!system_cpu_ensure_initialized()) {
+ if(!system_cpu_ensure_initialized()) {
return true;
}
return numaAPI_IsNodeAvailable(node);
@@ -99,7 +99,7 @@ bool system_cpu_is_numa_node_available(int node)
int system_cpu_num_numa_node_processors(int node)
{
- if (!system_cpu_ensure_initialized()) {
+ if(!system_cpu_ensure_initialized()) {
return system_cpu_thread_count_fallback();
}
return numaAPI_GetNumNodeProcessors(node);
@@ -107,12 +107,20 @@ int system_cpu_num_numa_node_processors(int node)
bool system_cpu_run_thread_on_node(int node)
{
- if (!system_cpu_ensure_initialized()) {
+ if(!system_cpu_ensure_initialized()) {
return true;
}
return numaAPI_RunThreadOnNode(node);
}
+int system_cpu_num_active_group_processors()
+{
+ if(!system_cpu_ensure_initialized()) {
+ return system_cpu_thread_count_fallback();
+ }
+ return numaAPI_GetNumCurrentNodesProcessors();
+}
+
#if !defined(_WIN32) || defined(FREE_WINDOWS)
static void __cpuid(int data[4], int selector)
{