py-torch: find openmp when %fj (#16822)

Fix for 'FindOpenMP.cmake' to detect openmp 
settings used by Fujitsu compiler.
This commit is contained in:
Tomoki, Karatsu 2020-05-27 16:32:11 +09:00 committed by GitHub
parent fcacf8dc9d
commit 6b8775f6af
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,20 @@
--- pytorch/cmake/Modules/FindOpenMP.cmake.org 2020-05-26 17:43:53.000000000 +0900
+++ pytorch/cmake/Modules/FindOpenMP.cmake 2020-05-26 17:46:37.000000000 +0900
@@ -84,7 +84,7 @@
unset(OpenMP_FLAG_CANDIDATES)
set(OMP_FLAG_GNU "-fopenmp")
- set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp")
+ set(OMP_FLAG_Clang "-fopenmp" "-fopenmp=libomp" "-fopenmp=libiomp5")
# AppleClang may need a header file, search for omp.h with hints to brew
# default include dir
@@ -245,7 +245,7 @@
set(OpenMP_libomp_LIBRARY "${MKL_OPENMP_LIBRARY}" CACHE STRING "libomp location for OpenMP")
else()
find_library(OpenMP_libomp_LIBRARY
- NAMES omp gomp iomp5
+ NAMES fjomp omp gomp iomp5
HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES}
DOC "libomp location for OpenMP"
)

View File

@ -178,6 +178,10 @@ class PyTorch(PythonPackage, CudaPackage):
sha256='7781c7ec0a661bf5a946a659f80e90df9dba116ad168762f15b10547113ae600',
when='@1.1:1.5')
# Fix for 'FindOpenMP.cmake'
# to detect openmp settings used by Fujitsu compiler.
patch('detect_omp_of_fujitsu_compiler.patch', when='%fj')
# Both build and install run cmake/make/make install
# Only run once to speed up build times
phases = ['install']