summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/py-torch/detect_omp_of_fujitsu_compiler.patch20
-rw-r--r--var/spack/repos/builtin/packages/py-torch/package.py4
2 files changed, 24 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-torch/detect_omp_of_fujitsu_compiler.patch b/var/spack/repos/builtin/packages/py-torch/detect_omp_of_fujitsu_compiler.patch
new file mode 100644
index 0000000000..519d66869d
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/detect_omp_of_fujitsu_compiler.patch
@@ -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"
+ )
diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py
index ce69a5581c..eb2eec608c 100644
--- a/var/spack/repos/builtin/packages/py-torch/package.py
+++ b/var/spack/repos/builtin/packages/py-torch/package.py
@@ -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']