forked from mindspore-Ecosystem/mindspore
add patch for onednn
This commit is contained in:
parent
6234ff6700
commit
e576d18758
|
@ -28,6 +28,7 @@ else()
|
||||||
MD5 ${MD5}
|
MD5 ${MD5}
|
||||||
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0001-fix-user-threadpool-bug.patch
|
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0001-fix-user-threadpool-bug.patch
|
||||||
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0002-fix-pool-nthr-bug.patch
|
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0002-fix-pool-nthr-bug.patch
|
||||||
|
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0003-fix-zero-threads-identified-on-AMD.patch
|
||||||
CMAKE_OPTION -DDNNL_ARCH_OPT_FLAGS='' -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS=OFF
|
CMAKE_OPTION -DDNNL_ARCH_OPT_FLAGS='' -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS=OFF
|
||||||
${USE_MS_THREADPOOL} -DDNNL_ENABLE_CONCURRENT_EXEC=ON)
|
${USE_MS_THREADPOOL} -DDNNL_ENABLE_CONCURRENT_EXEC=ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/src/cpu/platform.cpp b/src/cpu/platform.cpp
|
||||||
|
index 1397073ba..041a3436f 100644
|
||||||
|
--- a/src/cpu/platform.cpp
|
||||||
|
+++ b/src/cpu/platform.cpp
|
||||||
|
@@ -154,6 +154,8 @@ unsigned get_num_cores() {
|
||||||
|
// function supports process affinity.
|
||||||
|
unsigned get_max_threads_to_use() {
|
||||||
|
int num_cores_per_socket = (int)dnnl::impl::cpu::platform::get_num_cores();
|
||||||
|
+ if (num_cores_per_socket == 0)
|
||||||
|
+ num_cores_per_socket = std::thread::hardware_concurrency();
|
||||||
|
#if defined(_WIN32)
|
||||||
|
DWORD_PTR proc_affinity_mask;
|
||||||
|
DWORD_PTR sys_affinity_mask;
|
Loading…
Reference in New Issue