Skip to content

Commit

Permalink
Disable OpenMP on Mac (#503)
Browse files Browse the repository at this point in the history
* Disable OpenMP on Mac platform

Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com>

* Fix typo

Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com>

* Fix IsOmpRelevant

Signed-off-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com>
  • Loading branch information
Valeriy Fedyunin committed Dec 14, 2021
1 parent e2fd602 commit 5189ed0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NeoML/docs/en/API/NN/MathEngine.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Platform | CPU | GPU
----------|-----|-----
Windows | OpenMP + MKL | CUDA
Linux | OpenMP + MKL | -
MacOS | OpenMP + MKL | -
MacOS | MKL | -
Android | OpenMP + ARM Neon | Vulkan
iOS | ARM Neon | Metal

Expand Down
2 changes: 1 addition & 1 deletion NeoML/docs/ru/API/NN/MathEngine.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
----------|-----|-----
Windows | OpenMP + MKL | CUDA
Linux | OpenMP + MKL | -
MacOS | OpenMP + MKL | -
MacOS | MKL | -
Android | OpenMP + ARM Neon | Vulkan
iOS | ARM Neon | Metal

Expand Down
7 changes: 7 additions & 0 deletions NeoMathEngine/include/NeoMathEngine/OpenMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ const int MinOmpOperationCount = 32768;
// operationCount is the total number of operations across all tasks
inline bool IsOmpRelevant( int taskCount, int64_t operationCount = MinOmpOperationCount )
{
#ifdef NEOML_USE_OMP
return taskCount > 1 && operationCount >= MinOmpOperationCount;
#else
(void)MinOmpOperationCount;
(void)taskCount;
(void)operationCount;
return false;
#endif
}

// Returns the maximum possible number of threads used in an OMP block
Expand Down
2 changes: 1 addition & 1 deletion NeoMathEngine/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ endif()


# OpenMP
if(NOT IOS AND NOT (DARWIN AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64?"))
if(NOT IOS AND NOT DARWIN)
link_openmp(${PROJECT_NAME})
endif()

Expand Down

0 comments on commit 5189ed0

Please sign in to comment.