diff options
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/cmake/macros.cmake | 6 | ||||
-rw-r--r-- | intern/cycles/util/CMakeLists.txt | 10 | ||||
-rw-r--r-- | intern/cycles/util/system.cpp | 88 | ||||
-rw-r--r-- | intern/cycles/util/system.h | 27 | ||||
-rw-r--r-- | intern/cycles/util/thread.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/util/thread.h | 5 |
6 files changed, 3 insertions, 138 deletions
diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake index 957b702fd3a..044058a25a8 100644 --- a/intern/cycles/cmake/macros.cmake +++ b/intern/cycles/cmake/macros.cmake @@ -168,12 +168,6 @@ macro(cycles_target_link_libraries target) target_link_libraries(${target} extern_hipew) endif() - if(CYCLES_STANDALONE_REPOSITORY) - target_link_libraries(${target} extern_numaapi) - else() - target_link_libraries(${target} bf_intern_numaapi) - endif() - if(UNIX AND NOT APPLE) if(CYCLES_STANDALONE_REPOSITORY) target_link_libraries(${target} extern_libc_compat) diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index b68646a44d5..a26934c0ace 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -53,16 +53,6 @@ if(WITH_CYCLES_STANDALONE) endif() endif() -if(CYCLES_STANDALONE_REPOSITORY) - list(APPEND INC_SYS - ../../third_party/numaapi/include - ) -else() - list(APPEND INC_SYS - ../../numaapi/include - ) -endif() - set(SRC_HEADERS algorithm.h aligned_malloc.h 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) diff --git a/intern/cycles/util/system.h b/intern/cycles/util/system.h index 425c7255cbe..d26c324be0a 100644 --- a/intern/cycles/util/system.h +++ b/intern/cycles/util/system.h @@ -22,36 +22,9 @@ CCL_NAMESPACE_BEGIN -/* Make sure CPU groups / NUMA API is initialized. */ -bool system_cpu_ensure_initialized(); - -/* Get total number of threads in all NUMA nodes / CPU groups. */ -int system_cpu_thread_count(); - /* Get width in characters of the current console output. */ int system_console_width(); -/* Get number of available nodes. - * - * This is in fact an index of last node plus one and it's not guaranteed - * that all nodes up to this one are available. */ -int system_cpu_num_numa_nodes(); - -/* Returns truth if the given node is available for compute. */ -bool system_cpu_is_numa_node_available(int node); - -/* Get number of available processors on a given node. */ -int system_cpu_num_numa_node_processors(int node); - -/* Runs the current thread and its children on a specific node. - * - * Returns truth if affinity has successfully changed. */ -bool system_cpu_run_thread_on_node(int node); - -/* Number of processors within the current CPU group (or within active thread - * thread affinity). */ -int system_cpu_num_active_group_processors(); - string system_cpu_brand_string(); int system_cpu_bits(); bool system_cpu_support_sse2(); diff --git a/intern/cycles/util/thread.cpp b/intern/cycles/util/thread.cpp index 24a0600425d..e2e785b9a80 100644 --- a/intern/cycles/util/thread.cpp +++ b/intern/cycles/util/thread.cpp @@ -21,7 +21,7 @@ CCL_NAMESPACE_BEGIN -thread::thread(function<void()> run_cb, int node) : run_cb_(run_cb), joined_(false), node_(node) +thread::thread(function<void()> run_cb) : run_cb_(run_cb), joined_(false) { #ifdef __APPLE__ /* Set the stack size to 2MB to match Linux. The default 512KB on macOS is @@ -46,9 +46,6 @@ thread::~thread() void *thread::run(void *arg) { thread *self = (thread *)(arg); - if (self->node_ != -1) { - system_cpu_run_thread_on_node(self->node_); - } self->run_cb_(); return NULL; } diff --git a/intern/cycles/util/thread.h b/intern/cycles/util/thread.h index 09686e4b23f..bd6a83e1dd1 100644 --- a/intern/cycles/util/thread.h +++ b/intern/cycles/util/thread.h @@ -46,9 +46,7 @@ typedef std::condition_variable thread_condition_variable; class thread { public: - /* NOTE: Node index of -1 means that affinity will be inherited from the - * parent thread and no override on top of that will happen. */ - thread(function<void()> run_cb, int node = -1); + thread(function<void()> run_cb); ~thread(); static void *run(void *arg); @@ -62,7 +60,6 @@ class thread { std::thread std_thread; #endif bool joined_; - int node_; }; using thread_spin_lock = tbb::spin_mutex; |