diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-01-07 13:46:31 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-01-07 13:47:37 +0300 |
commit | 2cc6b249c382981cee15d69db8440e2ba3dd6453 (patch) | |
tree | 2ccc8a6ac319e2eaf82603ade275e1bf3e541040 /intern/cycles/util/system.cpp | |
parent | 361702f239528803260ba966d4174b8601e90a53 (diff) |
Cycles: Remove usage of libnumaapi
No need for it now since all the threading queries and
scheduling is done via TBB.
Should be no functional changes as all the removed code
is supposed to be unused.
Diffstat (limited to 'intern/cycles/util/system.cpp')
-rw-r--r-- | intern/cycles/util/system.cpp | 88 |
1 files changed, 1 insertions, 87 deletions
diff --git a/intern/cycles/util/system.cpp b/intern/cycles/util/system.cpp index f12e15e756f..61ad552fa89 100644 --- a/intern/cycles/util/system.cpp +++ b/intern/cycles/util/system.cpp @@ -20,9 +20,8 @@ #include "util/string.h" #include "util/types.h" -#include <numaapi.h> - #include <OpenImageIO/sysutil.h> + OIIO_NAMESPACE_USING #ifdef _WIN32 @@ -41,83 +40,6 @@ OIIO_NAMESPACE_USING CCL_NAMESPACE_BEGIN -bool system_cpu_ensure_initialized() -{ - static bool is_initialized = false; - static bool result = false; - if (is_initialized) { - return result; - } - is_initialized = true; - const NUMAAPI_Result numa_result = numaAPI_Initialize(); - result = (numa_result == NUMAAPI_SUCCESS); - return result; -} - -/* Fallback solution, which doesn't use NUMA/CPU groups. */ -static int system_cpu_thread_count_fallback() -{ -#ifdef _WIN32 - SYSTEM_INFO info; - GetSystemInfo(&info); - return info.dwNumberOfProcessors; -#elif defined(__APPLE__) - int count; - size_t len = sizeof(count); - int mib[2] = {CTL_HW, HW_NCPU}; - sysctl(mib, 2, &count, &len, NULL, 0); - return count; -#else - return sysconf(_SC_NPROCESSORS_ONLN); -#endif -} - -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)) { - continue; - } - num_threads += system_cpu_num_numa_node_processors(node); - } - return num_threads; -} - -int system_cpu_num_numa_nodes() -{ - if (!system_cpu_ensure_initialized()) { - /* Fallback to a single node with all the threads. */ - return 1; - } - return numaAPI_GetNumNodes(); -} - -bool system_cpu_is_numa_node_available(int node) -{ - if (!system_cpu_ensure_initialized()) { - return true; - } - return numaAPI_IsNodeAvailable(node); -} - -int system_cpu_num_numa_node_processors(int node) -{ - if (!system_cpu_ensure_initialized()) { - return system_cpu_thread_count_fallback(); - } - return numaAPI_GetNumNodeProcessors(node); -} - -bool system_cpu_run_thread_on_node(int node) -{ - if (!system_cpu_ensure_initialized()) { - return true; - } - return numaAPI_RunThreadOnNode(node); -} - int system_console_width() { int columns = 0; @@ -137,14 +59,6 @@ int system_console_width() return (columns > 0) ? columns : 80; } -int system_cpu_num_active_group_processors() -{ - if (!system_cpu_ensure_initialized()) { - return system_cpu_thread_count_fallback(); - } - return numaAPI_GetNumCurrentNodesProcessors(); -} - /* Equivalent of Windows __cpuid for x86 processors on other platforms. */ #if (!defined(_WIN32) || defined(FREE_WINDOWS)) && (defined(__x86_64__) || defined(__i386__)) static void __cpuid(int data[4], int selector) |